diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 9 | ||||
-rw-r--r-- | src/alp.h | 4 | ||||
-rw-r--r-- | src/alp_driver.c | 170 | ||||
-rw-r--r-- | src/alp_xaa.c | 687 | ||||
-rw-r--r-- | src/alp_xaam.c | 270 | ||||
-rw-r--r-- | src/cir.h | 6 | ||||
-rw-r--r-- | src/cir_dga.c | 66 | ||||
-rw-r--r-- | src/cir_driver.c | 9 | ||||
-rw-r--r-- | src/lg.h | 4 | ||||
-rw-r--r-- | src/lg_blit.h (renamed from src/lg_xaa.h) | 8 | ||||
-rw-r--r-- | src/lg_driver.c | 60 | ||||
-rw-r--r-- | src/lg_hwcurs.c | 2 | ||||
-rw-r--r-- | src/lg_xaa.c | 301 |
13 files changed, 28 insertions, 1568 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index bc8732d..82e8530 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,13 +42,6 @@ cirrus_drv_la_SOURCES = \ alp_i2c.c \ lg_driver.c \ lg.h \ + lg_blit.h \ lg_hwcurs.c \ lg_i2c.c - -if XAA -cirrus_drv_la_SOURCES += \ - alp_xaa.c \ - alp_xaam.c \ - lg_xaa.c \ - lg_xaa.h -endif @@ -40,10 +40,6 @@ typedef struct { } AlpRegRec, *AlpRegPtr; extern Bool AlpHWCursorInit(ScreenPtr pScreen, int size); -#ifdef HAVE_XAA_H -extern Bool AlpXAAInit(ScreenPtr pScreen); -extern Bool AlpXAAInitMMIO(ScreenPtr pScreen); -#endif extern Bool AlpDGAInit(ScreenPtr pScreen); extern Bool AlpI2CInit(ScrnInfoPtr pScrn); diff --git a/src/alp_driver.c b/src/alp_driver.c index ab6f84a..eedabe5 100644 --- a/src/alp_driver.c +++ b/src/alp_driver.c @@ -31,11 +31,6 @@ /* This driver needs to be modified to not use vgaHW for multihead operation */ #include "vgaHW.h" -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 -#include "xf86RAC.h" -#include "xf86Resources.h" -#endif - /* All drivers initialising the SW cursor need this */ #include "mipointer.h" @@ -50,13 +45,6 @@ /* Framebuffer memory manager */ #include "xf86fbman.h" -#if HAVE_XF4BPP -#include "xf4bpp.h" -#endif -#if HAVE_XF1BPP -#include "xf1bpp.h" -#endif - #include "fb.h" @@ -109,12 +97,7 @@ static void AlpSetClock(CirPtr pCir, vgaHWPtr hwp, int freq); static void AlpOffscreenAccelInit(ScrnInfoPtr pScrn); static void AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, int flags); - -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 -static void PC98CIRRUS755xEnable(ScrnInfoPtr pScrn); -static void PC98CIRRUS755xDisable(ScrnInfoPtr pScrn); -#endif + int PowerManagementMode, int flags); /* * This is intentionally screen-independent. It indicates the binding @@ -490,12 +473,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) pCir = CIRPTR(pScrn); pCir->pScrn = pScrn; - -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - pCir->PIOReg = hwp->PIOOffset + 0x3CE; -#else - pCir->PIOReg = 0x3CE; -#endif + pCir->PIOReg = 0x3CE; /* was hwp->PIOOffset + 0x3CE */ /* Get the entity, and make sure it is PCI. */ pCir->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -513,9 +491,6 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) PCI_DEV_FUNC(pCir->PciInfo)); #endif -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (!xf86IsPc98()) -#endif if (xf86LoadSubModule(pScrn, "int10")) { xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); @@ -1055,51 +1030,20 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); - /* Load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { -#ifdef HAVE_XF1BPP - case 1: - if (xf86LoadSubModule(pScrn, "xf1bpp") == NULL) { - AlpFreeRec(pScrn); - return FALSE; - } - break; -#endif -#ifdef HAVE_XF4BPP - case 4: - if (xf86LoadSubModule(pScrn, "xf4bpp") == NULL) { - AlpFreeRec(pScrn); - return FALSE; - } - break; -#endif - case 8: - case 16: - case 24: - case 32: - if (xf86LoadSubModule(pScrn, "fb") == NULL) { - AlpFreeRec(pScrn); - return FALSE; - } - break; + /* Load fb module */ + if (xf86LoadSubModule(pScrn, "fb") == NULL) { + AlpFreeRec(pScrn); + return FALSE; } - /* Load XAA if needed */ + /* Use shadowfb for acceleration */ if (!pCir->NoAccel) { -#ifdef HAVE_XAA_H - if (!xf86LoadSubModule(pScrn, "xaa")) -#else - if (1) -#endif - { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Falling back to shadowfb\n"); - pCir->NoAccel = TRUE; - pCir->shadowFB = TRUE; - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Falling back to shadowfb\n"); + pCir->NoAccel = TRUE; + pCir->shadowFB = TRUE; } - /* Load ramdac if needed */ if (pCir->HWCursor) { if (!xf86LoadSubModule(pScrn, "ramdac")) { @@ -1413,11 +1357,6 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaHWProtect(pScrn, FALSE); -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (xf86IsPc98()) - PC98CIRRUS755xEnable(pScrn); -#endif - return TRUE; } @@ -1556,22 +1495,8 @@ AlpScreenInit(SCREEN_INIT_ARGS_DECL) */ switch (pScrn->bitsPerPixel) { -#ifdef HAVE_XF1BPP case 1: - ret = xf1bppScreenInit(pScreen, FbBase, - width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; -#endif -#ifdef HAVE_XF4BPP case 4: - ret = xf4bppScreenInit(pScreen, FbBase, - width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; -#endif case 8: case 16: case 24: @@ -1650,14 +1575,8 @@ AlpScreenInit(SCREEN_INIT_ARGS_DECL) } } - if (!pCir->NoAccel) { /* Initialize XAA functions */ + if (!pCir->NoAccel) { /* Initialize acceleration functions */ AlpOffscreenAccelInit(pScrn); -#ifdef HAVE_XAA_H - if (!(pCir->UseMMIO ? AlpXAAInitMMIO(pScreen) : - AlpXAAInit(pScreen))) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Could not initialize XAA\n"); -#endif } #if 1 @@ -1835,11 +1754,6 @@ AlpLeaveVT(VT_FUNC_ARGS_DECL) AlpRestore(pScrn); vgaHWLock(hwp); - -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (xf86IsPc98()) - PC98CIRRUS755xDisable(pScrn); -#endif } @@ -1864,11 +1778,6 @@ AlpCloseScreen(CLOSE_SCREEN_ARGS_DECL) CirUnmapMem(pCir, pScrn->scrnIndex); } -#ifdef HAVE_XAA_H - if (pCir->AccelInfoRec) - XAADestroyInfoRec(pCir->AccelInfoRec); - pCir->AccelInfoRec = NULL; -#endif if (pCir->CursorInfoRec) xf86DestroyCursorInfoRec(pCir->CursorInfoRec); pCir->CursorInfoRec = NULL; @@ -1879,11 +1788,6 @@ AlpCloseScreen(CLOSE_SCREEN_ARGS_DECL) pScrn->vtSema = FALSE; -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (xf86IsPc98()) - PC98CIRRUS755xDisable(pScrn); -#endif - pScreen->CloseScreen = pCir->CloseScreen; return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); } @@ -2148,53 +2052,3 @@ AlpOffscreenAccelInit(ScrnInfoPtr pScrn) box.y2 - pScrn->virtualY); } } - -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 -static void -PC98CIRRUS755xEnable(ScrnInfoPtr pScrn) /* enter_aile() */ -{ - unsigned int index,data; - vgaHWPtr hwp = VGAHWPTR(pScrn); - - outb(0xfac, 0x02); - - outb(0x68, 0x0e); - outb(0x6a, 0x07); - outb(0x6a, 0x8f); - outb(0x6a, 0x06); - - outw(VGA_SEQ_INDEX, 0x1206); /* unlock cirrus special */ - - index = hwp->IOBase + VGA_CRTC_INDEX_OFFSET; - data = hwp->IOBase + VGA_CRTC_DATA_OFFSET; - outb(index, 0x3c); - outb(data, inb(data) & 0xef); - outb(index, 0x1a); - outb(data, inb(data) & 0xf3); -} - -static void -PC98CIRRUS755xDisable(ScrnInfoPtr pScrn) /* leave_aile() */ -{ - unsigned int index,data; - vgaHWPtr hwp = VGAHWPTR(pScrn); - - outw(VGA_SEQ_INDEX, 0x1206); /* unlock cirrus special */ - - index = hwp->IOBase + VGA_CRTC_INDEX_OFFSET; - data = hwp->IOBase + VGA_CRTC_DATA_OFFSET; - outb(index, 0x3c); - outb(data, 0x71); - outb(index, 0x1a); - outb(data, inb(data) | 0x0c); - - outb(0xfac,0x00); - - outb(0x68, 0x0f); - outb(0x6a, 0x07); - outb(0x6a, 0x8e); - outb(0x6a, 0x21); - outb(0x6a, 0x69); - outb(0x6a, 0x06); -} -#endif diff --git a/src/alp_xaa.c b/src/alp_xaa.c deleted file mode 100644 index ba2d6ef..0000000 --- a/src/alp_xaa.c +++ /dev/null @@ -1,687 +0,0 @@ -/* (c) Itai Nahshon */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "compiler.h" - -#include "xf86Pci.h" - -#include "vgaHW.h" - -#include "cir.h" -#define _ALP_PRIVATE_ -#include "alp.h" - -#ifdef HAVE_XAA_H -#define WAIT outb(pCir->PIOReg, 0x31); \ - while(inb(pCir->PIOReg + 1) & pCir->chip.alp->waitMsk){}; -#define WAIT_1 outb(pCir->PIOReg, 0x31); \ - while(inb(pCir->PIOReg + 1) & 0x1){}; - -static const CARD16 translated_rop[] = -{ - /* GXclear */ 0x0032U, - /* GXand */ 0x0532U, - /* GXandreverse */ 0x0932U, - /* GXcopy */ 0x0D32U, - /* GXandinversted */ 0x5032U, - /* GXnoop */ 0x0632U, - /* GXxor */ 0x5932U, - /* GXor */ 0x6D32U, - /* GXnor */ 0x9032U, - /* GXequiv */ 0x9532U, - /* GXinvert */ 0x0B32U, - /* GXorReverse */ 0xAD32U, - /* GXcopyInverted */ 0xD032U, - /* GXorInverted */ 0xD632U, - /* GXnand */ 0xDA32U, - /* GXset */ 0x0E32U -}; - -#if 1 -#define SetupForRop(rop) outw(pCir->PIOReg, translated_rop[rop]) -#else -#define SetupForRop(rop) outw(pCir->PIOReg, 0x0D32) -#endif - -static void AlpSync(ScrnInfoPtr pScrn) -{ - CirPtr pCir = CIRPTR(pScrn); - -#ifdef ALP_DEBUG - ErrorF("AlpSync\n"); -#endif - WAIT_1; - return; -} - -static void -AlpSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int trans_color) -{ - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; - -#ifdef ALP_DEBUG - ErrorF("AlpSetupForScreenToScreenCopy xdir=%d ydir=%d rop=%x planemask=%x trans_color=%x\n", - xdir, ydir, rop, planemask, trans_color); -#endif - WAIT; - SetupForRop(rop); - /* Set dest pitch */ - outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); - outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); - /* Set source pitch */ - outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x26); - outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x27); -} - -static void -AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h) -{ - CirPtr pCir = CIRPTR(pScrn); - int source, dest; - int hh, ww; - int decrement = 0; - int pitch = pCir->pitch; - - ww = (w * pScrn->bitsPerPixel / 8) - 1; - hh = h - 1; - dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8; - source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8; - if (dest > source) { - decrement = 1 << 8; - dest += hh * pitch + ww; - source += hh * pitch + ww; - } - - WAIT; - - outw(pCir->PIOReg, decrement | 0x30); - - /* Width */ - outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); - outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); - /* Height */ - outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); - outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); - - - /* source */ - outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C); - outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D); - outw(pCir->PIOReg, ((source >> 8) & 0x3f00)| 0x2E); - - /* dest */ - outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); - outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); - outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); - if (!pCir->chip.alp->autoStart) - outw(pCir->PIOReg, 0x0231); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", - x1, y1, x2, y2, w, h); - ErrorF("AlpSubsequentScreenToScreenCopy s=%d d=%d ww=%d hh=%d\n", - source, dest, ww, hh); -#endif - -} - -static void -AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - int pitch = pCir->pitch; - -#ifdef ALP_DEBUG - ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n", - color, rop, planemask); -#endif - WAIT; - - SetupForRop(rop); - - switch (pCir -> Chipset) - { - case PCI_CHIP_GD7548: - /* The GD7548 does not (apparently) support solid filling - directly, it always need an actual source. - We therefore use it as a pattern fill with a solid - pattern */ - { - int source = pAlp->monoPattern8x8; - /* source = 8x8 solid mono pattern */ - outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C); - outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D); - outw(pCir->PIOReg, ((source >> 8) & 0x3f00) | 0x2E); - /* memset() may not be the fastest */ - memset(pCir->FbBase + pAlp->monoPattern8x8, 0xFF, 8); - write_mem_barrier(); - break; - } - default: - /* GR33 = 0x04 => does not exist on GD7548 */ - outw(pCir->PIOReg, 0x0433); - } - - /* GR30 = color expansion, pattern copy */ - /* Choses 8bpp / 16bpp color expansion */ - outw(pCir->PIOReg, 0xC030 |((pScrn->bitsPerPixel - 8) << 9)); - - outw(pCir->PIOReg, ((color << 8) & 0xff00) | 0x01); - outw(pCir->PIOReg, ((color) & 0xff00) | 0x11); - outw(pCir->PIOReg, ((color >> 8) & 0xff00) | 0x13); - outw(pCir->PIOReg, 0x15); - - /* Set dest pitch */ - outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); - outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); -} - -static void -AlpSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - CirPtr pCir = CIRPTR(pScrn); - int dest; - int hh, ww; - int pitch = pCir->pitch; - - ww = (w * pScrn->bitsPerPixel / 8) - 1; - hh = h - 1; - dest = y * pitch + x * pScrn->bitsPerPixel / 8; - - WAIT; - - /* Width */ - outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); - outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); - /* Height */ - outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); - outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); - - /* dest */ - outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); - outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); - outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); - if (!pCir->chip.alp->autoStart) - outw(pCir->PIOReg, 0x0231); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n", - x, y, w, h); -#endif - -} - -static void -AlpSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int fg, int bg, - int rop, unsigned int planemask) -{ - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - int pitch = pCir->pitch; - -#ifdef ALP_DEBUG - ErrorF("AlpSetupFor8x8PatternFill pattern=%8x%8x" - "fg=%x bg=%x rop=%x planemask=%x\n", - patx, paty, fg, bg, rop, planemask); -#endif - WAIT; - - SetupForRop(rop); - - { - int source = pAlp->monoPattern8x8; - /* source = 8x8 solid mono pattern */ - outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C); - outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D); - outw(pCir->PIOReg, ((source >> 8) & 0x3f00) | 0x2E); - } - - /* GR30 = color expansion, pattern copy */ - /* Choses 8bpp / 16bpp color expansion */ - if (bg == -1) - { /* transparency requested */ - outw(pCir->PIOReg, 0xC830 |((pScrn->bitsPerPixel - 8) << 9)); - - bg = ~fg; - /* transparent color compare */ - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); - outw(pCir->PIOReg, ((bg) & 0xff00) | 0x35); - - /* transparent color mask = 0 (all bits matters) */ - outw(pCir->PIOReg, 0x38); - outw(pCir->PIOReg, 0x39); - } - else - { - outw(pCir->PIOReg, 0xC030 |((pScrn->bitsPerPixel - 8) << 9)); - } - - outw(pCir->PIOReg, ((fg << 8) & 0xff00) | 0x01); - outw(pCir->PIOReg, ((fg) & 0xff00) | 0x11); - - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x00); - outw(pCir->PIOReg, ((bg) & 0xff00) | 0x10); - - /* Set dest pitch */ - outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); - outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); -} - -static void -AlpSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, - int x, int y, int w, int h) -{ - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - int dest; - int hh, ww; - int pitch = pCir->pitch; - - ww = (w * pScrn->bitsPerPixel / 8) - 1; - hh = h - 1; - dest = y * pitch + x * pScrn->bitsPerPixel / 8; - - WAIT; - /* memcpy() may not be the fastest */ - memcpy(pCir->FbBase + pAlp->monoPattern8x8, &patx, 4); - memcpy(pCir->FbBase + pAlp->monoPattern8x8 + 4, &paty, 4); - write_mem_barrier(); - - /* Width */ - outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); - outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); - /* Height */ - outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); - outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); - - /* dest */ - outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); - outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); - outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); - if (!pCir->chip.alp->autoStart) - outw(pCir->PIOReg, 0x0231); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequent8x8PatternFill x=%d y=%d w=%d h=%d\n", - x, y, w, h); -#endif - -} - -#if 0 -/* XF86 does not support byte-padded scanlines */ - -static void -AlpSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - int pitch = pCir->pitch; - -#ifdef ALP_DEBUG - ErrorF("AlpSetupForCPUToScreenColorExpandFill " - "fg=%x bg=%x rop=%x planemask=%x\n", - fg, bg, rop, planemask); -#endif - WAIT; - - SetupForRop(rop); - - /* GR30 = color expansion, CPU->display copy */ - /* Choses 8bpp / 16bpp color expansion */ - if (bg == -1) - { /* transparency requested */ - outw(pCir->PIOReg, 0x8C30 |((pScrn->bitsPerPixel - 8) << 9)); - - bg = ~fg; - /* transparent color compare */ - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); - outw(pCir->PIOReg, ((bg) & 0xff00) | 0x35); - - /* transparent color mask = 0 (all bits matters) */ - outw(pCir->PIOReg, 0x38); - outw(pCir->PIOReg, 0x39); - } - else - { - outw(pCir->PIOReg, 0x8430 |((pScrn->bitsPerPixel - 8) << 9)); - } - - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x00); - outw(pCir->PIOReg, ((bg) & 0xff00) | 0x10); - - outw(pCir->PIOReg, ((fg << 8) & 0xff00) | 0x01); - outw(pCir->PIOReg, ((fg) & 0xff00) | 0x11); - - /* Set dest pitch */ - outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); - outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); -} - -static void -AlpSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft) -{ - CirPtr pCir = CIRPTR(pScrn); - int dest; - int hh, ww; - int pitch = pCir->pitch; - - ww = (((w+7) & ~7) * pScrn->bitsPerPixel / 8) - 1; - hh = h - 1; - dest = y * pitch + x * pScrn->bitsPerPixel / 8; - - WAIT; - - /* Width */ - outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); - outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); - /* Height */ - outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22); - outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23); - - /* source = CPU ; description of bit 2 of GR30 in the 7548 manual - says that if we do color expansion we must zero the source - address registers (GR2C, GR2D, GR2E) */ - outw(pCir->PIOReg, 0x2C); - outw(pCir->PIOReg, 0x2D); - outw(pCir->PIOReg, 0x2E); - - /* dest */ - outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); - outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); - outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); - if (!pCir->chip.alp->autoStart) - outw(pCir->PIOReg, 0x0231); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentCPUToScreenColorExpandFill x=%d y=%d w=%d h=%d\n", - x, y, w, h); -#endif -} -#endif - -#if 1 -static void -AlpSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; - -#ifdef ALP_DEBUG - ErrorF("AlpSetupForCPUToScreenColorExpandFill " - "fg=%x bg=%x rop=%x planemask=%x, bpp=%d\n", - fg, bg, rop, planemask, pScrn->bitsPerPixel); -#endif - WAIT; - - SetupForRop(rop); - - /* GR30 = color expansion, CPU->display copy */ - /* Choses 8bpp / 16bpp color expansion */ - if (bg == -1) - { /* transparency requested */ - if (pScrn->bitsPerPixel > 8) /* 16 bpp */ - { - outw(pCir->PIOReg, 0x9C30); - - bg = ~fg; - /* transparent color compare */ - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); - outw(pCir->PIOReg, ((bg) & 0xff00) | 0x35); - } else /* 8 bpp */ - { - outw(pCir->PIOReg, 0x8C30); - - bg = ~fg; - /* transparent color compare */ - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x34); - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x35); - } - - /* transparent color mask = 0 (all bits matters) */ - outw(pCir->PIOReg, 0x38); - outw(pCir->PIOReg, 0x39); - } - else - { - outw(pCir->PIOReg, 0x8430 |((pScrn->bitsPerPixel - 8) << 9)); - } - - outw(pCir->PIOReg, ((bg << 8) & 0xff00) | 0x00); - outw(pCir->PIOReg, ((bg) & 0xff00) | 0x10); - - outw(pCir->PIOReg, ((fg << 8) & 0xff00) | 0x01); - outw(pCir->PIOReg, ((fg) & 0xff00) | 0x11); - - /* Set dest pitch */ - outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24); - outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25); -} - -static void -AlpSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft) -{ - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - - int pitch = pCir->pitch; - - pAlp->SubsequentColorExpandScanlineByteWidth = - (w * pScrn->bitsPerPixel / 8) - 1; - pAlp->SubsequentColorExpandScanlineDWordWidth = - (w + 31) >> 5; - pAlp->SubsequentColorExpandScanlineDest = - y * pitch + x * pScrn->bitsPerPixel / 8; - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentScanlineCPUToScreenColorExpandFill x=%d y=%d w=%d h=%d skipleft=%d\n", - x, y, w, h, skipleft); -#endif -} - -static void -AlpSubsequentColorExpandScanline( - ScrnInfoPtr pScrn, - int bufno) -{ - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - int dest=pAlp->SubsequentColorExpandScanlineDest; - int ww=pAlp->SubsequentColorExpandScanlineByteWidth; - int width=pAlp->SubsequentColorExpandScanlineDWordWidth; - CARD32* from; - volatile CARD32 *to; - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentColorExpandScanline\n"); -#endif - - pAlp->SubsequentColorExpandScanlineDest += pCir->pitch; - - to = (CARD32*) pCir->FbBase; - from = (CARD32*) (pCir->ScanlineColorExpandBuffers[bufno]); - WAIT_1; - - /* Width */ - outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20); - outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21); - - /* Height = 1 */ - outw(pCir->PIOReg, 0x22); - outw(pCir->PIOReg, 0x23); - - /* source = CPU ; description of bit 2 of GR30 in the 7548 manual - says that if we do color expansion we must zero the source - address registers (GR2C, GR2D, GR2E) */ - outw(pCir->PIOReg, 0x2C); - outw(pCir->PIOReg, 0x2D); - outw(pCir->PIOReg, 0x2E); - - /* dest */ - outw(pCir->PIOReg, ((dest << 8) & 0xff00) | 0x28); - outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29); - write_mem_barrier(); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentColorExpandScanline (2)\n"); -#endif - - outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A); - if (!pCir->chip.alp->autoStart) - outw(pCir->PIOReg, 0x0231); - - { - int i; - for (i=0; i<width; i++) - *to=*(from++); - write_mem_barrier(); - } - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentColorExpandScanline (3)\n"); -#endif -} -#endif - -static void -AlpAccelEngineInit(ScrnInfoPtr pScrn) -{ - CirPtr pCir = CIRPTR(pScrn); - - outw(pCir->PIOReg, 0x200E); /* enable writes to gr33 */ - /* Setup things for autostart */ - if (pCir->properties & ACCEL_AUTOSTART) { - outw(pCir->PIOReg, 0x8031); /* enable autostart */ - pCir->chip.alp->waitMsk = 0x10; - pCir->chip.alp->autoStart = TRUE; - } else { - pCir->chip.alp->waitMsk = 0x1; - pCir->chip.alp->autoStart = FALSE; - } -} - -Bool -AlpXAAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - XAAInfoRecPtr XAAPtr; - - pCir->InitAccel = AlpAccelEngineInit; -#ifdef ALP_DEBUG - ErrorF("AlpXAAInit\n"); -#endif - - XAAPtr = XAACreateInfoRec(); - if (!XAAPtr) return FALSE; - - /* Pixmap cache */ - XAAPtr->Flags |= LINEAR_FRAMEBUFFER; - XAAPtr->Sync = AlpSync; - - XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; - XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; - XAAPtr->ScreenToScreenCopyFlags = - NO_TRANSPARENCY | NO_PLANEMASK; - - XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; - XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; - XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = NO_PLANEMASK; - - if (pCir->Chipset == PCI_CHIP_GD7548) { - if (pAlp->monoPattern8x8) { - XAAPtr->SetupForMono8x8PatternFill - = AlpSetupForMono8x8PatternFill; - XAAPtr->SubsequentMono8x8PatternFillRect - = AlpSubsequentMono8x8PatternFillRect; - XAAPtr->SubsequentMono8x8PatternFillTrap = NULL; - XAAPtr->Mono8x8PatternFillFlags = - NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | BIT_ORDER_IN_BYTE_MSBFIRST; - } -#if 1 - /* kludge: since XF86 does not support byte-padded - mono bitmaps (only dword-padded), use the - scanline version */ - XAAPtr->SetupForScanlineCPUToScreenColorExpandFill = - AlpSetupForScanlineCPUToScreenColorExpandFill; - XAAPtr->SubsequentScanlineCPUToScreenColorExpandFill = - AlpSubsequentScanlineCPUToScreenColorExpandFill; - XAAPtr->SubsequentColorExpandScanline = - AlpSubsequentColorExpandScanline; - { - const int NumScanlineColorExpandBuffers = 2; - int i; - int buffer_size = (pCir->pScrn->virtualX + 31) & ~31; -#ifdef ALP_DEBUG - ErrorF("Computing buffers for %d pixel lines\n", - pCir->pScrn->virtualX); -#endif - XAAPtr->NumScanlineColorExpandBuffers = - NumScanlineColorExpandBuffers; - XAAPtr->ScanlineColorExpandBuffers = - pCir->ScanlineColorExpandBuffers = (unsigned char **) - (malloc(sizeof(unsigned char *) * - NumScanlineColorExpandBuffers)); - /* TODO: are those mallocs to be freed ? */ - - for(i=0; i<NumScanlineColorExpandBuffers; i++) - pCir->ScanlineColorExpandBuffers[i] = (unsigned char *) - malloc(buffer_size); - } - XAAPtr->ScanlineCPUToScreenColorExpandFillFlags = - NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE; -#endif -#if 0 - /* Currently disabled: XF86 sends DWORD-padded data, - not byte-padded */ - XAAPtr->SetupForCPUToScreenColorExpandFill = - AlpSetupForCPUToScreenColorExpandFill; - XAAPtr->SubsequentCPUToScreenColorExpandFill = - AlpSubsequentCPUToScreenColorExpandFill; - XAAPtr->ColorExpandBase = pCir->FbBase + 4; - XAAPtr->CPUToScreenColorExpandFillFlags = - NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE | - CPU_TRANSFER_PAD_DWORD | CPU_TRANSFER_BASE_FIXED; -#endif - } - - AlpAccelEngineInit(pScrn); - - pCir->AccelInfoRec = XAAPtr; - - if (!XAAInit(pScreen, XAAPtr)) - return FALSE; - - return TRUE; -} -#endif diff --git a/src/alp_xaam.c b/src/alp_xaam.c deleted file mode 100644 index 8e9fd52..0000000 --- a/src/alp_xaam.c +++ /dev/null @@ -1,270 +0,0 @@ -/* (c) Itai Nahshon */ -/* #define DEBUG */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "compiler.h" - -#include "xf86Pci.h" - -#include "vgaHW.h" - -#include "cir.h" -#define _ALP_PRIVATE_ -#include "alp.h" - -#ifdef HAVE_XAA_H -#ifdef DEBUG -#define minb(p) \ - (ErrorF("minb(%X)\n", p),\ - MMIO_IN8(pCir->chip.alp->BLTBase, (p))) -#define moutb(p,v) \ - (ErrorF("moutb(%X, %X)\n", p,v),\ - MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v))) -#define vga_minb(p) \ - (ErrorF("minb(%X)\n", p),\ - MMIO_IN8(hwp->MMIOBase, (hwp->MMIOOffset + (p)))) -#define vga_moutb(p,v) \ - { ErrorF("moutb(%X, %X)\n", p,v);\ - MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v));} -#define minl(p) \ - (ErrorF("minl(%X)\n", p),\ - MMIO_IN32(pCir->chip.alp->BLTBase, (p))) -#define moutl(p,v) \ - (ErrorF("moutl(%X, %X)\n", p,v),\ - MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v))) -#else -#define minb(p) MMIO_IN8(pCir->chip.alp->BLTBase, (p)) -#define moutb(p,v) MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v)) -#define vga_minb(p) MMIO_IN8(hwp->MMIIOBase, (hwp->MMIOOffset + (p))) -#define vga_moutb(p,v) MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v)) -#define minl(p) MMIO_IN32(pCir->chip.alp->BLTBase, (p)) -#define moutl(p,v) MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v)) -#endif - -static const CARD8 translated_rop[] = -{ - /* GXclear */ 0x00U, - /* GXand */ 0x05U, - /* GXandreverse */ 0x09U, - /* GXcopy */ 0x0DU, - /* GXandinversted */ 0x50U, - /* GXnoop */ 0x06U, - /* GXxor */ 0x59U, - /* GXor */ 0x6DU, - /* GXnor */ 0x90U, - /* GXequiv */ 0x95U, - /* GXinvert */ 0x0BU, - /* GXorReverse */ 0xADU, - /* GXcopyInverted */ 0xD0U, - /* GXorInverted */ 0xD6U, - /* GXnand */ 0xDAU, - /* GXset */ 0x0EU -}; - -#define WAIT while(minl(0x40) & pCir->chip.alp->waitMsk){}; -#define WAIT_1 while((minl(0x40)) & 0x1){}; - -static void AlpSync(ScrnInfoPtr pScrn) -{ - CirPtr pCir = CIRPTR(pScrn); -#ifdef ALP_DEBUG - ErrorF("AlpSync mm\n"); -#endif - WAIT_1; - return; -} - -static void -AlpSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, - unsigned int planemask, int trans_color) -{ - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; - - WAIT; - - pCir->chip.alp->transRop = translated_rop[rop] << 16; - -#ifdef ALP_DEBUG - ErrorF("AlpSetupForScreenToScreenCopy xdir=%d ydir=%d rop=%x planemask=%x trans_color=%x\n", - xdir, ydir, rop, planemask, trans_color); -#endif - moutl(0x0C, (pitch << 16) | pitch); - -} - -static void -AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h) -{ - CirPtr pCir = CIRPTR(pScrn); - int source, dest; - int hh, ww; - int decrement = 0; - int pitch = pCir->pitch; - - ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; - hh = (h - 1) & 0x1fff; - dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8; - source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8; - if (dest > source) { - decrement = 1; - dest += hh * pitch + ww; - source += hh * pitch + ww; - } - - WAIT; - - /* Width / Height */ - moutl(0x08, (hh << 16) | ww); - /* source */ - moutl(0x14, source & 0x3fffff); - moutl(0x18, pCir->chip.alp->transRop | decrement); - - /* dest */ - write_mem_barrier(); - moutl(0x10, dest & 0x3fffff); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", - x1, y1, x2, y2, w, h); - ErrorF("AlpSubsequentScreenToScreenCopy s=%d d=%d ww=%d hh=%d\n", - source, dest, ww, hh); -#endif - if (!pCir->chip.alp->autoStart) { - CARD32 val = minl(0x40); - moutl(0x40,val | 0x02); - } - write_mem_barrier(); -} - - -static void -AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; - - WAIT; - -#ifdef ALP_DEBUG - ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n", - color, rop, planemask); -#endif - - moutl(0x04, color & 0xffffff); - - /* Set dest pitch */ - moutl(0x0C, pitch & 0x1fff); - moutl(0x18, (((pScrn->bitsPerPixel - 8) << 1)) - | translated_rop[rop] << 16 - | 0x040000C0); -} - -static void -AlpSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - int dest; - int hh, ww; - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; - - ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; - hh = (h - 1) & 0x7ff; - dest = y * pitch + x * pScrn->bitsPerPixel / 8; - - WAIT; - - /* Width / Height */ - write_mem_barrier(); - moutl(0x08, (hh << 16) | ww); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n", - x, y, w, h); -#endif - /* dest */ - moutl(0x10, (dest & 0x3fffff)); - - if (!pCir->chip.alp->autoStart) { - CARD32 val = minl(0x40); - moutl(0x40, val | 0x02); - } - write_mem_barrier(); -} - -static void -AlpAccelEngineInit(ScrnInfoPtr pScrn) -{ - vgaHWPtr hwp = VGAHWPTR(pScrn); - CirPtr pCir = CIRPTR(pScrn); - - if (pCir->Chipset != PCI_CHIP_GD7548) { - vga_moutb(0x3CE, 0x0E); /* enable writes to gr33 */ - vga_moutb(0x3CF, 0x20); /* enable writes to gr33 */ - } - if (pCir->properties & ACCEL_AUTOSTART) { - moutl(0x40, 0x80); /* enable autostart */ - pCir->chip.alp->waitMsk = 0x10; - pCir->chip.alp->autoStart = TRUE; - } else { - pCir->chip.alp->waitMsk = 0x1; - pCir->chip.alp->autoStart = FALSE; - } -} - -Bool -AlpXAAInitMMIO(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - CirPtr pCir = CIRPTR(pScrn); - XAAInfoRecPtr XAAPtr; - - pCir->InitAccel = AlpAccelEngineInit; -#ifdef ALP_DEBUG - ErrorF("AlpXAAInitMM\n"); -#endif - - XAAPtr = XAACreateInfoRec(); - if (!XAAPtr) return FALSE; - - XAAPtr->Flags |= LINEAR_FRAMEBUFFER; - XAAPtr->Sync = AlpSync; - - XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; - XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; - XAAPtr->ScreenToScreenCopyFlags = - (NO_TRANSPARENCY | NO_PLANEMASK); - - XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; - XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; - XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = NO_PLANEMASK; - - switch (pCir->Chipset) { - case PCI_CHIP_GD5480: - case PCI_CHIP_GD5446: - pCir->chip.alp->BLTBase = pCir->IOBase + 0x100; - break; - default: - pCir->chip.alp->BLTBase = pCir->IOBase; - break; - } - - AlpAccelEngineInit(pScrn); - - pCir->AccelInfoRec = XAAPtr; - - if (!XAAInit(pScreen, XAAPtr)) - return FALSE; - - return TRUE; -} - -#endif @@ -4,9 +4,6 @@ #define CIR_H #include "xf86Cursor.h" -#ifdef HAVE_XAA_H -#include "xaa.h" -#endif #include "xf86i2c.h" #include <string.h> #include <stdlib.h> @@ -48,9 +45,6 @@ typedef struct { Bool NoAccel; Bool HWCursor; Bool UseMMIO; -#ifdef HAVE_XAA_H - XAAInfoRecPtr AccelInfoRec; -#endif xf86CursorInfoPtr CursorInfoRec; int DGAnumModes; DGAModePtr DGAModes; diff --git a/src/cir_dga.c b/src/cir_dga.c index bf3a9dd..92d32da 100644 --- a/src/cir_dga.c +++ b/src/cir_dga.c @@ -30,10 +30,6 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Pci.h" -#ifdef HAVE_XAA_H -#include "xaa.h" -#include "xaalocal.h" -#endif #include "vgaHW.h" #include "cir.h" #include "dgaproc.h" @@ -43,15 +39,6 @@ static Bool Cir_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, static Bool Cir_SetMode(ScrnInfoPtr, DGAModePtr); static int Cir_GetViewport(ScrnInfoPtr); static void Cir_SetViewport(ScrnInfoPtr, int, int, int); -#ifdef HAVE_XAA_H -static void Cir_Sync(ScrnInfoPtr); -static void Cir_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); -static void Cir_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -/* -static void Cir_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -*/ -#endif static DGAFunctionRec CirDGAFuncs = { @@ -60,13 +47,7 @@ DGAFunctionRec CirDGAFuncs = { Cir_SetMode, Cir_SetViewport, Cir_GetViewport, -#ifdef HAVE_XAA_H - Cir_Sync, - Cir_FillRect, - Cir_BlitRect, -#else NULL, NULL, NULL, -#endif NULL /* Cir_BlitTransRect */ }; @@ -215,50 +196,3 @@ Cir_GetViewport( return pCir->DGAViewportStatus; } -#ifdef HAVE_XAA_H -static void -Cir_Sync( - ScrnInfoPtr pScrn -){ - CirPtr pCir = CIRPTR(pScrn); - if(pCir->AccelInfoRec) { - (*pCir->AccelInfoRec->Sync)(pScrn); - } -} - -static void -Cir_FillRect ( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned long color -){ - CirPtr pCir = CIRPTR(pScrn); - - if(pCir->AccelInfoRec) { - (*pCir->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*pCir->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(pCir->AccelInfoRec); - } -} - -static void -Cir_BlitRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty -){ - CirPtr pCir = CIRPTR(pScrn); - - if(pCir->AccelInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pCir->AccelInfoRec->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, ~0, -1); - (*pCir->AccelInfoRec->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pCir->AccelInfoRec); - } -} -#endif diff --git a/src/cir_driver.c b/src/cir_driver.c index b18a7e8..bc1e4b3 100644 --- a/src/cir_driver.c +++ b/src/cir_driver.c @@ -19,11 +19,6 @@ #include "xf86.h" #include "xf86_OSproc.h" -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 -#include "xf86Resources.h" -#endif -/* All drivers need this */ - /* Drivers that need to access the PCI config space directly need this */ #include "xf86Pci.h" @@ -230,11 +225,7 @@ CIRProbe(DriverPtr drv, int flags) pPci->device_id, pPci->bus, pPci->domain, pPci->dev, pPci->func); xf86DrvMsg(0, X_ERROR, "cirrus: This driver cannot operate until it has been unloaded.\n"); -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 13 - xf86UnclaimPciSlot(pPci); -#else xf86UnclaimPciSlot(pPci, devSections[0]); -#endif free(devSections); return FALSE; } @@ -58,10 +58,6 @@ typedef struct { /* lg_driver.c */ extern LgLineDataRec LgLineData[]; -#ifdef HAVE_XAA_H -/* lg_xaa.c */ -extern Bool LgXAAInit(ScreenPtr pScreen); -#endif /* lg_hwcurs.c */ extern Bool LgHWCursorInit(ScreenPtr pScreen); diff --git a/src/lg_xaa.h b/src/lg_blit.h index cd8fc93..b5edd90 100644 --- a/src/lg_xaa.h +++ b/src/lg_blit.h @@ -1,8 +1,8 @@ -#ifndef __LG_XAA_H -#define __LG_XAA_H +#ifndef __LG_BLIT_H +#define __LG_BLIT_H /* - * XAA acceleration for CL-GD546x -- The Laugna family + * bitBLT acceleration for CL-GD546x -- The Laguna family * * lg_xaa.h * @@ -176,4 +176,4 @@ enum { /* Select transparency compare */ -#endif /* __LG_XAA_H */ +#endif /* __LG_BLIT_H */ diff --git a/src/lg_driver.c b/src/lg_driver.c index b08c152..5ecdbd7 100644 --- a/src/lg_driver.c +++ b/src/lg_driver.c @@ -44,11 +44,6 @@ */ #include "vgaHW.h" -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 -#include "xf86RAC.h" -#include "xf86Resources.h" -#endif - /* * All drivers initialising the SW cursor need this. */ @@ -433,12 +428,7 @@ LgPreInit(ScrnInfoPtr pScrn, int flags) pCir = CIRPTR(pScrn); pCir->pScrn = pScrn; - -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - pCir->PIOReg = hwp->PIOOffset + 0x3CE; -#else - pCir->PIOReg = 0x3CE; -#endif + pCir->PIOReg = 0x3CE; /* was hwp->PIOOffset + 0x3CE */ /* * Get the entity, and make sure it is PCI. @@ -974,35 +964,21 @@ LgPreInit(ScrnInfoPtr pScrn, int flags) xf86SetDpi(pScrn, 0, 0); /* - * Load bpp-specific modules. + * Load fb module. */ - switch (pScrn->bitsPerPixel) { - case 8: - case 16: - case 24: - case 32: - if (xf86LoadSubModule(pScrn, "fb") == NULL) { - LgFreeRec(pScrn); - return FALSE; - } - break; + if (xf86LoadSubModule(pScrn, "fb") == NULL) { + LgFreeRec(pScrn); + return FALSE; } /* - * Load XAA if needed. + * Use shadowfb for acceleration. */ if (!pCir->NoAccel) { -#ifdef HAVE_XAA_H - if (!xf86LoadSubModule(pScrn, "xaa")) -#else - if (1) -#endif - { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Falling back to shadowfb\n"); - pCir->NoAccel = TRUE; - pCir->shadowFB = TRUE; - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Falling back to shadowfb\n"); + pCir->NoAccel = TRUE; + pCir->shadowFB = TRUE; } /* @@ -1763,16 +1739,6 @@ LgScreenInit(SCREEN_INIT_ARGS_DECL) */ xf86SetBlackWhitePixels(pScreen); -#ifdef HAVE_XAA_H - /* - * Initialize XAA functions. - */ - if (!pCir->NoAccel) { - if (!LgXAAInit(pScreen)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Could not initialize XAA\n"); - } -#endif #if 1 pCir->DGAModeInit = LgModeInit; if (!CirDGAInit(pScreen)) @@ -2046,12 +2012,6 @@ LgCloseScreen(CLOSE_SCREEN_ARGS_DECL) CirUnmapMem(pCir, pScrn->scrnIndex); } -#ifdef HAVE_XAA_H - if (pCir->AccelInfoRec) - XAADestroyInfoRec(pCir->AccelInfoRec); - pCir->AccelInfoRec = NULL; -#endif - if (pCir->CursorInfoRec) xf86DestroyCursorInfoRec(pCir->CursorInfoRec); pCir->CursorInfoRec = NULL; diff --git a/src/lg_hwcurs.c b/src/lg_hwcurs.c index 51862b2..7d085ec 100644 --- a/src/lg_hwcurs.c +++ b/src/lg_hwcurs.c @@ -26,7 +26,7 @@ #include "cir.h" #define _LG_PRIVATE_ #include "lg.h" -#include "lg_xaa.h" /* For BitBLT engine macros */ +#include "lg_blit.h" /* For BitBLT engine macros */ /* #define LG_CURSOR_DEBUG diff --git a/src/lg_xaa.c b/src/lg_xaa.c deleted file mode 100644 index 2bb836d..0000000 --- a/src/lg_xaa.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * XAA acceleration for CL-GD546x -- The Laugna family - * - * lg_xaa.c - * - * (c) 1998 Corin Anderson. - * corina@the4cs.com - * Tukwila, WA - * - * Much of this code is inspired by the XAA acceleration from XFree86 - * 3.3.3, laguna_acl.c - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "compiler.h" - -#include "xf86Pci.h" - -#include "vgaHW.h" - -#include "cir.h" -#define _LG_PRIVATE_ -#include "lg.h" - -#ifdef HAVE_XAA_H -#include "lg_xaa.h" - -/* Laguna raster operations, source is OP1 and destination is OP0. */ -/* The order in this array is important! */ -static int lgRop[16] = { - /* Lg Op X name */ - - 0x00, /* 0 GXclear */ - 0x88, /* S.D GXand */ - 0x44, /* S.~D GXandReverse */ - 0xCC, /* S GXcopy */ - 0x22, /* ~S.D GXandInverted */ - 0xAA, /* D GXnoop */ - 0x66, /* S~=D GXxor */ - 0xEE, /* S+D GXor */ - 0x77, /* ~S.~D GXnor */ - 0x99, /* S=D GXequiv */ - 0x55, /* ~D GXinvert */ - 0xDD, /* S+~D GXorReverse */ - 0x33, /* ~S GXcopyInverted */ - 0xBB, /* ~S+D GXorInverted */ - 0x11, /* ~S+~D GXnand */ - 0xFF /* 1 GXset */ -}; - -#if 0 -/* Laguna raster operations, source is OP2 and destination is OP0. */ -static int lgPatRop[16] = { - /* Lg Op X name */ - - 0x00, /* 0 GXclear */ - 0xA0, /* S.D GXand */ - 0x50, /* S.~D GXandReverse */ - 0xF0, /* S GXcopy */ - 0x0A, /* ~S.D GXandInverted */ - 0xAA, /* D GXnoop */ - 0x5A, /* S~=D GXxor */ - 0xFA, /* S+D GXor */ - 0x05, /* ~S.~D GXnor */ - 0xA5, /* S=D GXequiv */ - 0x55, /* ~D GXinvert */ - 0xF5, /* S+~D GXorReverse */ - 0x0F, /* ~S GXcopyInverted */ - 0xAF, /* ~S+D GXorInverted */ - 0x5F, /* ~S+~D GXnand */ - 0xFF /* 1 GXset */ -}; -#endif - - -static void LgSetBitmask(CirPtr pCir, const CARD32 m); -static void LgWaitQAvail(CirPtr pCir, int n); -static CARD32 LgExpandColor(CARD32 color, int bpp); -static void LgSync(ScrnInfoPtr pScrn); -static void LgSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); - -static void LgSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h); -static void LgSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int transparency_color); -static void LgSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, - int x2, int y2, int w, int h); - - -/**************************************************** LgXAAInit *****/ - -Bool -LgXAAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - CirPtr pCir = CIRPTR(pScrn); - XAAInfoRecPtr XAAPtr; - - XAAPtr = XAACreateInfoRec(); - if (!XAAPtr) - return FALSE; - - /* - * Solid color fills. - */ - XAAPtr->SetupForSolidFill = LgSetupForSolidFill; - XAAPtr->SubsequentSolidFillRect = LgSubsequentSolidFillRect; - XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = 0; - - /* - * Screen-to-screen copies. - */ - XAAPtr->SetupForScreenToScreenCopy = LgSetupForScreenToScreenCopy; - XAAPtr->SubsequentScreenToScreenCopy = LgSubsequentScreenToScreenCopy; - /* Maybe ONLY_LEFT_TO_RIGHT_BITBLT or ONLY_TWO_BITBLT_DIRECTIONS? */ - XAAPtr->ScreenToScreenCopyFlags = ONLY_LEFT_TO_RIGHT_BITBLT; - - /* - * Miscellany. - */ - XAAPtr->Sync = LgSync; - - pCir->AccelInfoRec = XAAPtr; - - if (!XAAInit(pScreen, XAAPtr)) - return FALSE; - - return TRUE; -} - -/******************************************** Lg XAA helper functions ***/ - -/* - * The bitmask is usually all 1's, so it's silly to spend a DWORD write - * to program the register with the same value each time. Bitmask is - * about the only register whose value is worth shadowing, so we special- - * case it. - */ -static void -LgSetBitmask(CirPtr pCir, const CARD32 m) -{ - const LgPtr pLg = LGPTR(pCir); - - if (m != pLg->oldBitmask) { - LgSETBITMASK(m); - pLg->oldBitmask = m; - } -} - -/* - * Return from the function only when there's room somewhere for the - * upcoming register writes. That means that either PCI retry is enabled - * (i.e., we let the PCI bus buffer the register writes), or we wait for - * room in the Laguna's command queue explicitly. - */ -static void -LgWaitQAvail(CirPtr pCir, int n) -{ - if (!0/*lgUsePCIRetry*/) { - CARD8 qfree; - - /* Wait until n entries are open in the command queue */ - do - qfree = *(volatile CARD8 *)(pCir->IOBase + QFREE); - while (qfree < n); - } -} - - -/* We might want to make this a macro at some point. */ -static CARD32 -LgExpandColor(CARD32 color, int bpp) -{ - if (8 == bpp) - color = ((color&0xFF) << 8) | (color&0xFF); - - if (8 == bpp || 16 == bpp) - color = ((color&0xFFFF) << 16) | (color&0xFFFF); - - return color; -} - - -/*************************************************** Lg XAA functions ***/ - - -static void -LgSync(ScrnInfoPtr pScrn) -{ - const CirPtr pCir = CIRPTR(pScrn); -#if 0 - LgPtr pLg = LGPTR(pScrn); -#endif - - while (!LgREADY()) - ; -} - -static void -LgSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - - const CirPtr pCir = CIRPTR(pScrn); - - color = LgExpandColor(color, pScrn->bitsPerPixel); - - LgWaitQAvail(pCir, 4); - - LgSETBACKGROUND(color); - LgSETROP(lgRop[rop]); - LgSETMODE(SCR2SCR | COLORFILL); - LgSetBitmask(pCir, planemask); -} - -static void -LgSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - const CirPtr pCir = CIRPTR(pScrn); - - /* Wait for room in the command queue. */ - LgWaitQAvail(pCir, 2); - - LgSETDSTXY(x, y); - LgSETEXTENTS(w, h); -} - -static void -LgSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, int transparency_color) -{ - int bltmode = 0; - const CirPtr pCir = CIRPTR(pScrn); - const LgPtr pLg = LGPTR(pCir); - - pLg->blitTransparent = (transparency_color != -1); - pLg->blitYDir = ydir; - - LgWaitQAvail(pCir, 4); - - /* We set the rop up here because the LgSETROP macro conveniently - (really -- it is convenient!) clears the transparency bits - in DRAWDEF. We'll set those bits appropriately later. */ - LgSETROP(lgRop[rop]); - - if (ydir < 0) - bltmode |= BLITUP; - if (pLg->blitTransparent) { - /* Gotta extend the transparency_color to the full 32-bit - size of the register. */ - transparency_color = LgExpandColor(transparency_color, - pScrn->bitsPerPixel); - - bltmode |= COLORTRANS; - LgSETBACKGROUND(transparency_color); - LgSETTRANSPARENCY(TRANSEQ); - } else { - LgSETTRANSPARENCY(TRANSNONE); - } - - LgSETMODE(SCR2SCR | COLORSRC | bltmode); - LgSetBitmask(pCir, planemask); -} - -static void -LgSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, - int x2, int y2, int w, int h) -{ - const CirPtr pCir = CIRPTR(pScrn); - const LgPtr pLg = LGPTR(pCir); - - /* - * We have set the flag indicating that xdir must be one, - * so we can assume that here. - */ - if (pLg->blitYDir == -1) { - y1 += h - 1; - y2 += h - 1; - } - - if (pLg->blitTransparent) { - /* We're doing a transparent blit. We'll need to point - OP2 to the color compare mask. */ - LgWaitQAvail(pCir, 4); - LgSETTRANSMASK(x1, y1); - } else { - LgWaitQAvail(pCir, 3); - } - LgSETSRCXY(x1, y1); - LgSETDSTXY(x2, y2); - LgSETEXTENTS(w, h); -} -#endif |