diff --git a/hw/kdrive/neomagic/ChangeLog b/hw/kdrive/neomagic/ChangeLog index 309404b09..edf4222c1 100644 --- a/hw/kdrive/neomagic/ChangeLog +++ b/hw/kdrive/neomagic/ChangeLog @@ -1,3 +1,6 @@ +2004-04-10 Franco Catrin L. + * MMIO enabled after switching to new VT + 2004-04-06 Franco Catrin L. * Returned to a working state. Brent will continue working on a backend in a separate CVS branch diff --git a/hw/kdrive/neomagic/neo_draw.c b/hw/kdrive/neomagic/neo_draw.c index d95fceacb..b4531864b 100644 --- a/hw/kdrive/neomagic/neo_draw.c +++ b/hw/kdrive/neomagic/neo_draw.c @@ -39,24 +39,27 @@ #include "miline.h" #include "picturestr.h" -static inline void neoWaitIdle(NeoCardInfo *neoc) -{ - // if MMIO is not working it may halt the machine - int i = 0; - while ((neoc->mmio->bltStat & 1) && ++i<10000); - if (i>=10000) DBGOUT("Wait Idle timeout"); -} - -static inline void neoWaitFifo(NeoCardInfo *neoc, int requested_fifo_space) -{ - neoWaitIdle( neoc ); -} - NeoMMIO *mmio; NeoScreenInfo *screen; NeoCardInfo *card; CARD32 fgColor; +static void neoWaitIdle(NeoCardInfo *neoc) +{ + // if MMIO is not working it may halt the machine + DBGOUT("Waiting for idle...\n"); + DBGOUT("blStat %lx=%lx\n", &mmio->bltStat, mmio->bltStat); + unsigned int i = 0; + while ((mmio->bltStat & 1) && ++i<100000); + if (i>=100000) DBGOUT("Wait Idle timeout\n"); + else DBGOUT("*** Wait Idle ok\n"); +} + +static void neoWaitFifo(NeoCardInfo *neoc, int requested_fifo_space) +{ + neoWaitIdle( neoc ); +} + static Bool neoPrepareSolid(PixmapPtr pPixmap, int alu, Pixel pm, @@ -68,15 +71,12 @@ static Bool neoPrepareSolid(PixmapPtr pPixmap, return FALSE; } else { fgColor = fg; - neoWaitIdle(card); /* set blt control */ - mmio->bltCntl = - NEO_BC0_SRC_IS_FG | +/* NEO_BC0_SRC_IS_FG | NEO_BC3_SRC_XY_ADDR | - NEO_BC3_DST_XY_ADDR | - NEO_BC3_SKIP_MAPPING | 0x0c0000; + NEO_BC3_DST_XY_ADDR | + NEO_BC3_SKIP_MAPPING | 0x0c0000; */ - mmio->fgColor = fgColor; return TRUE; } } @@ -98,12 +98,23 @@ static void neoSolid (int x1, int y1, int x2, int y2) h = -h; } - neoWaitIdle(card); + int pitch = 16; + + neoWaitIdle(card); + mmio->bltStat = NEO_MODE1_DEPTH16 << 16; + mmio->pitch = (pitch << 16) | (pitch & 0xffff); + + neoWaitIdle(card); + mmio->fgColor = fgColor; + mmio->bltCntl = + NEO_BC3_FIFO_EN | + NEO_BC0_SRC_IS_FG | + NEO_BC3_SKIP_MAPPING | 0x0c0000; mmio->dstStart = (y <<16) | (x & 0xffff); mmio->xyExt = (h << 16) | (w & 0xffff); DBGOUT("Solid (%i, %i) - (%i, %i). Color %li\n", x, y, w, h, fgColor); - DBGOUT("Offset %lx. Extent %lx\n",mmio->dstStart, mmio->xyExt); + // DBGOUT("Offset %lx. Extent %lx\n",mmio->dstStart, mmio->xyExt); } diff --git a/hw/kdrive/neomagic/neomagic.c b/hw/kdrive/neomagic/neomagic.c index d53a3affe..60ec8f424 100644 --- a/hw/kdrive/neomagic/neomagic.c +++ b/hw/kdrive/neomagic/neomagic.c @@ -75,8 +75,6 @@ neoCardInit(KdCardInfo *card) ErrorF("Using Neomagic card: %s\n", neoc->chip->name); - iopl(3); - neoMapReg(card, neoc); card->driver = neoc; @@ -170,6 +168,7 @@ neoSetIndex(NeoCardInfo *nvidiac, CARD16 addr, CARD8 index, CARD8 val) 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); } @@ -179,6 +178,7 @@ static void neoUnlock(NeoCardInfo *neoc){ 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 } diff --git a/hw/kdrive/neomagic/neomagic.h b/hw/kdrive/neomagic/neomagic.h index 9c2c62765..590319652 100644 --- a/hw/kdrive/neomagic/neomagic.h +++ b/hw/kdrive/neomagic/neomagic.h @@ -79,6 +79,18 @@ #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;