# Author: Manuel Teira (sirfred in #oe) # Description: New driver for the Imageon ATI Card. Implementing: # -Hardware solid fills # -Hardware bitblt # -Hardware cursors # -XV Extension # -Internal and External Imageon offscreen memory support # -Hardware RandR rotation (without using a shadow framebuffer) # -Support for RandR mode changing # # Patch managed by http://www.holgerschurig.de/patcher.html # --- xorg-server-X11R7.1-1.1.0.work/configure.ac~kdrive-imageon +++ xorg-server-X11R7.1-1.1.0.work/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.work/hw/kdrive/Makefile.am~kdrive-imageon +++ xorg-server-X11R7.1-1.1.0.work/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.work/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.work/hw/kdrive/imageon/imageon.c @@ -0,0 +1,606 @@ +/* + * 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 +#endif +#include "imageon.h" +#include "imageon_regs.h" +#include "imageon_support.h" + +W100CardEntry w100_cards[] = { + {0x1002, 0x5644, 0, "ATI Imageon 3200"}, + {0x1002, 0x5741, W100XVSupport, "ATI Imageon 100"}, + {0x1002, 0x5744, 0, "ATI Imageon 3220"}, + {0, 0, 0, NULL} +}; + +W100ModeSpec w100_modes[] = { + {800, 600, 16, W100_EXTMEM, FALSE}, + {640, 480, 16, W100_EXTMEM, FALSE}, + {320, 240, 16, W100_INTMEM, FALSE}, + { 0, 0, 0, 0, FALSE} +}; + +W100StartupInfo w100StartupInfo; + +extern void (*tslib_transform_coords)(long *x, long *y, void *closure); +extern void *tslib_transform_closure; + +static void +W100Startup(W100CardInfo *w100c) +{ + int i; + DBG_IMAGEON(("--W100Startup\n")); + W100ModeSpec *modes; + /* Take the current graphics mode */ + if (!W100GetFbMode(w100c, &w100StartupInfo.mode)) { + ErrorF("(E) Unable to get current mode\n"); + } + w100StartupInfo.randr = W100GetRotation(w100c); + w100StartupInfo.portrait = w100StartupInfo.mode.width < w100StartupInfo.mode.height; + + /* Test the valid modes */ + for (modes = w100_modes; modes->width; modes++) { + modes->supported = W100CheckFbMode(w100c, modes); + } + + DBG_IMAGEON(("Startup Mode: %dx%d@%d, rot: %d, portrait: %s\n", + w100StartupInfo.mode.width, + w100StartupInfo.mode.height, + w100StartupInfo.mode.bpp, + w100StartupInfo.randr, + w100StartupInfo.portrait ? "Yes" : "No")); + + /* Tell the kernel to never switch off external memory */ + W100SysFsSet(w100c, W100_SYSFS_BASE "extmem", "1"); + + /* Disable framebuffer accel */ + W100SysFsSet(w100c, W100_SYSFS_BASE "accel", "0"); + + /* Enable fastsysclk */ + W100SysFsSet(w100c, W100_SYSFS_BASE "fastpllclk", "1"); + +} + + +static Bool +W100Map(KdCardInfo * card, W100CardInfo *w100c) +{ + DBG_IMAGEON(("--W100Map\n")); + 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) +{ + DBG_IMAGEON(("--W100Unmap\n")); + 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 void W100MemSetup(W100CardInfo *w100c) +{ + int reg_value; + int int_start, int_size; + int ext_start, ext_size; + int i; + DBG_IMAGEON(("--W100MemSetup\n")); + + for (i = 0; i < w100c->num_memareas; i++) { + xfree(w100c->memareas[i]); + } + xfree(w100c->memareas); + + reg_value = MMIO_IN32(mmMC_FB_LOCATION); + int_start = (reg_value & 0xffff) << 8; + int_size = (((reg_value >> 16) & 0xffff) - (reg_value & 0xffff)) << 8; + DBG_IMAGEON(("(I) MC_FB_LOCATION: 0x%08x. Start: 0x%08x, size: %d\n", + reg_value, int_start, int_size)); + + reg_value = MMIO_IN32(mmMC_EXT_MEM_LOCATION); + ext_start = (reg_value & 0xffff) << 8; + ext_size = (((reg_value >> 16) & 0xffff) - (reg_value & 0xffff)) << 8; + DBG_IMAGEON(("(I) MC_EXT_MEM_LOCATION: 0x%08x. Start: 0x%08x, size: %d\n", + reg_value, ext_start, ext_size)); + + w100c->num_memareas = (ext_size > 0) ? 2 : 1; + w100c->memareas = xcalloc(sizeof(W100MemArea *), w100c->num_memareas); + + w100c->memareas[W100_INTMEM] = xcalloc(sizeof(W100MemArea), 1); + w100c->memareas[W100_INTMEM]->priority = KD_VIDMEM_MAXPRIO; + w100c->memareas[W100_INTMEM]->start = (CARD8 *) int_start; + w100c->memareas[W100_INTMEM]->size = int_size; + + if (w100c->num_memareas == 2) { + w100c->memareas[W100_EXTMEM] = xcalloc(sizeof(W100MemArea), 1); + w100c->memareas[W100_EXTMEM]->priority = KD_VIDMEM_MINPRIO; + w100c->memareas[W100_EXTMEM]->start = (CARD8 *) ext_start; + w100c->memareas[W100_EXTMEM]->size = ext_size; + } + + for (i = 0; i < w100c->num_memareas; i++) { + DBG_IMAGEON(("(I) Memory mapped at 0x%08x(0x%08x), size %d bytes\n", + W100_CARD2HOST(w100c->memareas[i]->start), + w100c->memareas[i]->start, + w100c->memareas[i]->size)); + } + +} + +static Bool +W100CardInit(KdCardInfo * card) +{ + W100CardInfo *w100c; + + W100CardEntry *model = &w100_cards[0]; + static Bool initialized = FALSE; + + DBG_IMAGEON(("--W100CardInit\n")); + + w100c = xcalloc(sizeof(W100CardInfo), 1); + if (w100c == NULL) + return FALSE; + + if (!fbdevInitialize(card, &w100c->fbdev)) { + return FALSE; + } + + if (!W100Map(card, w100c)) { + xfree(w100c); + return FALSE; + } + card->driver = w100c; + + while (model->name) { + if (model->device == card->attr.deviceID) { + w100c->card_id = model; + break; + } + model++; + } + + ErrorF("(I) Using ATI card: %s\n", w100c->card_id->name); + + if (!initialized) { + initialized = TRUE; + W100Startup(w100c); + } + + w100c->hw_window.mode = W100GetModeSpec(w100c, &w100StartupInfo.mode); + w100c->hw_window.randr = w100StartupInfo.randr; + + tslib_transform_closure = w100c; + tslib_transform_coords = W100TransformTsLibCoordinates; + return TRUE; +} + + +static void +W100CardFini(KdCardInfo * card) +{ + W100CardInfo *w100c = (W100CardInfo *) card->driver; + + DBG_IMAGEON(("--W100CardFini\n")); + W100Unmap(card, w100c); + fbdevCardFini(card); +} + +static void +W100Setup(KdScreenInfo *screen) +{ + W100CardInfo(screen); + W100MemArea *mem; + KdMouseMatrix m; + int fb_size, i; + + DBG_IMAGEON(("--W100Setup\n")); + + /* Adjust mode */ + w100c->hw_window.width = screen->width; + w100c->hw_window.height = screen->height; + w100c->hw_window.bpp = screen->fb[0].bitsPerPixel; + W100SetupGraphicWindow(w100c); + + /* 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); + w100c->regs.DISP_DEBUG2 = MMIO_IN32(mmDISP_DEBUG2); + + W100MemSetup(w100c); + + /* 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 *), + w100c->num_memareas); + screen->num_videomem_areas = w100c->num_memareas; + + screen->fb[0].byteStride = screen->width * screen->fb[0].bitsPerPixel / 8; + fb_size = screen->fb[0].byteStride * screen->height; + + DBG_IMAGEON(("(I) Framebuffer required size: %d bytes\n", fb_size)); + + for (i = 0; i < w100c->num_memareas; i++) { + mem = w100c->memareas[i]; + screen->videomem_areas[i] = xcalloc(sizeof(KdVideoMemArea), 1); + screen->videomem_areas[i]->priority = mem->priority; + screen->videomem_areas[i]->base = W100_CARD2HOST(mem->start); + screen->videomem_areas[i]->size = mem->size; + if (w100c->hw_window.mode->fbpool == i) { + DBG_IMAGEON(("(I) FrameBuffer in w100 memzone 0x%08x(0x%08x)\n", + W100_CARD2HOST(mem->start), mem->start)); + screen->videomem_areas[i]->available_offset = fb_size; + screen->fb[0].frameBuffer = W100_CARD2HOST(mem->start); + } else { + 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->hw_window.offset = W100_HOST2CARD(screen->fb[0].frameBuffer); + + KdComputeMouseMatrix(&m, screen->randr, + w100StartupInfo.portrait ? + W100_MIN(screen->width, screen->height) : + W100_MAX(screen->width, screen->height), + w100StartupInfo.portrait ? + W100_MAX(screen->width, screen->height) : + W100_MIN(screen->width, screen->height)); + + KdSetMouseMatrix(&m); + + DBG_IMAGEON(("Window(width:%d,height:%d,bpp:%d,offset:0x%08x" + "(0x%08x), randr:%d)\n", + w100c->hw_window.width, + w100c->hw_window.height, + w100c->hw_window.bpp, + w100c->hw_window.offset, + screen->fb[0].frameBuffer, + w100c->hw_window.randr)); + +} + +static Bool +W100ScreenInit(KdScreenInfo * screen) +{ + W100ScreenInfo *w100s; + W100CardInfo(screen); + Bool success = FALSE; + + DBG_IMAGEON(("--W100ScreenInit\n")); + w100s = xcalloc(sizeof(W100ScreenInfo), 1); + if (w100s == NULL) + return FALSE; + + w100s->w100c = w100c; + w100s->screen = screen; + screen->driver = w100s; + + success = fbdevScreenInitialize(screen, &w100s->fbdev); + + if (!success) { + screen->driver = NULL; + xfree(w100s); + return FALSE; + } + + W100Setup(screen); + + return TRUE; +} + +static void +W100ScreenFini(KdScreenInfo * screen) +{ + W100ScreenInfo *w100s = (W100ScreenInfo *) screen->driver; + DBG_IMAGEON(("--W100ScreenFini\n")); + fbdevScreenFini(screen); + xfree(w100s); + screen->driver = 0; +} + +static Bool +W100InitScreen(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + + DBG_IMAGEON(("--W100InitScreen\n")); + if (w100c->card_id->caps & W100XVSupport) { + 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; + + DBG_IMAGEON(("--W100RandRSetConfig(randr:%d,pSize:%dx%d)\n", + randr, pSize->width, pSize->height)); + + if (screenEnabled) { + KdDisableScreen(pScreen); + } + + if (randr & (RR_Rotate_0|RR_Rotate_180)) { + pScreen->mmWidth = screen->width_mm; + pScreen->mmHeight = screen->height_mm; + pScreen->width = pSize->width; + pScreen->height = pSize->height; + } else { + pScreen->mmWidth = screen->height_mm; + pScreen->mmHeight = screen->width_mm; + pScreen->width = pSize->height; + pScreen->height = pSize->width; + } + + screen->randr = randr; + screen->width = pScreen->width; + screen->height = pScreen->height; + w100c->hw_window.randr = KdSubRotation(w100StartupInfo.randr, randr); + w100c->hw_window.mode = W100GetBestMode(w100c, pScreen->width, pScreen->height); + + KdOffscreenSwapOut(screen->pScreen); + + W100Setup(screen); + + DBG_IMAGEON(("ModifyPixMapHeader(width:%d,height:%d,depth:%d,bpp:%d,bs:%d,fb:0x%08x)\n", pScreen->width, pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer)); + + + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap(pScreen), + pScreen->width, + pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer); + + + if (screenEnabled) { + KdEnableScreen(pScreen); + } + return TRUE; +} + +static Bool W100RandRGetInfo(ScreenPtr pScreen, Rotation *rotations) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + W100CardInfo(pScreenPriv); + RRScreenSizePtr pSize; + Rotation randr; + W100ModeSpec *modes; + int i; + + DBG_IMAGEON(("--W100RandRGetInfo\n")); + + *rotations = RR_Rotate_All; + + for (modes = w100_modes; modes->width; modes++) { + if (modes->supported) { + pSize = RRRegisterSize(pScreen, + modes->width, + modes->height, + screen->width_mm, + screen->height_mm); + if (modes == w100c->hw_window.mode) { + RRSetCurrentConfig(pScreen, screen->randr, 0, pSize); + } + } + } + + return TRUE; +} + +static Bool W100RandRInit(ScreenPtr pScreen) +{ + rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); + DBG_IMAGEON(("--W100RandRInit\n")); + pScrPriv->rrSetConfig = W100RandRSetConfig; + pScrPriv->rrGetInfo = W100RandRGetInfo; + return TRUE; +} + +#endif + +static Bool +W100FinishInitScreen(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + DBG_IMAGEON(("--W100FinishInitScreen\n")); + 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; + DBG_IMAGEON(("--W100Preserve\n")); + + fbdevPreserve(card); +} + +static void +W100Restore(KdCardInfo * card) +{ + W100CardInfo *w100c = card->driver; + DBG_IMAGEON(("--W100Restore\n")); + fbdevRestore(card); +} + +static Bool +W100DPMS(ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + DBG_IMAGEON(("--W100DPMS\n")); + 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; + } + W100Setup(pScreenPriv->screen); + } + W100SetupGraphicEngine(w100c); + + graphic_offset_u go; + go.val = MMIO_IN32(mmGRAPHIC_OFFSET); + DBG_IMAGEON(("Graphic offset is 0x%08x(0x%08x)\n", + go.f.graphic_offset, + W100_CARD2HOST(go.f.graphic_offset))); + + + 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.work/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.work/hw/kdrive/imageon/imageon_cursor.c @@ -0,0 +1,569 @@ +/* + * 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 +#endif + +#include "cursorstr.h" +#include "imageon.h" +#include "imageon_regs.h" + +#define W100_CURSOR_HEIGHT (16) +#define W100_CURSOR_WIDTH (16) +#define W100_CURSOR_PITCH (W100_CURSOR_WIDTH / 4) + +#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) % 16)) + +#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 = 0; x2 < W100_CURSOR_WIDTH; 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 = 0; y2 < W100_CURSOR_HEIGHT; y2++) { + SetPixelVal(dst, x2, y2, PixelVal(src, x1, y1)); + ++x1; + if (x1 >= W100_CURSOR_WIDTH) { + x1 = 0; + ++y1; + } + } + } + break; + } +} + +static void +W100SetCursorColors(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + cursor_color_u fgcolor; + cursor_color_u bgcolor; + + fgcolor.f.cur_color_r = pCursor->foreRed >> 8; + fgcolor.f.cur_color_g = pCursor->foreGreen >> 8; + fgcolor.f.cur_color_b = pCursor->foreBlue >> 8; + + bgcolor.f.cur_color_r = pCursor->backRed >> 8; + bgcolor.f.cur_color_g = pCursor->backGreen >> 8; + bgcolor.f.cur_color_b = pCursor->backBlue >> 8; + + DBG_IMAGEON(("W100SetCursorColors fg(%02x,%02x,%02x), bg(%02x,%02x,%02x)\n", + fgcolor.f.cur_color_r, + fgcolor.f.cur_color_g, + fgcolor.f.cur_color_b, + bgcolor.f.cur_color_r, + bgcolor.f.cur_color_g, + bgcolor.f.cur_color_b)); + + W100DisableDisplayUpdate(w100c); + MMIO_OUT32(mmCURSOR1_COLOR0, bgcolor.val); + MMIO_OUT32(mmCURSOR1_COLOR1, fgcolor.val); + W100EnableDisplayUpdate(w100c); + +} + +static void +W100LoadCursor(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + CARD32 *dst; + CARD8 tmpCursor0[W100_CURSOR_SIZE]; + CARD8 tmpCursor1[W100_CURSOR_SIZE]; + CARD32 expValue, expMask; + CARD32 *src; + CARD32 *mask; + int lwsrc; + int line, i; + int h, w; + + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = bits->xhot; + pCurPriv->yhot = bits->yhot; + + memset(tmpCursor0, 0xaa, W100_CURSOR_SIZE); + + h = bits->height; + w = bits->width; + if (h > W100_CURSOR_HEIGHT) { + h = W100_CURSOR_HEIGHT; + } + + if (w > W100_CURSOR_WIDTH) { + w = W100_CURSOR_WIDTH; + } + + src = (CARD32*) bits->source; + dst = (CARD32*) tmpCursor0; + mask = (CARD32*) bits->mask; + + lwsrc = BitmapBytePad(bits->width) >> 2; + + for (line = 0; line < h; line++) { + for (i = 0; i < lwsrc; i++) { + expValue = + (expand2bpp[src[i] & 0xff]) | + (expand2bpp[(src[i] >> 8) & 0xff] << 16); + expMask = + (expand2bpp[mask[i] & 0xff]) | + (expand2bpp[(mask[i] >> 8) & 0xff] << 16); + expMask |= (expMask << 1); /* Expand 01 -> 11, 00 -> 00 */ + dst[i] = (0xaaaaaaaa & ~expMask) | (expValue & expMask); + } + src += lwsrc; + mask += lwsrc; + dst += lwsrc; + } + + /* Rotate the pixmap to get the correct orientation */ + W100RotateCursor(w100c->hw_window.randr, + (CARD32*) tmpCursor0, + (CARD32*) tmpCursor1); + + DUMP_CURSOR((CARD32*)tmpCursor1); + /* Correct endianness */ + src = (CARD32*) tmpCursor1; + dst = (CARD32*) (pCurPriv->area->vidmem->base + pCurPriv->area->offset); + DBG_IMAGEON(("W100LoadCursor(xhot:%d,yhot:%d,width:%d,height:%d) dst(0x%08x)\n", + bits->xhot, bits->yhot, + bits->width, bits->height, + dst)); + + for (line = 0; line < h; line++) { + for (i = 0; i < lwsrc; i++) { + dst[i] = BigEndian(src[i]); + } + src += lwsrc; + dst += lwsrc; + } + + W100SetCursorColors(pScreen); +} + +static void +W100UnloadCursor(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + cursor_h_pos_u hpos; + W100Cursor *pCurPriv = &w100s->cursor; + + DBG_IMAGEON(("W100UnloadCursor pCurPriv:%p\n", pCurPriv)); + + hpos.val = pCurPriv->hpos; + hpos.f.cur_en = 0; + + W100DisableDisplayUpdate(w100c); + MMIO_OUT32(mmCURSOR1_H_POS, hpos.val); + W100EnableDisplayUpdate(w100c); + pCurPriv->hpos = hpos.val; +} + +static void +W100MoveCursor(ScreenPtr pScreen, int x, int y) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + int xoffs, yoffs; + cursor_offset_u cursor_offset; + cursor_h_pos_u hpos; + cursor_v_pos_u vpos; + graphic_h_disp_u graphic_hdisp; + graphic_v_disp_u graphic_vdisp; + BoxRec cursorBox, deviceBox; + + + if (!pCurPriv->has_cursor) { + return; + } + if (!pScreenPriv->enabled) { + return; + } + + graphic_hdisp.val = w100c->regs.GRAPHIC_H_DISP; + graphic_vdisp.val = w100c->regs.GRAPHIC_V_DISP; + xoffs = 0; + yoffs = 0; + cursorBox.x1 = x - pCurPriv->xhot; + cursorBox.y1 = y - pCurPriv->yhot; + cursorBox.x2 = cursorBox.x1 + pCurPriv->width - 1; + cursorBox.y2 = cursorBox.y1 + pCurPriv->height - 1; + W100MapToDevice(w100c, &cursorBox, &deviceBox); + + if (deviceBox.x1 < 0) { + xoffs = -deviceBox.x1; + deviceBox.x1 = 0; + } + + if (deviceBox.y1 < 0) { + yoffs = -deviceBox.y1; + deviceBox.y1 = 0; + } + + hpos.f.cur_h_start = graphic_hdisp.f.graphic_h_start + deviceBox.x1; + hpos.f.cur_h_end = graphic_hdisp.f.graphic_h_start + deviceBox.x2 + 1; + hpos.f.cur_en = 1; + vpos.f.cur_v_start = graphic_vdisp.f.graphic_v_start + deviceBox.y1; + vpos.f.cur_v_end = graphic_vdisp.f.graphic_v_start + deviceBox.y2 + 1; + + cursor_offset.f.cur_x_offset = xoffs; + cursor_offset.f.cur_y_offset = yoffs; + cursor_offset.f.cur_offset = (CARD32) + W100_HOST2CARD(pCurPriv->area->vidmem->base + + pCurPriv->area->offset); + DBG_IMAGEON(("W100MoveCursor dst(x:%d,y:%d)," + "hwpos(hpos.start:%d,hpos.end:%d,vpos.start:%d,vpos.end:%d)," + "mapped(x:%d,y:%d,xoffs:%d,yoffs:%d)\n", + x, y, + hpos.f.cur_h_start, hpos.f.cur_h_end, + vpos.f.cur_v_start, vpos.f.cur_v_end, + deviceBox.x1, deviceBox.y1, xoffs, yoffs)); + + W100DisableDisplayUpdate(w100c); + MMIO_OUT32(mmCURSOR1_OFFSET, cursor_offset.val); + MMIO_OUT32(mmCURSOR1_V_POS, vpos.val); + MMIO_OUT32(mmCURSOR1_H_POS, hpos.val); + W100EnableDisplayUpdate(w100c); + + pCurPriv->hpos = hpos.val; + pCurPriv->vpos = vpos.val; + pCurPriv->coffset = cursor_offset.val; + +} + +static Bool +W100RealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + DBG_IMAGEON(("W100RealizeCursor\n")); + + if (!pScreenPriv->enabled) { + return TRUE; + } + + if (pCursor && pCurPriv->pCursor == pCursor) { + int x, y; + miPointerPosition(&x, &y); + W100LoadCursor(pScreen); + W100MoveCursor(pScreen, x, y); + } + return TRUE; +} + + +static Bool +W100UnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + DBG_IMAGEON(("W100UnrealizeCursor\n")); + return TRUE; +} + + +static void +W100SetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) { + return; + } + + if (pCursor) { + W100LoadCursor(pScreen); + W100MoveCursor(pScreen, x, y); + } else { + W100UnloadCursor(pScreen); + } +} + + +miPointerSpriteFuncRec W100PointerSpriteFuncs = { + W100RealizeCursor, + W100UnrealizeCursor, + W100SetCursor, + W100MoveCursor, +}; + +static void +W100QueryBestSize(int class, unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + + switch (class) { + case CursorShape: + if (*pwidth > pCurPriv->width) { + *pwidth = pCurPriv->width; + } + if (*pheight > pCurPriv->height) { + *pheight = pCurPriv->height; + } + if (*pwidth > pScreen->width) { + *pwidth = pScreen->width; + } + if (*pheight > pScreen->height) { + *pheight = pScreen->height; + } + break; + default: + fbQueryBestSize(class, pwidth, pheight, pScreen); + break; + } +} + +static void +W100CursorSave(ScreenPtr pScreen, KdOffscreenArea *area) +{ + KdScreenPriv(pScreen); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + DBG_IMAGEON(("W100CursorSave\n")); + + pCurPriv->area = NULL; +} + +void +W100CursorEnable(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + + if (!pCurPriv->has_cursor) { + return; + } + + DBG_IMAGEON(("W100CursorEnable\n")); + + if (pCurPriv->area == NULL) { + pCurPriv->area = KdOffscreenAlloc(pScreen, + W100_CURSOR_SIZE, 0, TRUE, + W100CursorSave, w100s); + } + if (pCurPriv->area == NULL) { + FatalError("Couldn't allocate offscreen memory for cursor.\n"); + } else { + DBG_IMAGEON(("Cursor memory at 0x%08x(0x%08x)\n", + pCurPriv->area->vidmem->base + pCurPriv->area->offset, + W100_HOST2CARD(pCurPriv->area->vidmem->base + + pCurPriv->area->offset))); + } + if (pCurPriv->pCursor) { + int x, y; + miPointerPosition(&x, &y); + W100LoadCursor(pScreen); + W100MoveCursor(pScreen, x, y); + } else { + W100UnloadCursor(pScreen); + } +} + + +void +W100CursorDisable(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + DBG_IMAGEON(("W100CursorDisable\n")); + + if (!pScreenPriv->enabled || !pCurPriv->has_cursor) { + return; + } + + if (pCurPriv->pCursor) { + W100UnloadCursor(pScreen); + } + + pCurPriv->area = NULL; +} + +Bool +W100CursorInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + + DBG_IMAGEON(("W100CursorInit\n")); + + pCurPriv->width = W100_CURSOR_WIDTH; + pCurPriv->height = W100_CURSOR_HEIGHT; + pScreen->QueryBestSize = W100QueryBestSize; + miPointerInitialize(pScreen, + &W100PointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + W100InitExpansionTable(); + return TRUE; +} + + +void +W100RecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef) +{ + return; +} + + +void +W100CursorFini(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100ScreenInfo(pScreenPriv); + W100Cursor *pCurPriv = &w100s->cursor; + + pCurPriv->has_cursor = FALSE; + pCurPriv->pCursor = NULL; +} --- /dev/null +++ xorg-server-X11R7.1-1.1.0.work/hw/kdrive/imageon/imageon_draw.c @@ -0,0 +1,238 @@ +/* + * 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 +#endif + +#include "imageon.h" +#include "imageon_regs.h" +#include "imageon_const.h" +#include "imageon_support.h" +#include "kaa.h" + +static W100CardInfo *currentCard; + +void +W100WaitMarker(ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + W100CardInfo(pScreenPriv); + W100WaitIdle(w100c); +} + +Bool +W100PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) +{ + KdScreenPriv(pPix->drawable.pScreen); + W100ScreenInfo(pScreenPriv); + W100CardInfo(pScreenPriv); + W100PortPrivPtr pPortPriv = w100s->pAdaptor->pPortPrivates[0].ptr; + int fifoEntries = 4; + + DBG_IMAGEON(("W100PrepareSolid(alu:%d, pm:0x%08x, fg:%d)\n", + alu, pm, fg)); + + W100ResetContext(w100c); + W100SetPixelMask(w100c, pm); + + if (W100SetDestinationPixmap(pPix)) { + if (w100c->ctx.mask.enable) { + ++fifoEntries; + } + if (W100WaitCmdFifoEntries(w100c, fifoEntries)) { + MMIO_OUT32(mmDP_GUI_MASTER_CNTL, W100ComputeSolidGmc(w100c, alu)); + MMIO_OUT32(mmDST_PITCH, w100c->ctx.dst.pitch); + MMIO_OUT32(mmDST_OFFSET, w100c->ctx.dst.offset); + MMIO_OUT32(mmDP_BRUSH_FRGD_CLR, fg); + + if (w100c->ctx.mask.enable) { + MMIO_OUT32(mmDP_WRITE_MSK, pm); + } + currentCard = w100c; + return TRUE; + } + } + ErrorF("Error in W100PrepareSolid\n"); + return FALSE; +} + +void +W100Solid(int x1, int y1, int x2, int y2) +{ + W100CardInfo *w100c = currentCard; + DBG_IMAGEON(("W100Solid(x1:%d,y1:%d,x2:%d,y2:%d)\n", x1, y1, x2, y2)); + + if (W100WaitCmdFifoEntries(w100c, 2)) { + MMIO_OUT32(mmDST_Y_X, (y1 << 16) | x1); + MMIO_OUT32(mmDST_HEIGHT_WIDTH, ((y2 - y1) << 16) | (x2 - x1)); + } else { + ErrorF("Error in W100Solid\n"); + } +} + +void +W100DoneSolid(void) +{ +} + + +Bool +W100PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, + int dx, int dy, int alu, Pixel pm) +{ + KdScreenPriv(pDst->drawable.pScreen); + W100ScreenInfo(pScreenPriv); + W100CardInfo(pScreenPriv); + dp_datatype_u datatype; + + int fifoEntries = 6; + + W100ResetContext(w100c); + W100SetPixelMask(w100c, pm); + W100SetXForm(w100c, dx, dy); + + if (W100SetSourcePixmap(pSrc) && W100SetDestinationPixmap(pDst)) { + DBG_IMAGEON(("W100PrepareCopy(src(pitch:%d,offset:0x%08x)," + "dst(pitch:%d,offset:0x%08x))\n", + w100c->ctx.src.pitch, + w100c->ctx.src.offset, + w100c->ctx.dst.pitch, + w100c->ctx.dst.offset)); + if (w100c->ctx.mask.enable) { + ++fifoEntries; + } + + if (W100WaitCmdFifoEntries(w100c, fifoEntries)) { + MMIO_OUT32(mmSRC_PITCH, w100c->ctx.src.pitch); + MMIO_OUT32(mmSRC_OFFSET, w100c->ctx.src.offset); + MMIO_OUT32(mmDST_PITCH, w100c->ctx.dst.pitch); + MMIO_OUT32(mmDST_OFFSET, w100c->ctx.dst.offset); + MMIO_OUT32(mmDP_GUI_MASTER_CNTL, W100ComputeCopyGmc(w100c, alu)); + if (w100c->ctx.mask.enable) { + MMIO_OUT32(mmDP_WRITE_MSK, pm); + } + MMIO_OUT32(mmDP_CNTL, w100c->ctx.xform.dataPath); + currentCard = w100c; + return TRUE; + } + } + ErrorF("Error in W100PrepareCopy\n"); + return FALSE; +} + +void +W100Copy(int srcX, int srcY, int dstX, int dstY, int w, int h) +{ + W100CardInfo *w100c = currentCard; + DBG_IMAGEON(("W100Copy(src(x:%d,y:%d),dst(x:%d,y:%d),w:%d,h:%d)\n", + srcX, srcY, + dstX, dstY, + w, h)); + if (w100c->ctx.xform.dx < 0) { + dstX += w - 1; + srcX += w - 1; + } + + if (w100c->ctx.xform.dy < 0) { + dstY += h - 1; + srcY += h - 1; + } + + if (W100WaitCmdFifoEntries(w100c, 3)) { + MMIO_OUT32(mmSRC_Y_X, (srcY << 16) | srcX); + MMIO_OUT32(mmDST_Y_X, (dstY << 16) | dstX); + MMIO_OUT32(mmDST_HEIGHT_WIDTH, (h << 16) | w); + } else { + ErrorF("Error in W100Copy\n"); + } +} + +void +W100DoneCopy(void) +{ +} + +Bool +W100InitAccel(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100ScreenInfo(pScreenPriv); + + + DBG_IMAGEON(("--W100InitAccel: %d/%d depth/bpp\n", + pScreenPriv->screen->fb[0].depth, + pScreenPriv->screen->fb[0].bitsPerPixel)); + + memset(&w100s->kaa, 0, sizeof(KaaScreenInfoRec)); + w100s->kaa.waitMarker = W100WaitMarker; + w100s->kaa.PrepareSolid = W100PrepareSolid; + w100s->kaa.Solid = W100Solid; + w100s->kaa.DoneSolid = W100DoneSolid; + w100s->kaa.PrepareCopy = W100PrepareCopy; + w100s->kaa.Copy = W100Copy; + w100s->kaa.DoneCopy = W100DoneCopy; + + w100s->kaa.flags |= KAA_OFFSCREEN_PIXMAPS; + /* Offset alignment, not sure if this is enought */ + w100s->kaa.offsetAlign = 0; + w100s->kaa.pitchAlign = 16; + + if (!kaaDrawInit(pScreen, &w100s->kaa)) { + return FALSE; + } + DBG_IMAGEON(("KAA flags: 0x%08x\n", w100s->kaa.flags)); + return TRUE; +} + +void +W100EnableAccel(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + W100ScreenInfo(pScreenPriv); + W100CardInfo(pScreenPriv); + + DBG_IMAGEON(("--W100EnableAccel\n")); + + w100s->kaa.PrepareBlend = NULL; + w100s->kaa.Blend = NULL; + w100s->kaa.DoneBlend = NULL; + w100s->kaa.CheckComposite = NULL; + w100s->kaa.PrepareComposite = NULL; + w100s->kaa.Composite = NULL; + w100s->kaa.DoneComposite = NULL; + w100s->kaa.UploadToScreen = NULL; + w100s->kaa.UploadToScratch = NULL; + kaaMarkSync(pScreen); +} + +void +W100DisableAccel(ScreenPtr pScreen) +{ + DBG_IMAGEON(("--W100DisableAccel\n")); +} + +void +W100FiniAccel(ScreenPtr pScreen) +{ + DBG_IMAGEON(("--W100FiniAccel\n")); +} --- /dev/null +++ xorg-server-X11R7.1-1.1.0.work/hw/kdrive/imageon/imageon.h @@ -0,0 +1,284 @@ +/* + * 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_H_ +#define _IMAGEON_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include + +#define DEBUG_IMAGEON 0 +#if DEBUG_IMAGEON +#define DBG_IMAGEON(a) ErrorF a +#else +#define DBG_IMAGEON(a) +#endif + + +#define W100_MEM_BASE (0x08000000) +#define W100_REG_OFFSET (0x00010000) +#define W100_REG_BASE (W100_MEM_BASE + W100_REG_OFFSET) +#define W100_MEM_SIZE (0x01000000) +#define W100_REG_SIZE (0x00002000) +#define W100_CMDFIFO_SIZE (16) + +#define W100_CARD2HOST(x) (w100c->mem_base + (CARD32)(x)) +#define W100_HOST2CARD(x) ((x) - (CARD32)(w100c->mem_base)) +#define W100_MEMAREAS (2) +#define W100_INTMEM (0) +#define W100_EXTMEM (1) + +#define W100_SYSFS_BASE "/sys/bus/platform/devices/w100fb/" + +#define MMIO_OUT32(a, v) (*(VOL32 *)((w100c->reg_base) + (a)) = (v)) +#define MMIO_IN32(a) (*(VOL32 *)((w100c->reg_base) + (a))) + +#define W100_MAX(x, y) ((x) > (y) ? x : y) +#define W100_MIN(x, y) ((x) < (y) ? x : y) + +#define W100_ALIGN(q, a) ((q + a - 1) & ~(a - 1)) + +#define TIMEOUT_LOCALS struct timeval _target, _curtime; + +static inline Bool +tv_le(struct timeval *tv1, struct timeval *tv2) +{ + if (tv1->tv_sec < tv2->tv_sec || + (tv1->tv_sec == tv2->tv_sec && + tv1->tv_usec < tv2->tv_usec)) + return TRUE; + else + return FALSE; +} + +#define WHILE_NOT_TIMEOUT(_timeout) \ + gettimeofday(&_target, NULL); \ + _target.tv_usec += ((_timeout) * 1000000); \ + _target.tv_sec += _target.tv_usec / 1000000; \ + _target.tv_usec = _target.tv_usec % 1000000; \ + while (gettimeofday(&_curtime, NULL), tv_le(&_curtime, &_target)) + +#define TIMEDOUT() (!tv_le(&_curtime, &_target)) + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +typedef struct _W100CardEntry { + CARD16 vendor; + CARD16 device; + CARD8 caps; + char *name; +} W100CardEntry; + + +typedef enum _W100Caps { + W100XVSupport = 1 +} W100Caps; + +typedef struct _W100ModeSpec { + CARD16 width; + CARD16 height; + CARD8 bpp; + CARD8 fbpool; + Bool supported; +} W100ModeSpec; + +typedef struct _W100BoxRec { + CARD16 x; + CARD16 y; + CARD16 w; + CARD16 h; +} W100BoxRec, *W100BoxPtr; + +typedef struct _W100Mode { + CARD16 width; + CARD16 height; + CARD8 bpp; +} W100Mode; + +typedef struct _W100MemArea { + CARD8 *start; + CARD32 size; + CARD8 priority; +} W100MemArea; + +typedef struct _W100StartupInfo { + W100CardEntry *card_id; + W100Mode mode; + Bool portrait; + int randr; +} W100StartupInfo; + +typedef struct _W100CardInfo { + FbdevPriv fbdev; + W100CardEntry *card_id; + CARD8 *mem_base; + CARD8 *reg_base; + W100MemArea **memareas; + int num_memareas; + int cmdfifo_entries; + struct { + CARD32 ENG_CNTL; + CARD32 VIDEO_CTRL; + CARD32 GRAPHIC_H_DISP; + CARD32 GRAPHIC_V_DISP; + CARD32 DISP_DEBUG2; + } regs; + struct { + CARD8 *offset; + CARD16 width; + CARD16 height; + int randr; + W100ModeSpec *mode; + CARD8 bpp; + } hw_window; + CARD8 last_dst_videomem; + CARD8 last_src_videomem; + struct { + struct { + CARD8 datatype; + CARD32 pitch; + CARD32 offset; + CARD8 videomem; + } dst; + struct { + CARD8 datatype; + CARD32 pitch; + CARD32 offset; + CARD8 videomem; + } src; + struct { + int dx; + int dy; + int randr; + Bool mirror; + CARD32 dataPath; + } xform; + struct { + Pixel pm; + Bool enable; + } mask; + } ctx; +} W100CardInfo; + +#define W100GetCardInfo(kd) ((W100CardInfo *) ((kd)->card->driver)) +#define W100CardInfo(kd) W100CardInfo *w100c = W100GetCardInfo(kd) + +typedef struct _W100Cursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + KdOffscreenArea *area; + CARD32 vpos; + CARD32 hpos; + CARD32 coffset; +} W100Cursor; + +typedef struct _W100ScreenInfo { + FbdevScrPriv fbdev; + KaaScreenInfoRec kaa; + W100CardInfo *w100c; + KdScreenInfo *screen; + KdVideoAdaptorPtr pAdaptor; + W100Cursor cursor; +} W100ScreenInfo; + +#define W100GetScreenInfo(kd) ((W100ScreenInfo *) ((kd)->screen->driver)) +#define W100ScreenInfo(kd) W100ScreenInfo *w100s = W100GetScreenInfo(kd) + +typedef enum _W100VideoStatus { + W100_OVERLAY_ON = 1, + W100_OVERLAY_CONFIGURED = 2 +} W100VideoStatus; + + +typedef struct _W100PortPriv { + CARD32 videoStatus; + CARD32 videoCtrl; + RegionRec clip; + struct { + int width; /* Source width */ + int height; /* Source height */ + unsigned char *buffer; /* Source buffer */ + int id; /* Source FOURCC */ + int size; /* Size of source rect (bytes) */ + KdOffscreenArea *surface; /* Source surface (on card memory) */ + BoxRec box; /* Source rect boundaries */ + } src; + struct { + BoxRec box; /* Screen rectangle */ + } dst; + struct { + int size; /* Size of the overlay surface (bytes) */ + KdOffscreenArea *surface; /* Overlay surface (on card memory) */ + BoxRec box; /* Overlay box (util size) */ + BoxRec frame; /* Overlay box (plus corrections) */ + Bool changed; /* To avoid recalculations */ + int horExp; /* Horizontal expansion */ + int verExp; /* Vertical expansion */ + int maxSize; /* Maximum allowed surface size (bytes) */ + int colorKey; /* Colour to replace with overlay */ + int brightness; /* Brigthness */ + } ovl; + struct { + int size; /* Number of planes */ + int bpp; /* bpp of the planes */ + int offset[3]; /* Planes offsets */ + CARD32 yplane; /* Offset (card) of Y plane */ + CARD32 uplane; /* Offset (card) of U plane */ + CARD32 vplane; /* Offset (card) of V plane */ + } planes; + Bool changed; /* To track changes and avoid recalculations */ +} W100PortPrivRec, *W100PortPrivPtr; + +extern KdCardFuncs W100Funcs; + +/* imageon_draw.c */ +void W100WaitMarker(ScreenPtr pScreen, int marker); +Bool W100PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg); +void W100Solid(int x1, int y1, int x2, int y2); +Bool W100PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, + int dx, int dy, int alu, Pixel pm); +void W100Copy(int srcX, int srcY, int dstX, int dstY, int w, int h); +void W100DoneCopy(void); +Bool W100InitAccel(ScreenPtr pScreen); +void W100EnableAccel(ScreenPtr pScreen); +void W100DisableAccel(ScreenPtr pScreen); +void W100FiniAccel(ScreenPtr pScreen); +/* imageon_cursor.c */ +void W100CursorEnable(ScreenPtr pScreen); +void W100CursorDisable(ScreenPtr pScreen); +Bool W100CursorInit(ScreenPtr pScreen); +void W100RecolorCursor(ScreenPtr pScreen, int ndef, xColorItem * pdef); +void W100CursorFini(ScreenPtr pScreen); + + + + +#endif /* _IMAGEON_H_ */ --- /dev/null +++ xorg-server-X11R7.1-1.1.0.work/hw/kdrive/imageon/imageon_regs.h @@ -0,0 +1,4155 @@ +/* + * 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_REGS_H__ +#define __IMAGEON_REGS_H__ + +/* Block CIF Start: */ +#define mmCHIP_ID 0x0000 +#define mmREVISION_ID 0x0004 +#define mmWRAP_BUF_A 0x0008 +#define mmWRAP_BUF_B 0x000C +#define mmWRAP_TOP_DIR 0x0010 +#define mmWRAP_START_DIR 0x0014 +#define mmCIF_CNTL 0x0018 +#define mmCFGREG_BASE 0x001C +#define mmCIF_IO 0x0020 +#define mmCIF_READ_DBG 0x0024 +#define mmCIF_WRITE_DBG 0x0028 +#define cfgIND_ADDR_A_0 0x0000 +#define cfgIND_ADDR_A_1 0x0001 +#define cfgIND_ADDR_A_2 0x0002 +#define cfgIND_DATA_A 0x0003 +#define cfgREG_BASE 0x0004 +#define cfgINTF_CNTL 0x0005 +#define cfgSTATUS 0x0006 +#define cfgCPU_DEFAULTS 0x0007 +#define cfgIND_ADDR_B_0 0x0008 +#define cfgIND_ADDR_B_1 0x0009 +#define cfgIND_ADDR_B_2 0x000A +#define cfgIND_DATA_B 0x000B +#define cfgPM4_RPTR 0x000C +#define cfgSCRATCH 0x000D +#define cfgPM4_WRPTR_0 0x000E +#define cfgPM4_WRPTR_1 0x000F +/* Block CIF End: */ + +/* Block CP Start: */ +#define mmCP_RB_CNTL 0x0210 +#define mmCP_RB_BASE 0x0214 +#define mmCP_RB_RPTR_ADDR 0x0218 +#define mmCP_RB_RPTR 0x021C +#define mmCP_RB_RPTR_WR 0x02F8 +#define mmCP_RB_WPTR 0x0220 +#define mmCP_IB_BASE