summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Teira <manuel.teira@telefonica.net>2007-01-05 20:18:18 +0000
committerKoen Kooi <koen@openembedded.org>2007-01-05 20:18:18 +0000
commitce603663471dacc16b7a10533812f0a7ad964f43 (patch)
tree20255f671534f44a83697a2a5c7b84f32e27f230
parenta0de58d5b3fd9318d450ad5312a33b730ed64023 (diff)
xserver-kdrive-imageon: add (another) w100 based xserver, closes #1752
-rw-r--r--packages/xorg-xserver/xserver-kdrive-imageon_X11R7.1-1.1.0.bb52
-rw-r--r--packages/xorg-xserver/xserver-kdrive/kdrive-imageon.patch8574
-rw-r--r--packages/xorg-xserver/xserver-kdrive/kdrive-vidmemarea.patch751
3 files changed, 9377 insertions, 0 deletions
diff --git a/packages/xorg-xserver/xserver-kdrive-imageon_X11R7.1-1.1.0.bb b/packages/xorg-xserver/xserver-kdrive-imageon_X11R7.1-1.1.0.bb
new file mode 100644
index 0000000000..75b4a9956b
--- /dev/null
+++ b/packages/xorg-xserver/xserver-kdrive-imageon_X11R7.1-1.1.0.bb
@@ -0,0 +1,52 @@
+DESCRIPTION = "X server for Imageon Cards from freedesktop.org"
+DESCRIPTION_xserver-kdrive-imageon = "X server from freedesktop.org, supporting the ATI imageon 100 chipset"
+
+COMPATIBLE_MACHINE = "(c7x0|hx4700)"
+
+SECTION = "x11/base"
+LICENSE = "MIT"
+
+DEPENDS = "tslib xproto libxdmcp xextproto xtrans libxau virtual/libx11 libxext libxrandr fixesproto damageproto libxfont resourceproto compositeproto xcalibrateext recordproto videoproto scrnsaverproto"
+
+PROVIDES = "virtual/xserver"
+RPROVIDES = "virtual/xserver"
+
+PR = "r0"
+
+FILESPATH = "${FILE_DIRNAME}/xserver-kdrive"
+
+SRC_URI = "http://ftp.x.org/pub/X11R7.1/src/xserver/xorg-server-X11R7.1-1.1.0.tar.bz2 \
+ file://kmode.patch;patch=1 \
+ file://disable-apm.patch;patch=1 \
+ file://no-serial-probing.patch;patch=1 \
+ file://kdrive-evdev.patch;patch=1 \
+ file://kdrive-use-evdev.patch;patch=1 \
+ file://fbdev-not-fix.patch;patch=1 \
+ file://enable-builtin-fonts.patch;patch=1 \
+ file://optional-xkb.patch;patch=1 \
+ file://disable-xf86-dga-xorgcfg.patch;patch=1 \
+ file://enable-tslib.patch;patch=1 \
+ file://xcalibrate.patch;patch=1 \
+ file://kdrive-vidmemarea.patch;patch=1 \
+ file://kdrive-imageon.patch;patch=1"
+
+S = "${WORKDIR}/xorg-server-X11R7.1-1.1.0"
+
+inherit autotools pkgconfig
+
+ARM_INSTRUCTION_SET = "arm"
+W100_OECONF_arm = "--enable-imageon"
+
+EXTRA_OECONF = "--enable-composite --enable-kdrive \
+ --disable-dga --disable-dri --disable-xinerama \
+ --disable-xf86misc --disable-xf86vidmode \
+ --disable-xorg --disable-xorgcfg \
+ --disable-xkb --disable-xnest --disable-xvfb \
+ --disable-xevie --disable-xprint --disable-xtrap \
+ --disable-dmx ${W100_OECONF} \
+ --with-default-font-path=built-ins \
+ --enable-tslib --enable-xcalibrate \
+ ac_cv_file__usr_share_X11_sgml_defs_ent=no"
+
+FILES_${PN} = "${libdir}/xserver/SecurityPolicy \
+ ${bindir}/Ximageon"
diff --git a/packages/xorg-xserver/xserver-kdrive/kdrive-imageon.patch b/packages/xorg-xserver/xserver-kdrive/kdrive-imageon.patch
new file mode 100644
index 0000000000..16625df063
--- /dev/null
+++ b/packages/xorg-xserver/xserver-kdrive/kdrive-imageon.patch
@@ -0,0 +1,8574 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- xorg-server-X11R7.1-1.1.0.orig/configure.ac~kdrive-imageon
++++ xorg-server-X11R7.1-1.1.0.orig/configure.ac
+@@ -435,6 +435,7 @@
+ AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
+ AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
+ AC_ARG_ENABLE(xsdl, AS_HELP_STRING([--enable-xsdl], [Build the kdrive Xsdl server (default: auto)]), [XSDL=$enableval], [XSDL=auto])
++AC_ARG_ENABLE(imageon, AS_HELP_STRING([--enable-imageon], [Build the kdrive Ximageon server (default: no)]), [KDRIVEIMAGEON=$enableval], [KDRIVEIMAGEON=no])
+ dnl xprint
+ AC_ARG_ENABLE(freetype, AS_HELP_STRING([ --enable-freetype], [Build Xprint FreeType backend (default: yes)]), [XP_USE_FREETYPE=$enableval],[XP_USE_FREETYPE=no])
+ AC_ARG_WITH(freetype-config, AS_HELP_STRING([ --with-freetype-config=PROG], [Use FreeType configuration program PROG (default: auto)]), freetype_config=$withval, freetype_config=auto)
+@@ -1509,6 +1510,11 @@
+ AC_SUBST([XSDL_INCS])
+
+
++AM_CONDITIONAL(KDRIVEIMAGEON, [test "x$KDRIVEIMAGEON" = xyes])
++if test "x$KDRIVEIMAGEON" = xyes; then
++ AC_DEFINE(KDRIVEIMAGEON, 1, [Build Ximageon server])
++fi
++
+ dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
+ AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules])
+ AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
+@@ -1750,6 +1756,7 @@
+ hw/kdrive/epson/Makefile
+ hw/kdrive/fake/Makefile
+ hw/kdrive/fbdev/Makefile
++hw/kdrive/imageon/Makefile
+ hw/kdrive/i810/Makefile
+ hw/kdrive/linux/Makefile
+ hw/kdrive/mach64/Makefile
+--- xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/Makefile.am~kdrive-imageon
++++ xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/Makefile.am
+@@ -1,18 +1,9 @@
+-if KDRIVEVESA
+-VESA_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
+- smi via
+-endif
+-
+ if KDRIVEFBDEV
+ FBDEV_SUBDIRS = fbdev
+ endif
+
+-if XSDLSERVER
+-XSDL_SUBDIRS = sdl
+-endif
+-
+-if XEPHYR
+-XEPHYR_SUBDIRS = ephyr
++if KDRIVEIMAGEON
++IMAGEON_SUBDIRS = imageon
+ endif
+
+ SUBDIRS = \
+@@ -20,9 +11,9 @@
+ linux \
+ $(XSDL_SUBDIRS) \
+ $(FBDEV_SUBDIRS) \
++ $(IMAGEON_SUBDIRS) \
+ $(VESA_SUBDIRS) \
+- $(XEPHYR_SUBDIRS) \
+- fake
++ $(XEPHYR_SUBDIRS)
+
+ DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
+ smi via fbdev sdl ephyr src linux fake sis300
+--- /dev/null
++++ xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/imageon/Makefile.am
+@@ -0,0 +1,47 @@
++if KDRIVEFBDEV
++FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev
++FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
++endif
++
++INCLUDES = \
++ @KDRIVE_INCS@ \
++ $(FBDEV_INCLUDES) \
++ @KDRIVE_CFLAGS@
++
++bin_PROGRAMS = Ximageon
++
++if TSLIB
++TSLIB_FLAG = -lts
++endif
++
++noinst_LIBRARIES = libimageon.a
++
++libimageon_a_SOURCES = \
++ imageon.h \
++ imageon_regs.h \
++ imageon_const.h \
++ imageon.c \
++ imageon_cursor.c \
++ imageon_draw.c \
++ imageon_support.c \
++ imageon_video.c
++
++
++
++Ximageon_SOURCES = \
++ imageon_stub.c
++
++W100_LIBS = \
++ libimageon.a \
++ $(FBDEV_LIBS) \
++ @KDRIVE_LIBS@
++
++Ximageon_LDADD = \
++ $(W100_LIBS) \
++ @XSERVER_LIBS@ \
++ $(TSLIB_FLAG)
++
++
++Ximageon_DEPENDENCIES = \
++ libimageon.a \
++ $(FBDEV_LIBS)
+--- /dev/null
++++ xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/imageon/imageon.c
+@@ -0,0 +1,523 @@
++/*
++ * Copyright © 2007 Manuel Teira
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation, and that the name of Manuel Teira not be used in
++ * advertising or publicity pertaining to distribution of the software without
++ * specific, written prior permission. Manuel Teira makes no
++ * representations about the suitability of this software for any purpose. It
++ * is provided "as is" without express or implied warranty.
++ *
++ * MANUEL TEIRA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
++ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
++ * EVENT SHALL MANUEL TEIRA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
++ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
++ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
++ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++ * PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <kdrive-config.h>
++#endif
++#include "imageon.h"
++#include "imageon_regs.h"
++
++struct pci_id_entry w100_pci_ids[] = {
++ {0x1002, 0x5644, 0, "ATI Imageon 3200"},
++ {0x1002, 0x5741, 0, "ATI Imageon 100"},
++ {0x1002, 0x5744, 0, "ATI Imageon 3220"},
++ {0, 0, 0, NULL}
++};
++
++static Bool
++W100Map(KdCardInfo * card, W100CardInfo *w100c)
++{
++ w100c->mem_base = (CARD8 *) KdMapDevice(W100_MEM_BASE,
++ W100_MEM_SIZE);
++
++ if (w100c->mem_base == NULL) {
++ return FALSE;
++ }
++
++ w100c->reg_base = w100c->mem_base + W100_REG_OFFSET;
++
++ /*
++ * It doesn't matter mapping all the area as registers.
++ * There's only difference when HAVE_ASM_MTRR_H is defined.
++ * So, this call is doing nothing.
++ */
++ KdSetMappedMode(W100_MEM_BASE, W100_MEM_SIZE,
++ KD_MAPPED_MODE_REGISTERS);
++
++ return TRUE;
++}
++
++static void
++W100Unmap(KdCardInfo * card, W100CardInfo *w100c)
++{
++ if (w100c->mem_base) {
++ KdResetMappedMode(W100_MEM_BASE, W100_MEM_SIZE,
++ KD_MAPPED_MODE_REGISTERS);
++ KdUnmapDevice((void *) w100c->mem_base, W100_MEM_SIZE);
++ w100c->mem_base = w100c->reg_base = 0;
++ }
++}
++
++static Bool
++W100CardInit(KdCardInfo * card)
++{
++ W100CardInfo *w100c;
++ int i;
++ int ext_mem;
++ int int_mem;
++ Bool initialized = FALSE;
++
++ w100c = xcalloc(sizeof(W100CardInfo), 1);
++ if (w100c == NULL)
++ return FALSE;
++
++ if (!initialized && fbdevInitialize(card, &w100c->fbdev)) {
++ initialized = TRUE;
++ }
++
++ if (!initialized || !W100Map(card, w100c)) {
++ xfree(w100c);
++ return FALSE;
++ }
++ card->driver = w100c;
++
++ for (i = 0; w100_pci_ids[i].name != NULL; i++) {
++ if (w100_pci_ids[i].device == card->attr.deviceID) {
++ w100c->pci_id = &w100_pci_ids[i];
++ break;
++ }
++ }
++ ErrorF("Using ATI card: %s\n", w100c->pci_id->name);
++
++ ext_mem = MMIO_IN32(mmMC_EXT_MEM_LOCATION);
++ int_mem = MMIO_IN32(mmMC_FB_LOCATION);
++
++ w100c->memareas[0].priority = KD_VIDMEM_MAXPRIO;
++ w100c->memareas[0].start = (CARD8 *) ((int_mem & 0xffff) << 8);
++ w100c->memareas[0].size =
++ (((int_mem >> 16) & 0xffff) - (int_mem & 0xffff)) << 8;
++
++
++ w100c->memareas[1].priority = KD_VIDMEM_MINPRIO;
++ w100c->memareas[1].start = (CARD8 *)((ext_mem & 0xffff) << 8);
++ w100c->memareas[1].size =
++ (((ext_mem >> 16) & 0xffff) - (ext_mem & 0xffff)) << 8;
++
++ /* Get some register values */
++ w100c->regs.ENG_CNTL = MMIO_IN32(mmENG_CNTL);
++ w100c->regs.VIDEO_CTRL = MMIO_IN32(mmVIDEO_CTRL);
++ w100c->regs.GRAPHIC_H_DISP = MMIO_IN32(mmGRAPHIC_H_DISP);
++ w100c->regs.GRAPHIC_V_DISP = MMIO_IN32(mmGRAPHIC_V_DISP);
++
++ DBG_IMAGEON(("Internal memory at 0x%08x(0x%08x), size %d bytes\n"
++ "External memory at 0x%08x(0x%08x), size %d bytes\n",
++ w100c->memareas[0].start,
++ W100_CARD2HOST(w100c->memareas[0].start),
++ w100c->memareas[0].size,
++ w100c->memareas[1].start,
++ W100_CARD2HOST(w100c->memareas[1].start),
++ w100c->memareas[1].size));
++
++ /* TODO: Change this to honour the framebuffer initial orientation? */
++ w100c->defaultRandR = RR_Rotate_90;
++ w100c->hwScreen.randr = w100c->defaultRandR;
++ return TRUE;
++}
++
++
++static void
++W100CardFini(KdCardInfo * card)
++{
++ W100CardInfo *w100c = (W100CardInfo *) card->driver;
++
++ W100Unmap(card, w100c);
++ fbdevCardFini(card);
++}
++
++static void
++W100MemSetup(KdScreenInfo *screen)
++{
++ W100CardInfo(screen);
++ W100MemArea *mem;
++ int fb_size, i;
++
++ /* Clear the VideoMemAreas set up by the framebuffer initialization */
++ for (i = 0; i < screen->num_videomem_areas; i++) {
++ xfree(screen->videomem_areas[i]);
++ }
++ xfree(screen->videomem_areas);
++
++ screen->videomem_areas = xcalloc(sizeof(KdVideoMemArea *),
++ W100_MEMAREAS);
++ screen->num_videomem_areas = W100_MEMAREAS;
++
++ fb_size = screen->fb[0].byteStride * screen->height;
++ DBG_IMAGEON(("Framebuffer required size: %d bytes\n", fb_size));
++ /* Try to place the framebuffer in the best VideoMemArea */
++ for (i = 0; i < W100_MEMAREAS; i++) {
++ mem = &w100c->memareas[i];
++ screen->videomem_areas[i] = xcalloc(sizeof(KdVideoMemArea), 1);
++ if (fb_size <= mem->size) {
++ DBG_IMAGEON(("Setting FrameBuffer to w100 address 0x%08x\n",
++ mem->start));
++ screen->fb[0].frameBuffer = W100_CARD2HOST(mem->start);
++ screen->videomem_areas[i]->priority = mem->priority;
++ screen->videomem_areas[i]->base = W100_CARD2HOST(mem->start);
++ screen->videomem_areas[i]->size = mem->size;
++ screen->videomem_areas[i]->available_offset = fb_size;
++ } else {
++ screen->videomem_areas[i]->priority = mem->priority;
++ screen->videomem_areas[i]->base = W100_CARD2HOST(mem->start);
++ screen->videomem_areas[i]->size = mem->size;
++ screen->videomem_areas[i]->available_offset = 0;
++ }
++ DBG_IMAGEON(("New videomem_area(priority:%d, start:0x%08x, size:%d, available_offset:%d\n",
++ screen->videomem_areas[i]->priority,
++ screen->videomem_areas[i]->base,
++ screen->videomem_areas[i]->size,
++ screen->videomem_areas[i]->available_offset));
++ }
++
++ w100c->hwScreen.x = 0;
++ w100c->hwScreen.y = 0;
++ w100c->hwScreen.width = screen->width;
++ w100c->hwScreen.height = screen->height;
++ w100c->hwScreen.bpp = screen->fb[0].bitsPerPixel;
++ w100c->hwScreen.offset = W100_HOST2CARD(screen->fb[0].frameBuffer);
++
++
++ DBG_IMAGEON(("HWScreen(x:%d,y:%d,width:%d,height:%d,bpp:%d,offset:0x%08x"
++ "(0x%08x), randr:%d)\n",
++ w100c->hwScreen.x,
++ w100c->hwScreen.y,
++ w100c->hwScreen.width,
++ w100c->hwScreen.height,
++ w100c->hwScreen.bpp,
++ w100c->hwScreen.offset,
++ screen->fb[0].frameBuffer,
++ w100c->hwScreen.randr));
++}
++
++static Bool
++W100ScreenInit(KdScreenInfo * screen)
++{
++ W100ScreenInfo *w100s;
++ W100CardInfo(screen);
++ Bool success = FALSE;
++
++ w100s = xcalloc(sizeof(W100ScreenInfo), 1);
++ if (w100s == NULL)
++ return FALSE;
++
++ w100s->w100c = w100c;
++ w100s->screen = screen;
++ screen->driver = w100s;
++
++ if (screen->fb[0].depth == 0) {
++ screen->fb[0].depth = 16;
++ }
++
++ success = fbdevScreenInitialize(screen, &w100s->fbdev);
++
++ if (!success) {
++ screen->driver = NULL;
++ xfree(w100s);
++ return FALSE;
++ }
++
++ W100MemSetup(screen);
++
++ return TRUE;
++}
++
++static void
++W100ScreenFini(KdScreenInfo * screen)
++{
++ W100ScreenInfo *w100s = (W100ScreenInfo *) screen->driver;
++ W100CardInfo *w100c = screen->card->driver;
++
++ fbdevScreenFini(screen);
++ xfree(w100s);
++ screen->driver = 0;
++}
++
++static Bool
++W100InitScreen(ScreenPtr pScreen)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++
++ W100InitVideo(pScreen);
++ return fbdevInitScreen(pScreen);
++}
++
++#ifdef RANDR
++
++static Bool W100RandRSetConfig(ScreenPtr pScreen,
++ Rotation randr,
++ int rate,
++ RRScreenSizePtr pSize)
++{
++ KdScreenPriv(pScreen);
++ KdScreenInfo *screen = pScreenPriv->screen;
++ W100CardInfo(pScreenPriv);
++ Bool screenEnabled = pScreenPriv->enabled;
++ KdMouseMatrix m;
++
++ DBG_IMAGEON(("W100RandRSetConfig(randr:%d,pSize:%dx%d)\n",
++ randr, pSize->width, pSize->height));
++
++
++ if (screenEnabled) {
++ KdDisableScreen(pScreen);
++ }
++ KdOffscreenSwapOut(screen->pScreen);
++
++ if (randr & (RR_Rotate_0|RR_Rotate_180)) {
++ pScreen->width = w100c->fbdev.var.xres;
++ pScreen->height = w100c->fbdev.var.yres;
++ pScreen->mmWidth = screen->width_mm;
++ pScreen->mmHeight = screen->height_mm;
++ } else {
++ pScreen->width = w100c->fbdev.var.yres;
++ pScreen->height = w100c->fbdev.var.xres;
++ pScreen->mmWidth = screen->height_mm;
++ pScreen->mmHeight = screen->width_mm;
++ }
++
++ KdComputeMouseMatrix(&m, randr, screen->width, screen->height);
++ KdSetMouseMatrix(&m);
++
++ screen->width = pScreen->width;
++ screen->height = pScreen->height;
++ screen->fb[0].byteStride = screen->width * screen->fb[0].bitsPerPixel / 8;
++
++ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap(pScreen),
++ pScreen->width,
++ pScreen->height,
++ screen->fb[0].depth,
++ screen->fb[0].bitsPerPixel,
++ screen->fb[0].byteStride,
++ screen->fb[0].frameBuffer);
++
++
++ w100c->hwScreen.randr &= ~RR_Rotate_All;
++ switch (randr & RR_Rotate_All) {
++ case RR_Rotate_0:
++ switch (w100c->defaultRandR) {
++ case RR_Rotate_0:
++ w100c->hwScreen.randr |= RR_Rotate_0;
++ break;
++ case RR_Rotate_90:
++ w100c->hwScreen.randr |= RR_Rotate_90;
++ break;
++ case RR_Rotate_180:
++ w100c->hwScreen.randr |= RR_Rotate_180;
++ break;
++ case RR_Rotate_270:
++ w100c->hwScreen.randr |= RR_Rotate_270;
++ break;
++ }
++ break;
++ case RR_Rotate_90:
++ switch (w100c->defaultRandR) {
++ case RR_Rotate_0:
++ w100c->hwScreen.randr |= RR_Rotate_90;
++ break;
++ case RR_Rotate_90:
++ w100c->hwScreen.randr |= RR_Rotate_0;
++ break;
++ case RR_Rotate_180:
++ w100c->hwScreen.randr |= RR_Rotate_270;
++ break;
++ case RR_Rotate_270:
++ w100c->hwScreen.randr |= RR_Rotate_180;
++ break;
++ }
++ break;
++ case RR_Rotate_180:
++ switch (w100c->defaultRandR) {
++ case RR_Rotate_0:
++ w100c->hwScreen.randr |= RR_Rotate_180;
++ break;
++ case RR_Rotate_90:
++ w100c->hwScreen.randr |= RR_Rotate_270;
++ break;
++ case RR_Rotate_180:
++ w100c->hwScreen.randr |= RR_Rotate_0;
++ break;
++ case RR_Rotate_270:
++ w100c->hwScreen.randr |= RR_Rotate_90;
++ break;
++ }
++ break;
++ case RR_Rotate_270:
++ switch (w100c->defaultRandR) {
++ case RR_Rotate_0:
++ w100c->hwScreen.randr |= RR_Rotate_270;
++ break;
++ case RR_Rotate_90:
++ w100c->hwScreen.randr |= RR_Rotate_180;
++ break;
++ case RR_Rotate_180:
++ w100c->hwScreen.randr |= RR_Rotate_90;
++ break;
++ case RR_Rotate_270:
++ w100c->hwScreen.randr |= RR_Rotate_0;
++ break;
++ }
++ break;
++ }
++
++ if (screenEnabled) {
++ KdEnableScreen(pScreen);
++ }
++
++ return TRUE;
++}
++
++static Bool W100RandRInit(ScreenPtr pScreen)
++{
++ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
++
++ pScrPriv->rrSetConfig = W100RandRSetConfig;
++ return TRUE;
++}
++
++#endif
++
++static Bool
++W100FinishInitScreen(ScreenPtr pScreen)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++
++ if (!fbdevFinishInitScreen(pScreen))
++ return FALSE;
++
++#ifdef RANDR
++ if (!W100RandRInit(pScreen))
++ return FALSE;
++#endif
++ return TRUE;
++}
++
++static Bool
++W100CreateResources(ScreenPtr pScreen)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++
++ return fbdevCreateResources(pScreen);
++}
++
++static void
++W100Preserve(KdCardInfo * card)
++{
++ W100CardInfo *w100c = card->driver;
++
++ fbdevPreserve(card);
++}
++
++static void
++W100Restore(KdCardInfo * card)
++{
++ W100CardInfo *w100c = card->driver;
++ fbdevRestore(card);
++}
++
++static Bool
++W100DPMS(ScreenPtr pScreen, int mode)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++
++ return fbdevDPMS(pScreen, mode);
++}
++
++static Bool
++W100Enable(ScreenPtr pScreen)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++
++ DBG_IMAGEON(("W100Enable\n"));
++
++ if (!fbdevEnable(pScreen))
++ return FALSE;
++
++ if (w100c->mem_base == NULL) {
++ if (!W100Map(pScreenPriv->screen->card, w100c)) {
++ return FALSE;
++ }
++ W100MemSetup(pScreenPriv->screen);
++ }
++ return TRUE;
++}
++
++static void
++W100Disable(ScreenPtr pScreen)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++ DBG_IMAGEON(("W100Disable\n"));
++ W100Unmap(pScreenPriv->card, w100c);
++
++ fbdevDisable(pScreen);
++}
++
++static void
++W100GetColors(ScreenPtr pScreen, int fb, int n, xColorItem * pdefs)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++
++ fbdevGetColors(pScreen, fb, n, pdefs);
++}
++
++static void
++W100PutColors(ScreenPtr pScreen, int fb, int n, xColorItem * pdefs)
++{
++ KdScreenPriv(pScreen);
++ W100CardInfo(pScreenPriv);
++
++ fbdevPutColors(pScreen, fb, n, pdefs);
++}
++
++KdCardFuncs W100Funcs = {
++ W100CardInit, /* cardinit */
++ W100ScreenInit, /* scrinit */
++ W100InitScreen, /* initScreen */
++ W100FinishInitScreen, /* finishInitScreen */
++ W100CreateResources, /* createRes */
++ W100Preserve, /* preserve */
++ W100Enable, /* enable */
++ W100DPMS, /* dpms */
++ W100Disable, /* disable */
++ W100Restore, /* restore */
++ W100ScreenFini, /* scrfini */
++ W100CardFini, /* cardfini */
++
++ W100CursorInit, /* initCursor */
++ W100CursorEnable, /* enableCursor */
++ W100CursorDisable, /* disableCursor */
++ W100CursorFini, /* finiCursor */
++ W100RecolorCursor, /* recolorCursor */
++
++ W100InitAccel, /* initAccel */
++ W100EnableAccel, /* enableAccel */
++ W100DisableAccel, /* disableAccel */
++ W100FiniAccel, /* finiAccel */
++
++ W100GetColors, /* getColors */
++ W100PutColors, /* putColors */
++};
+--- /dev/null
++++ xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/imageon/imageon_const.h
+@@ -0,0 +1,161 @@
++/*
++ * Copyright © 2007 Manuel Teira
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation, and that the name of Manuel Teira not be used in
++ * advertising or publicity pertaining to distribution of the software without
++ * specific, written prior permission. Manuel Teira makes no
++ * representations about the suitability of this software for any purpose. It
++ * is provided "as is" without express or implied warranty.
++ *
++ * MANUEL TEIRA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
++ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
++ * EVENT SHALL MANUEL TEIRA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
++ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
++ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
++ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++ * PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#ifndef __IMAGEON_CONST_H__
++#define __IMAGEON_CONST_H__
++
++// DP_GUI_MASTER_CNTL.GMC_Brush_DataType
++// DP_DATATYPE.Brush_DataType
++#define DP_BRUSH_8x8MONOOPA 0 //8x8 mono pattern (expanded to frgd, bkgd)
++#define DP_BRUSH_8x8MONOTRA 1 //8x8 mono pattern (expanded to frgd, leave_alone)
++#define DP_PEN_32x1MONOOPA 6 //32x1 mono pattern (expanded to frgd, bkgd)
++#define DP_PEN_32x1MONOTRA 7 //32x1 mono pattern (expanded to frgd, leave_alone)
++#define DP_BRUSH_8x8COLOR 10 //8x8 color pattern
++#define DP_BRUSH_SOLIDCOLOR 13 //solid color pattern (frgd)
++#define DP_BRUSH_NONE 15 //no brush used
++
++#define SIZE_BRUSH_8x8MONO 2
++#define SIZE_PEN_32x1MONO 1
++#define SIZE_BRUSH_8x8COLOR_8 16
++#define SIZE_BRUSH_8x8COLOR_16 32
++#define MAX_BRUSH_SIZE SIZE_BRUSH_8x8COLOR_16
++
++// DP_GUI_MASTER_CNTL.GMC_Dst_DataType
++// DP_DATATYPE.Dp_Dst_DataType
++#define DP_DST_8BPP 2 // 8 bpp grey scale
++#define DP_DST_16BPP_1555 3 //16 bpp aRGB 1555
++#define DP_DST_16BPP_444 5 //16 bpp aRGB 4444
++
++// DP_GUI_MASTER_CNTL.GMC_Src_DataType
++// DP_DATATYPE.Dp_Src_DataType
++#define DP_SRC_1BPP_OPA 0 //mono (expanded to frgd, bkgd)
++#define DP_SRC_1BPP_TRA 1 //mono (expanded to frgd, leave_alone)
++#define DP_SRC_COLOR_SAME_AS_DST 3 //color (same as DST)
++#define DP_SRC_SOLID_COLOR_BLT 4 //solid color for Blt (use frgd)
++#define DP_SRC_4BPP 5 //4 bpp
++#define DP_SRC_12BPP_PACKED 6 //12 bpp packed
++
++// DP_GUI_MASTER_CNTL.GMC_Byte_Pix_Order
++// DP_DATATYPE.Dp_Byte_Pix_Order
++#define DP_PIX_ORDER_MSB2LSB 0 //monochrome pixel order from MSBit to LSBit
++#define DP_PIX_ORDER_LSB2MSB 1 //monochrome pixel order from LSBit to MSBit
++
++// DP_GUI_MASTER_CNTL.GMC_Dp_Src_Source
++#define DP_SRC_MEM_LINEAR 1 //loaded from memory (linear trajectory)
++#define DP_SRC_MEM_RECTANGULAR 2 //loaded from memory (rectangular trajectory)
++#define DP_SRC_HOSTDATA_BIT 3 //loaded from hostdata (linear trajectory)
++#define DP_SRC_HOSTDATA_BYTE 4 //loaded from hostdata (linear trajectory & byte-aligned)
++
++// DP_GUI_MASTER_CNTL.GMC_Dp_Op
++#define DP_OP_ROP 0
++#define DP_OP_ARITHMETIC 1
++
++// E2_ARITHMETIC_CNTL.opcode
++#define E2_OPC_GLBALP_ADD_SRC2 0
++#define E2_OPC_GLBALP_SUB_SRC2 1
++#define E2_OPC_SRC1_ADD_SRC2 2
++#define E2_OPC_SRC1_SUB_SRC2 3
++#define E2_OPC_DST_SADDBLEND_SRC2 4
++#define E2_OPC_DST_CADDBLEND_SRC2 5
++#define E2_OPC_DST_CSUBBLEND_SRC2 6
++#define E2_OPC_LF_SRC2 7
++#define E2_OPC_SCALE_SRC2 8
++#define E2_OPC_STRETCH_SRC2 9
++#define E2_OPC_SRC1_4BPPCPYWEXP 10
++#define E2_OPC_MC1 11
++#define E2_OPC_MC2 12
++#define E2_OPC_MC1_IDCT 13
++#define E2_OPC_MC2_IDCT 14
++#define E2_OPC_IDCT_ONLY_IFRAME 15
++
++// E2_ARITHMETIC_CNTL.clamp
++#define E2_CLAMP_OFF 0
++#define E2_CLAMP_ON 1
++
++// E2_ARITHMETIC_CNTL.rounding
++#define E2_ROUNDING_TRUNCATE 0
++#define E2_ROUNDING_TO_INFINITY 1
++
++// E2_ARITHMETIC_CNTL.srcblend
++#define E2_SRCBLEND_GLOBALALPHA 0
++#define E2_SRCBLEND_ZERO 1
++#define E2_SRCBLEND_SRC2ALPHA 2
++#define E2_SRCBLEND_DSTALPHA 3
++#define E2_SRCBLEND_ALPHA1PLANE 4
++
++// E2_ARITHMETIC_CNTL.destblend
++#define E2_DSTBLEND_GLOBALALPHA 0
++#define E2_DSTBLEND_ZERO 1
++#define E2_DSTBLEND_SRC2ALPHA 2
++#define E2_DSTBLEND_DSTALPHA 3
++#define E2_DSTBLEND_ALPHA1PLANE 4
++
++// LCD_FORMAT.lcd_type
++#define LCDTYPE_TFT333 0
++#define LCDTYPE_TFT444 1
++#define LCDTYPE_TFT555 2
++#define LCDTYPE_TFT666 3
++#define LCDTYPE_COLSTNPACK4 4
++#define LCDTYPE_COLSTNPACK8F1 5
++#define LCDTYPE_COLSTNPACK8F2 6
++#define LCDTYPE_COLSTNPACK16 7
++#define LCDTYPE_MONSTNPACK4 8
++#define LCDTYPE_MONSTNPACK8 9
++
++// CP_RB_CNTL.rb_bufsz
++#define RB_SIZE_2K 8
++#define RB_SIZE_4K 9
++#define RB_SIZE_8K 10
++#define RB_SIZE_16K 11
++#define RB_SIZE_32K 12
++#define RB_SIZE_64K 13
++
++// GRAPHIC_CTRL.color_depth
++#define COLOR_DEPTH_1BPP 0
++#define COLOR_DEPTH_2BPP 1
++#define COLOR_DEPTH_4BPP 2
++#define COLOR_DEPTH_8BPP 3
++#define COLOR_DEPTH_332 4
++#define COLOR_DEPTH_A444 5
++#define COLOR_DEPTH_A555 6
++
++// VIDEO_CTRL.video_mode
++#define VIDEO_MODE_422 0
++#define VIDEO_MODE_420 1
++
++// CLR_CMP_CNTL.cmp_fcn_src
++#define CMP_FCN_SRC_NEQ 4
++#define CMP_FCN_SRC_EQ 5
++
++// CLR_CMP_CNTL.cmp_src
++#define CMP_SRC_SRC 1
++
++// Overlay formats
++#define OVLFORMAT_YUV422 (6)
++#define OVLFORMAT_YUV420 (7)
++#define OVLFORMAT_RGB565 (5)
++#define OVLFORMAT_EQU_DISPLAY (8)
++
++#define W100_CLK_SRC_XTAL 0
++#define W100_CLK_SRC_PLL 1
++
++#endif
+--- /dev/null
++++ xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/imageon/imageon_cursor.c
+@@ -0,0 +1,571 @@
++/*
++ * Copyright © 2007 Manuel Teira
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation, and that the name of Manuel Teira not be used in
++ * advertising or publicity pertaining to distribution of the software without
++ * specific, written prior permission. Manuel Teira makes no
++ * representations about the suitability of this software for any purpose. It
++ * is provided "as is" without express or implied warranty.
++ *
++ * MANUEL TEIRA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
++ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
++ * EVENT SHALL MANUEL TEIRA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
++ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
++ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
++ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++ * PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <kdrive-config.h>
++#endif
++
++#include "cursorstr.h"
++#include "imageon.h"
++#include "imageon_regs.h"
++
++#define W100_CURSOR_HEIGHT (16)
++#define W100_CURSOR_PITCH (4)
++#define W100_CURSOR_WIDTH (16)
++#define W100_CURSOR_SIZE W100_CURSOR_PITCH * W100_CURSOR_WIDTH
++
++static CARD16 expand2bpp[256];
++
++static CARD16 spread_byte(CARD8 b)
++{
++ CARD16 s = b;
++
++ s = ((s & 0x00f0) << 4) | (s & 0x000f);
++ s = ((s & 0x0c0c) << 2) | (s & 0x0303);
++ s = ((s & 0x2222) << 1) | (s & 0x1111);
++ return s;
++}
++
++static void W100InitExpansionTable()
++{
++ int i;
++ for (i = 0; i < 256; i++) {
++ expand2bpp[i] = spread_byte(i);
++ }
++}
++
++#define BigEndian(v) \
++ (((v & 0x000000ff) << 24) | \
++ ((v & 0x0000ff00) << 8) | \
++ ((v & 0x00ff0000) >> 8) | \
++ ((v & 0xff000000) >> 24))
++
++#define PixelOffset(x, y) \
++ (((y) * W100_CURSOR_PITCH + ((x) / 4)) >> 2)
++
++#define PixelShift(x, y) \
++ (2 * ((x) % W100_CURSOR_WIDTH))
++
++#define PixelMask(x, y) \
++ ((0xc0000000) >> PixelShift(x, y))
++
++#define PixelVal(src, x, y) \
++ ((*(src + PixelOffset(x, y)) & PixelMask(x, y)) >> (30 - PixelShift(x, y)))
++
++#define SetPixelVal(ptr, x, y, val) \
++ *(((CARD32 *)(ptr)) + PixelOffset(x, y)) = \
++ *(((CARD32 *)(ptr)) + PixelOffset(x, y)) & ~PixelMask(x, y) | \
++ ((val) & 0x03) << (30 - PixelShift(x2, y2))
++
++#define DUMP_CURSOR(src) do { \
++ int x; \
++ int y; \
++ for (y = 0; y < W100_CURSOR_HEIGHT; y++) { \
++ DBG_IMAGEON(("Line %02d: ", y)); \
++ for (x = 0; x < W100_CURSOR_WIDTH; x++) { \
++ DBG_IMAGEON(("%d", PixelVal(src,x,y))); \
++ } \
++ DBG_IMAGEON(("\n")); \
++ } \
++ DBG_IMAGEON((".\n")); \
++} while (0)
++
++static void
++W100RotateCursor(int randr, CARD32 *src, CARD32 *dst)
++{
++ int x1, y1, x2, y2;
++
++ switch (randr & RR_Rotate_All) {
++ case RR_Rotate_0:
++ x1 = 0;
++ y1 = 0;
++ for (y2 = 0; y2 < W100_CURSOR_HEIGHT; y2++) {
++ for (x2 = W100_CURSOR_WIDTH - 1; x2 >= 0; --x2) {
++ SetPixelVal(dst, x2, y2, PixelVal(src, x1, y1));
++ ++x1;
++ if (x1 >= W100_CURSOR_WIDTH) {
++ x1 = 0;
++ ++y1;
++ }
++ }
++ }
++ break;
++ case RR_Rotate_90:
++ x1 = 0;
++ y1 = 0;
++ for (x2 = W100_CURSOR_WIDTH - 1; x2 >= 0; --x2) {
++ for (y2 = W100_CURSOR_HEIGHT - 1; y2 >=0; --y2) {
++ SetPixelVal(dst, x2, y2, PixelVal(src, x1, y1));
++ ++x1;
++ if (x1 >= W100_CURSOR_WIDTH) {
++ x1 = 0;
++ ++y1;
++ }
++ }
++ }
++ break;
++ case RR_Rotate_180:
++ x1 = 0;
++ y1 = 0;
++ for (y2 = W100_CURSOR_HEIGHT - 1; y2 >= 0; --y2) {
++ for (x2 = W100_CURSOR_WIDTH - 1; x2 >= 0; --x2) {
++ SetPixelVal(dst, x2, y2, PixelVal(src, x1, y1));
++ ++x1;
++ if (x1 >= W100_CURSOR_WIDTH) {
++ x1 = 0;
++ ++y1;
++ }
++ }
++ }
++ break;
++ case RR_Rotate_270:
++ x1 = 0;
++ y1 = 0;
++ for (x2 = 0; x2 < W100_CURSOR_WIDTH; x2++) {
++ for (y2 = W100_CURSOR_HEIGHT - 1; y2 >= 0; --y2) {
++ SetPixelVal(dst, x2, y2, PixelVal(src, x1, y1));
++ ++x1;
++ if (x1 >= W100_CURSOR_WIDTH) {
++ x1 = 0;
++ ++y1;
++ }
++ }
++ }
++ break;
++ }
++}
++
++static void
++W100SetCursorColors(ScreenPtr