diff options
Diffstat (limited to 'hw/kdrive/neomagic')
-rw-r--r-- | hw/kdrive/neomagic/ChangeLog | 23 | ||||
-rw-r--r-- | hw/kdrive/neomagic/Makefile.am | 47 | ||||
-rw-r--r-- | hw/kdrive/neomagic/README | 15 | ||||
-rw-r--r-- | hw/kdrive/neomagic/backend.c | 86 | ||||
-rw-r--r-- | hw/kdrive/neomagic/backend.h | 70 | ||||
-rw-r--r-- | hw/kdrive/neomagic/neo_draw.c | 209 | ||||
-rw-r--r-- | hw/kdrive/neomagic/neomagic.c | 337 | ||||
-rw-r--r-- | hw/kdrive/neomagic/neomagic.h | 216 | ||||
-rw-r--r-- | hw/kdrive/neomagic/neomagicstub.c | 75 |
9 files changed, 0 insertions, 1078 deletions
diff --git a/hw/kdrive/neomagic/ChangeLog b/hw/kdrive/neomagic/ChangeLog deleted file mode 100644 index 2889d90f3..000000000 --- a/hw/kdrive/neomagic/ChangeLog +++ /dev/null @@ -1,23 +0,0 @@ -2004-07-21 Phil Blundell <pb@nexus.co.uk> - - * Makefile.am (Xneomagic_LDADD): Include -lts if appropriate. - Patch from pattieja@bentham.ispvip.biz. - -2004-06-07 Franco Catrin L. <fcatrin@tuxpan.com> - * Small fix for depth calculation - -2004-04-11 Franco Catrin L. <fcatrin@tuxpan.com> - - * Basic bitblt implementation - * Fixed width and height calculation in solids - * Added ROP (not tested) - -2004-04-10 Franco Catrin L. <fcatrin@tuxpan.com> - - * MMIO enabled after switching to new VT - * First acceleration function implemented (DrawSolid) - -2004-04-06 Franco Catrin L. <fcatrin@tuxpan.com> - - * Returned to a working state. Brent will - continue working on a backend in a separate CVS branch diff --git a/hw/kdrive/neomagic/Makefile.am b/hw/kdrive/neomagic/Makefile.am deleted file mode 100644 index 58f80c230..000000000 --- a/hw/kdrive/neomagic/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -if KDRIVEFBDEV -FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev -FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a -endif - -if KDRIVEVESA -VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa -VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a -endif - -INCLUDES = \ - @KDRIVE_INCS@ \ - $(FBDEV_INCLUDES) \ - $(VESA_INCLUDES) \ - @XSERVER_CFLAGS@ - -bin_PROGRAMS = Xneomagic - -if TSLIB -TSLIB_FLAG = -lts -endif - -noinst_LIBRARIES = libneomagic.a - -libneomagic_a_SOURCES = \ - backend.h \ - backend.c \ - neomagic.c \ - neomagic.h \ - neo_draw.c - -Xneomagic_SOURCES = \ - neomagicstub.c - -NEOMAGIC_LIBS = \ - libneomagic.a \ - ${FBDEV_LIBS} \ - ${VESA_LIBS} \ - @KDRIVE_LIBS@ - -Xneomagic_LDADD = \ - $(NEOMAGIC_LIBS) \ - @KDRIVE_LIBS@ \ - @XSERVER_LIBS@ \ - $(TSLIB_FLAG) - -Xneomagic_DEPENDENCIES = $(NEOMAGIC_LIBS) @KDRIVE_LIBS@ diff --git a/hw/kdrive/neomagic/README b/hw/kdrive/neomagic/README deleted file mode 100644 index 2b086d75c..000000000 --- a/hw/kdrive/neomagic/README +++ /dev/null @@ -1,15 +0,0 @@ -Neomagic KDrive driver for xserver - -This is a very simple implementation for Neomagic based cards. -Almost all functions are handled by the VESA driver, and -only solid drawing and bitblt are done with acceleration, - -This driver has been tested in MagicGraph 256AV+(NM2230) card -but it should work on other cards as well. - -The only warning is to choose a working mode. You can ask -for supported modes using -listmodes. I use -mode 0x117. - --- -Franco Catrin L. -fcatrin@tuxpan.com diff --git a/hw/kdrive/neomagic/backend.c b/hw/kdrive/neomagic/backend.c deleted file mode 100644 index 958b83781..000000000 --- a/hw/kdrive/neomagic/backend.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Generic card driving functions. - * Essentially, cascades calls to fbdev and vesa to initialize cards that - * do not have hardware-specific routines yet. Copied from the ati driver. - * - * Copyright (c) 2004 Brent Cook <busterb@mail.utexas.edu> - * - * This code is licensed under the GPL. See the file COPYING in the root - * directory of the sources for details. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "backend.h" - -Bool -backendInitialize(KdCardInfo *card, BackendInfo *backend) -{ - Bool success = FALSE; - -#ifdef KDRIVEVESA - if (!success && vesaInitialize(card, &backend->priv.vesa)) { - success = TRUE; - backend->type = VESA; - backend->cardfini = vesaCardFini; - backend->scrfini = vesaScreenFini; - backend->initScreen = vesaInitScreen; - backend->finishInitScreen = vesaFinishInitScreen; - backend->createRes = vesaCreateResources; - backend->preserve = vesaPreserve; - backend->restore = vesaRestore; - backend->dpms = vesaDPMS; - backend->enable = vesaEnable; - backend->disable = vesaDisable; - backend->getColors = vesaGetColors; - backend->putColors = vesaPutColors; - } -#endif -#ifdef KDRIVEFBDEV - if (!success && fbdevInitialize(card, &backend->priv.fbdev)) { - success = TRUE; - backend->type = FBDEV; - backend->cardfini = fbdevCardFini; - backend->scrfini = fbdevScreenFini; - backend->initScreen = fbdevInitScreen; - backend->finishInitScreen = fbdevFinishInitScreen; - backend->createRes = fbdevCreateResources; - backend->preserve = fbdevPreserve; - backend->restore = fbdevRestore; - backend->dpms = fbdevDPMS; - backend->enable = fbdevEnable; - backend->disable = fbdevDisable; - backend->getColors = fbdevGetColors; - backend->putColors = fbdevPutColors; - } -#endif - return success; -} - -Bool -backendScreenInitialize(KdScreenInfo *screen, BackendScreen *backendScreen, - BackendInfo *backendCard) -{ - Bool success = FALSE; - -#ifdef KDRIVEFBDEV - if (backendCard->type == FBDEV) { - screen->card->driver = &backendCard->priv.fbdev; - success = fbdevScreenInitialize(screen, &backendScreen->fbdev); - screen->memory_size = backendCard->priv.fbdev.fix.smem_len; - screen->off_screen_base = backendCard->priv.fbdev.var.yres_virtual - * screen->fb[0].byteStride; - } -#endif -#ifdef KDRIVEVESA - if (backendCard->type == VESA) { - screen->card->driver = &backendCard->priv.vesa; - if (screen->fb[0].depth == 0) { - screen->fb[0].depth = 16; - } - success = vesaScreenInitialize(screen, &backendScreen->vesa); - } -#endif - return success; -} diff --git a/hw/kdrive/neomagic/backend.h b/hw/kdrive/neomagic/backend.h deleted file mode 100644 index 33eae2680..000000000 --- a/hw/kdrive/neomagic/backend.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Generic card driving functions. - * Essentially, cascades calls to fbdev and vesa to initialize cards that - * do not have hardware-specific routines yet. Copied from the ati driver. - * - * Copyright (c) 2004 Brent Cook <busterb@mail.utexas.edu> - * - * This code is licensed under the GPL. See the file COPYING in the root - * directory of the sources for details. - */ - -#ifndef _BACKEND_H_ -#define _BACKEND_H_ -#include "kdrive.h" - -#ifdef KDRIVEFBDEV -#include <fbdev.h> -#endif -#ifdef KDRIVEVESA -#include <vesa.h> -#endif - -typedef enum _BackendType {VESA, FBDEV} BackendType; - -typedef struct _BackendInfo { - // backend info - BackendType type; - - // backend internal structures - union { -#ifdef KDRIVEFBDEV - FbdevPriv fbdev; -#endif -#ifdef KDRIVEVESA - VesaCardPrivRec vesa; -#endif - } priv; - - // pointers to helper functions for this backend - void (*cardfini)(KdCardInfo *); - void (*scrfini)(KdScreenInfo *); - Bool (*initScreen)(ScreenPtr); - Bool (*finishInitScreen)(ScreenPtr pScreen); - Bool (*createRes)(ScreenPtr); - void (*preserve)(KdCardInfo *); - void (*restore)(KdCardInfo *); - Bool (*dpms)(ScreenPtr, int); - Bool (*enable)(ScreenPtr); - void (*disable)(ScreenPtr); - void (*getColors)(ScreenPtr, int, int, xColorItem *); - void (*putColors)(ScreenPtr, int, int, xColorItem *); -} BackendInfo; - -typedef union _BackendScreen { -#ifdef KDRIVEFBDEV - FbdevScrPriv fbdev; -#endif -#ifdef KDRIVEVESA - VesaScreenPrivRec vesa; -#endif -} BackendScreen; - -Bool -backendInitialize(KdCardInfo *card, BackendInfo *backend); - -Bool -backendScreenInitialize(KdScreenInfo *screen, BackendScreen *backendScreen, - BackendInfo *backendCard); - -#endif diff --git a/hw/kdrive/neomagic/neo_draw.c b/hw/kdrive/neomagic/neo_draw.c deleted file mode 100644 index b6419e73c..000000000 --- a/hw/kdrive/neomagic/neo_draw.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN 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 <config.h> -#endif -#include "neomagic.h" - -#include <X11/Xmd.h> -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "picturestr.h" - -NeoMMIO *mmio; -NeoScreenInfo *screen; -NeoCardInfo *card; -CARD32 fgColor; -CARD32 rop; - -CARD32 neoRop[16] = { - 0x000000, /* GXclear */ - 0x080000, /* GXand */ - 0x040000, /* GXandReverse */ - 0x0c0000, /* GXcopy */ - 0x020000, /* GXandInvert */ - 0x0a0000, /* GXnoop */ - 0x060000, /* GXxor */ - 0x0e0000, /* GXor */ - 0x010000, /* GXnor */ - 0x090000, /* GXequiv */ - 0x050000, /* GXinvert */ - 0x0d0000, /* GXorReverse */ - 0x030000, /* GXcopyInvert */ - 0x0b0000, /* GXorInverted */ - 0x070000, /* GXnand */ - 0x0f0000 /* GXset */ -}; - -static void neoWaitIdle(NeoCardInfo *neoc) -{ - // if MMIO is not working it may halt the machine - unsigned int i = 0; - while ((mmio->bltStat & 1) && ++i<100000); -} - -static void neoWaitFifo(NeoCardInfo *neoc, int requested_fifo_space) -{ - neoWaitIdle( neoc ); -} - -static Bool neoPrepareSolid(PixmapPtr pPixmap, - int alu, - Pixel pm, - Pixel fg) -{ - FbBits depthMask = FbFullMask(pPixmap->drawable.depth); - if ((pm & depthMask) != depthMask) { - return FALSE; - } else { - fgColor = fg; - if (alu!=3) DBGOUT("used ROP %i\n", alu); - rop = neoRop[alu]; - return TRUE; - } -} - -static void neoSolid (int x1, int y1, int x2, int y2) -{ - int x, y, w, h; - x = x1; - y = y1; - w = x2-x1; - h = y2-y1; - neoWaitIdle(card); - mmio->fgColor = fgColor; - mmio->bltCntl = - NEO_BC3_FIFO_EN | - NEO_BC0_SRC_IS_FG | - NEO_BC3_SKIP_MAPPING | rop; - mmio->dstStart = y * screen->pitch + x * screen->depth; - - mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff); - -} - - -static void neoDoneSolid(void) -{ -} - -static Bool neoPrepareCopy (PixmapPtr pSrcPixpam, PixmapPtr pDstPixmap, - int dx, int dy, int alu, Pixel pm) -{ - rop = neoRop[alu]; - return TRUE; -} - -static void neoCopy (int srcX, int srcY, int dstX, int dstY, int w, int h) -{ - neoWaitIdle(card); - - if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - mmio->bltCntl = - NEO_BC3_FIFO_EN | - NEO_BC3_SKIP_MAPPING | rop; - mmio->srcStart = srcY * screen->pitch + srcX * screen->depth; - mmio->dstStart = dstY * screen->pitch + dstX * screen->depth; - - mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff); - } else { - mmio->bltCntl = NEO_BC0_X_DEC | - NEO_BC0_DST_Y_DEC | - NEO_BC0_SRC_Y_DEC | - NEO_BC3_FIFO_EN | - NEO_BC3_SKIP_MAPPING | rop; - srcX+=w-1; - dstX+=w-1; - srcY+=h-1; - dstY+=h-1; - mmio->srcStart = srcY * screen->pitch + srcX * screen->depth; - mmio->dstStart = dstY * screen->pitch + dstX * screen->depth; - mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff); - } - -} - -static void neoDoneCopy (void) -{ -} - -KaaScreenInfoRec neoKaa = { - neoPrepareSolid, - neoSolid, - neoDoneSolid, - - neoPrepareCopy, - neoCopy, - neoDoneCopy -}; - -Bool neoDrawInit (ScreenPtr pScreen) -{ - ENTER(); - if (!kaaDrawInit (pScreen, &neoKaa)) { - return FALSE; - } - LEAVE(); - return TRUE; -} - -void neoDrawEnable (ScreenPtr pScreen) -{ - ENTER(); - SetupNeo(pScreen); - screen = neos; - card = neoc; - mmio = neoc->mmio; - screen->depth = (screen->backendScreen.mode.BitsPerPixel+7)/8; - screen->pitch = screen->backendScreen.mode.BytesPerScanLine; - DBGOUT("NEO depth=%x, pitch=%x\n", screen->depth, screen->pitch); - LEAVE(); -} - -void neoDrawDisable (ScreenPtr pScreen) -{ - ENTER(); - LEAVE(); -} - -void neoDrawFini (ScreenPtr pScreen) -{ - ENTER(); - LEAVE(); -} - -void neoDrawSync (ScreenPtr pScreen) -{ - SetupNeo(pScreen); - - neoWaitIdle(neoc); -} diff --git a/hw/kdrive/neomagic/neomagic.c b/hw/kdrive/neomagic/neomagic.c deleted file mode 100644 index 68dbb9172..000000000 --- a/hw/kdrive/neomagic/neomagic.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN 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 <config.h> -#endif -#include "neomagic.h" -#include <sys/io.h> - -struct NeoChipInfo neoChips[] = { - {NEO_VENDOR, 0x0001, CAP_NM2070, "MagicGraph 128(NM2070)", - 896, 65000, 2048, 0x100, 1024, 1024, 1024}, - {NEO_VENDOR, 0x0002, CAP_NM2090, "MagicGraph 128V(NM2090)", - 1152, 80000, 2048, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0003, CAP_NM2090, "MagicGraph 128ZV(NM2093)", - 1152, 80000, 2048, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0083, CAP_NM2097, "MagicGraph 128ZV+(NM2097)", - 1152, 80000, 1024, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0004, CAP_NM2097, "MagicGraph 128XD(NM2160)", - 2048, 90000, 1024, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0005, CAP_NM2200, "MagicGraph 256AV(NM2200)", - 2560, 110000, 1024, 0x1000, 4096, 1280, 1024}, - {NEO_VENDOR, 0x0025, CAP_NM2200, "MagicGraph 256AV+(NM2230)", - 3008, 110000, 1024, 0x1000, 4096, 1280, 1024}, - {NEO_VENDOR, 0x0006, CAP_NM2200, "MagicGraph 256ZX(NM2360)", - 4096, 110000, 1024, 0x1000, 4096, 1280, 1024}, - {NEO_VENDOR, 0x0016, CAP_NM2200, "MagicGraph 256XL+(NM2380)", - 6144, 110000, 1024, 0x1000, 8192, 1280, 1024}, - {0, 0, 0, NULL}, -}; - -static Bool -neoCardInit(KdCardInfo *card) -{ - NeoCardInfo *neoc; - struct NeoChipInfo *chip; - - neoc =(NeoCardInfo *) xalloc(sizeof(NeoCardInfo)); - if(!neoc) { - return FALSE; - } - - if(!vesaInitialize(card, &neoc->backendCard)) { - xfree(neoc); - return FALSE; - } - - for(chip = neoChips; chip->name != NULL; ++chip) { - if(chip->device == card->attr.deviceID) { - neoc->chip = chip; - break; - } - } - - ErrorF("Using Neomagic card: %s\n", neoc->chip->name); - - neoMapReg(card, neoc); - - card->driver = neoc; - - return TRUE; -} - -static Bool -neoScreenInit(KdScreenInfo *screen) -{ - NeoScreenInfo *neos; - neoCardInfo(screen); - int screen_size, memory; - - neos = xcalloc(sizeof(NeoScreenInfo), 1); - if(neos == NULL) { - return FALSE; - } - - memset (neos, '\0', sizeof (NeoScreenInfo)); - - - if(!vesaScreenInitialize(screen, &neos->backendScreen)) { - xfree(neos); - return FALSE; - } - - screen->softCursor = TRUE; // no hardware color cursor available - - neos->screen = neos->backendScreen.fb; - - memory = neos->backendScreen.fb_size; - screen_size = screen->fb[0].byteStride * screen->height; - memory -= screen_size; - - if(memory > screen->fb[0].byteStride) { - neos->off_screen = neos->screen + screen_size; - neos->off_screen_size = memory; - } else { - neos->off_screen = 0; - neos->off_screen_size = 0; - } - - screen->driver = neos; - - return TRUE; -} - -static Bool -neoInitScreen(ScreenPtr pScreen) -{ - return vesaInitScreen(pScreen); -} - -static Bool -neoFinishInitScreen(ScreenPtr pScreen) -{ - return vesaFinishInitScreen(pScreen); -} - -static Bool -neoCreateResources(ScreenPtr pScreen) -{ - return vesaCreateResources(pScreen); -} - -void -neoPreserve(KdCardInfo *card) -{ - vesaPreserve(card); -} - -CARD8 -neoGetIndex(NeoCardInfo *nvidiac, CARD16 addr, CARD8 index) -{ - outb(index, addr); - - return inb(addr+1); -} - -void -neoSetIndex(NeoCardInfo *nvidiac, CARD16 addr, CARD8 index, CARD8 val) -{ - outb(index, addr); - outb(val, addr+1); -} - -static void neoLock(NeoCardInfo *neoc){ - CARD8 cr11; - neoSetIndex(neoc, 0x3ce, 0x09, 0x00); - neoSetIndex(neoc, 0x3ce, 0x11, 0x0); // disable MMIO and linear mode - cr11 = neoGetIndex(neoc, 0x3d4, 0x11); - neoSetIndex(neoc, 0x3d4, 0x11, cr11 | 0x80); -} - -static void neoUnlock(NeoCardInfo *neoc){ - CARD8 cr11; - cr11 = neoGetIndex(neoc, 0x3d4, 0x11); - neoSetIndex(neoc, 0x3d4, 0x11, cr11 & 0x7F); - neoSetIndex(neoc, 0x3ce, 0x09, 0x26); - neoSetIndex(neoc, 0x3ce, 0x11, 0xc0); // enable MMIO and linear mode -} - - -Bool -neoMapReg(KdCardInfo *card, NeoCardInfo *neoc) -{ - neoc->reg_base = card->attr.address[1] & 0xFFF80000; - if(!neoc->reg_base) { - return FALSE; - } - - neoc->mmio = KdMapDevice(neoc->reg_base, NEO_REG_SIZE(card)); - if(!neoc->mmio) { - return FALSE; - } - - KdSetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS); - - return TRUE; -} - -void -neoUnmapReg(KdCardInfo *card, NeoCardInfo *neoc) -{ - if(neoc->reg_base) - { - neoSetIndex(neoc, 0x3ce, 0x82,0); - KdResetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice((void *)neoc->mmio, NEO_REG_SIZE(card)); - neoc->reg_base = 0; - } -} - -static void -neoSetMMIO(KdCardInfo *card, NeoCardInfo *neoc) -{ - if(!neoc->reg_base) - neoMapReg(card, neoc); - neoUnlock(neoc); -} - -static void -neoResetMMIO(KdCardInfo *card, NeoCardInfo *neoc) -{ - neoUnmapReg(card, neoc); - neoLock(neoc); -} - - -Bool -neoEnable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - neoCardInfo(pScreenPriv); - - if(!vesaEnable(pScreen)) { - return FALSE; - } - - neoSetMMIO(pScreenPriv->card, neoc); - return TRUE; -} - -void -neoDisable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - neoCardInfo(pScreenPriv); - - neoResetMMIO(pScreenPriv->card, neoc); - - vesaDisable(pScreen); -} - -static void -neoGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - vesaGetColors(pScreen, fb, n, pdefs); -} - -static void -neoPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - vesaPutColors(pScreen, fb, n, pdefs); -} - -static Bool -neoDPMS(ScreenPtr pScreen, int mode) -{ - return vesaDPMS(pScreen, mode); -} - -static void -neoRestore(KdCardInfo *card) -{ - NeoCardInfo *neoc = card->driver; - - neoResetMMIO(card, neoc); - vesaRestore(card); -} - -static void -neoScreenFini(KdScreenInfo *screen) -{ - NeoScreenInfo *neos =(NeoScreenInfo *) screen->driver; - - vesaScreenFini(screen); - xfree(neos); - screen->driver = 0; -} - -static void -neoCardFini(KdCardInfo *card) -{ - NeoCardInfo *neoc = card->driver; - - neoUnmapReg(card, neoc); - vesaCardFini(card); -} - -#define neoCursorInit 0 // initCursor -#define neoCursorEnable 0 // enableCursor -#define neoCursorDisable 0 // disableCursor -#define neoCursorFini 0 // finiCursor */ -#define neoRecolorCursor 0 // recolorCursor */ -//#define neoDrawInit 0 // initAccel -//#define neoDrawEnable 0 // enableAccel -//#define neoDrawSync 0 // syncAccel -//#define neoDrawDisable 0 // disableAccel -//#define neoDrawFini 0 // finiAccel - -KdCardFuncs neoFuncs = { - neoCardInit, // cardinit - neoScreenInit, // scrinit - neoInitScreen, // initScreen - neoFinishInitScreen, // finishInitScreen - neoCreateResources, // createRes - neoPreserve, // preserve - neoEnable, // enable - neoDPMS, // dpms - neoDisable, // disable - neoRestore, // restore - neoScreenFini, // scrfini - neoCardFini, // cardfini - - neoCursorInit, // initCursor - neoCursorEnable, // enableCursor - neoCursorDisable, // disableCursor - neoCursorFini, // finiCursor - neoRecolorCursor, // recolorCursor - - neoDrawInit, // initAccel - neoDrawEnable, // enableAccel - neoDrawSync, // syncAccel - neoDrawDisable, // disableAccel - neoDrawFini, // finiAccel - - neoGetColors, // getColors - neoPutColors, // putColors -}; diff --git a/hw/kdrive/neomagic/neomagic.h b/hw/kdrive/neomagic/neomagic.h deleted file mode 100644 index 590319652..000000000 --- a/hw/kdrive/neomagic/neomagic.h +++ /dev/null @@ -1,216 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN 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 _NEOMAGIC_H_ -#define _NEOMAGIC_H_ -#include <backend.h> -#include "kxv.h" -#include "klinux.h" - - -#define DEBUG -#ifdef DEBUG -#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a) -#else -#define DBGOUT(fmt,a...) -#endif - -#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__) -#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__) - -#define NEO_VENDOR 0x10c8 -#define CAP_NM2070 0x01 /* If it's a NM2070 series */ -#define CAP_NM2090 0x02 /* If it's a NM2090 series */ -#define CAP_NM2097 0x03 /* If it's a NM2097 series */ -#define CAP_NM2200 0x04 /* If it's a NM2200 series */ - -#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 - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -#define NEO_REG_SIZE(c) (0x200000L) - -typedef volatile struct { - CARD32 bltStat; - CARD32 bltCntl; - CARD32 xpColor; - CARD32 fgColor; - CARD32 bgColor; - CARD32 pitch; - CARD32 clipLT; - CARD32 clipRB; - CARD32 srcBitOffset; - CARD32 srcStart; - CARD32 reserved0; - CARD32 dstStart; - CARD32 xyExt; - - CARD32 reserved1[19]; - - CARD32 pageCntl; - CARD32 pageBase; - CARD32 postBase; - CARD32 postPtr; - CARD32 dataPtr; -} NeoMMIO; - -typedef struct _neoCardInfo { - VesaCardPrivRec backendCard; - - CARD32 reg_base; - NeoMMIO *mmio; - int dstOrg; - int dstPitch; - int dstPixelWidth; - - int srcOrg; - int srcPitch; - int srcPixelWidth; - - struct NeoChipInfo *chip; - - CARD32 bltCntl; - -} NeoCardInfo; - -struct NeoChipInfo { - CARD16 vendor; - CARD16 device; - CARD8 caps; - char *name; - int videoRam; - int maxClock; - int cursorMem; - int cursorOff; - int linearSize; - int maxWidth; - int maxHeight; -}; - -#define getNeoCardInfo(kd) ((NeoCardInfo *) ((kd)->card->driver)) -#define neoCardInfo(kd) NeoCardInfo *neoc = getNeoCardInfo(kd) - -typedef struct _neoScreenInfo { - VesaScreenPrivRec backendScreen; - - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - int pitch; - int depth; - KdVideoAdaptorPtr pAdaptor; -} NeoScreenInfo; - -#define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver)) -#define neoScreenInfo(kd) NeoScreenInfo *neos = getNeoScreenInfo(kd) - -#define SetupNeo(s) KdScreenPriv(s); \ - neoCardInfo(pScreenPriv); \ - neoScreenInfo(pScreenPriv); - -void -neoPreserve (KdCardInfo *card); - -Bool -neoEnable (ScreenPtr pScreen); - -void -neoDisable (ScreenPtr pScreen); - -Bool -neoMapReg (KdCardInfo *card, NeoCardInfo *nvidiac); - -void -neoUnmapReg (KdCardInfo *card, NeoCardInfo *nvidiac); - -CARD8 -neoGetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id); - -void -neoSetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id, CARD8 val); - -Bool -neoDrawInit (ScreenPtr pScreen); - -void -neoDrawEnable (ScreenPtr pScreen); - -void -neoDrawDisable (ScreenPtr pScreen); - -void -neoDrawFini (ScreenPtr pScreen); - -void -neoDrawSync (ScreenPtr pScreen); - -extern KdCardFuncs neoFuncs; - -#endif /* _NEOMAGIC_H_ */ diff --git a/hw/kdrive/neomagic/neomagicstub.c b/hw/kdrive/neomagic/neomagicstub.c deleted file mode 100644 index 561f04a4a..000000000 --- a/hw/kdrive/neomagic/neomagicstub.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN 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 <config.h> -#endif -#include "neomagic.h" - -extern struct NeoChipInfo neoChips[]; - -void -InitCard (char *name) -{ - KdCardAttr attr; - struct NeoChipInfo *chip; - - for (chip = neoChips; chip->name != NULL; ++chip) { - int j = 0; - while (LinuxFindPci(chip->vendor, chip->device, j++, &attr)) { - KdCardInfoAdd(&neoFuncs, &attr, 0); - } - } -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); -#ifdef TOUCHSCREEN - KdInitTouchScreen (&TsFuncs); -#endif -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} |