diff options
author | George Sapountzis <gsap7@yahoo.gr> | 2006-11-20 15:09:41 +0200 |
---|---|---|
committer | George Sapountzis <gsap7@yahoo.gr> | 2007-01-21 19:42:14 +0200 |
commit | df42a7a27d916c3bf8618c1c467244d540d0d3df (patch) | |
tree | c58e90096669c372c69d0da2869b513892adfeab | |
parent | 805674dc70be16a04fc07387b69189c3a900e9e0 (diff) |
Banked memory is no longer needed.
- (pATI->BankInfo.BankSize = 0) in all cases, cull pATI->BankInfo
- only keep the minimal pATIHW.SetBank interface for save/restore
- clean ATISwap() a little, (NewHW.crtc != ATI_CRTC_VGA)
- (UseSmallApertures == TRUE) <=> pATI->VGAAdapter
-rw-r--r-- | src/atibank.c | 197 | ||||
-rw-r--r-- | src/atibank.h | 31 | ||||
-rw-r--r-- | src/aticonsole.c | 8 | ||||
-rw-r--r-- | src/atidga.c | 13 | ||||
-rw-r--r-- | src/atimach64.c | 2 | ||||
-rw-r--r-- | src/atimach64accel.c | 11 | ||||
-rw-r--r-- | src/atimode.c | 23 | ||||
-rw-r--r-- | src/atipreinit.c | 80 | ||||
-rw-r--r-- | src/atiscreen.c | 29 | ||||
-rw-r--r-- | src/atistruct.h | 3 | ||||
-rw-r--r-- | src/ativga.c | 2 | ||||
-rw-r--r-- | src/atividmem.c | 5 |
12 files changed, 26 insertions, 378 deletions
diff --git a/src/atibank.c b/src/atibank.c index c53cc54..514a414 100644 --- a/src/atibank.c +++ b/src/atibank.c @@ -32,93 +32,6 @@ #ifndef AVOID_CPIO /* - * ATI VGA Wonder V4 and V5 adapters use an ATI 18800-1 chip. Bank selection - * is done with ATI extended VGA register index 0xB2. The format is: - * - * 0xE0 - Read bank select bits 0x07 - * 0x1E - Write bank select bits 0x0F - * 0x01 - Read bank select bit 0x08. - */ - -/* - * ATIV4V5SetBank -- - * - * Set an ATI 18800-1's read and write bank numbers. - */ -void -ATIV4V5SetBank -( - ATIPtr pATI, - unsigned int iBank -) -{ - pATI->B2Reg = SetBits(iBank, 0x1EU) | SetBits(iBank, 0xE0U) | - SetBits(GetBits(iBank, 0x08U), 0x01U); - ATIPutExtReg(0xB2U, pATI->B2Reg); -} - -/* - * ATIV4V5SetRead -- - * - * Set an ATI 18800-1's read bank number. - */ -int -ATIV4V5SetRead -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); - CARD8 B2Reg = (pATI->B2Reg & 0x1EU) | SetBits(iBank, 0xE0U) | - SetBits(GetBits(iBank, 0x08U), 0x01U); - - if (B2Reg != pATI->B2Reg) - { - ATIPutExtReg(0xB2U, B2Reg); - pATI->B2Reg = B2Reg; - } - - return 0; -} - -/* - * ATIV4V5SetWrite -- - * - * Set an ATI 18800-1's write bank number. - */ -int -ATIV4V5SetWrite -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); - CARD8 B2Reg = (pATI->B2Reg & 0xE1U) | SetBits(iBank, 0x1EU); - - if (B2Reg != pATI->B2Reg) - { - ATIPutExtReg(0xB2U, B2Reg); - pATI->B2Reg = B2Reg; - } - return 0; -} - -/* - * In addition to ATI extended register index 0xB2, 28800's, 68800's and - * 88800's define banking bits in bits 0x0F of ATI extended VGA register index - * 0xAE. These are only needed for adapters with more than 1MB of video - * memory, and it is questionable whether or not they are actually implemented - * by 28800's and 88800's. ATI extended VGA register index 0xAE is defined as - * follows: - * - * 0xF0 - reserved - * 0x0C - read bank select bits 0x30 - * 0x03 - write bank select bits 0x30 - */ - -/* * ATIx8800SetBank -- * * Set an ATI 28800's, 68800's or 88800's read and write bank numbers. @@ -130,62 +43,10 @@ ATIx8800SetBank unsigned int iBank ) { - ATIV4V5SetBank(pATI, iBank); - iBank = GetBits(iBank, 0x30U); - ATIModifyExtReg(pATI, 0xAEU, -1, (CARD8)(~0x0FU), - SetBits(iBank, 0x03U) | SetBits(iBank, 0x0CU)); -} + (void)iBank; /* always called with iBank = 0 */ -/* - * ATIx8800SetRead -- - * - * Set an ATI 28800's, 68800's or 88800's read bank numbers. - */ -int -ATIx8800SetRead -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - (void)ATIV4V5SetRead(pScreen, iBank); - ATIModifyExtReg(ATIPTR(XF86SCRNINFO(pScreen)), 0xAEU, -1, (CARD8)(~0x0CU), - SetBits(GetBits(iBank, 0x30U), 0x0CU)); - return 0; -} - -/* - * ATIx8800SetWrite -- - * - * Set an ATI 28800's, 68800's or 88800's write bank numbers. - */ -int -ATIx8800SetWrite -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - (void)ATIV4V5SetWrite(pScreen, iBank); - ATIModifyExtReg(ATIPTR(XF86SCRNINFO(pScreen)), 0xAEU, -1, (CARD8)(~0x03U), - SetBits(GetBits(iBank, 0x30U), 0x03U)); - return 0; -} - -/* - * ATIx8800SetReadWrite -- - * - * Set an ATI 28800's, 68800's or 88800's read and write bank numbers. - */ -int -ATIx8800SetReadWrite -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - ATIx8800SetBank(ATIPTR(XF86SCRNINFO(pScreen)), iBank); - return 0; + ATIPutExtReg(0xB2U, 0x00U); + ATIModifyExtReg(pATI, 0xAEU, -1, (CARD8)(~0x0FU), 0x00U); } /* @@ -222,58 +83,6 @@ ATIMach64SetBankPacked outr(MEM_VGA_WP_SEL, tmp); } -/* - * ATIMach64SetReadPacked -- - * - * Set read bank number for small dual paged apertures. - */ -int -ATIMach64SetReadPacked -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); - - outr(MEM_VGA_RP_SEL, ATIMach64MassagePackedBankNumber(iBank)); - return 0; -} - -/* - * ATIMach64SetWritePacked -- - * - * Set write bank number for small dual paged apertures. - */ -int -ATIMach64SetWritePacked -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - ATIPtr pATI = ATIPTR(XF86SCRNINFO(pScreen)); - - outr(MEM_VGA_WP_SEL, ATIMach64MassagePackedBankNumber(iBank)); - return 0; -} - -/* - * ATIMach64SetReadWritePacked -- - * - * Set read and write bank numbers for small dual paged apertures. - */ -int -ATIMach64SetReadWritePacked -( - ScreenPtr pScreen, - unsigned int iBank -) -{ - ATIMach64SetBankPacked(ATIPTR(XF86SCRNINFO(pScreen)), iBank); - return 0; -} - static CARD32 ATIMach64MassagePlanarBankNumber ( diff --git a/src/atibank.h b/src/atibank.h index d50aa68..d56da68 100644 --- a/src/atibank.h +++ b/src/atibank.h @@ -25,37 +25,9 @@ #include "atipriv.h" -#include "mibank.h" - #ifndef AVOID_CPIO /* - * Banking definitions. - */ - -/* - * Bank selection functions for VGA Wonder V4 and V5 adapters. - */ -extern miBankProc ATIV4V5SetRead, - ATIV4V5SetWrite; - -/* - * Bank selection functions for 28800-x, 68800-x and 88800 based adapters. - */ -extern miBankProc ATIx8800SetRead, - ATIx8800SetWrite, - ATIx8800SetReadWrite; - -/* - * Bank selection functions used to simulate a banked VGA aperture with a - * Mach64's small dual paged apertures. There are two sets of these: one for - * packed modes, and one for planar modes. - */ -extern miBankProc ATIMach64SetReadPacked, - ATIMach64SetWritePacked, - ATIMach64SetReadWritePacked; - -/* * The CRT save/restore code also needs a separate banking interface that can * used before ATIScreenInit() is called. */ @@ -63,8 +35,7 @@ extern miBankProc ATIMach64SetReadPacked, typedef void ATIBankProc(ATIPtr, unsigned int); typedef ATIBankProc *ATIBankProcPtr; -extern ATIBankProc ATIV4V5SetBank, - ATIx8800SetBank, +extern ATIBankProc ATIx8800SetBank, ATIMach64SetBankPacked, ATIMach64SetBankPlanar; diff --git a/src/aticonsole.c b/src/aticonsole.c index 033b1e7..a264c25 100644 --- a/src/aticonsole.c +++ b/src/aticonsole.c @@ -732,14 +732,6 @@ ATIEnterVT return TRUE; } -#ifndef AVOID_CPIO - - /* If used, modify banking interface */ - if (!miModifyBanking(pScreen, &pATI->BankInfo)) - return FALSE; - -#endif /* AVOID_CPIO */ - pScreenPixmap = (*pScreen->GetScreenPixmap)(pScreen); PixmapPrivate = pScreenPixmap->devPrivate; if (!PixmapPrivate.ptr) diff --git a/src/atidga.c b/src/atidga.c index d866e36..e6783a4 100644 --- a/src/atidga.c +++ b/src/atidga.c @@ -414,19 +414,6 @@ ATIDGAInit if (!pATI->nDGAMode) { - -#ifndef AVOID_CPIO - - /* - * Contrary to previous extension versions, DGA 2 does not support - * banked framebuffers. Also, disable DGA when non-DGA server modes - * are planar. - */ - if (pATI->BankInfo.BankSize) - return FALSE; - -#endif /* AVOID_CPIO */ - /* Set up DGA callbacks */ pATI->ATIDGAFunctions.OpenFramebuffer = ATIDGAOpenFramebuffer; pATI->ATIDGAFunctions.SetMode = ATIDGASetMode; diff --git a/src/atimach64.c b/src/atimach64.c index 5aee170..ffda885 100644 --- a/src/atimach64.c +++ b/src/atimach64.c @@ -146,7 +146,7 @@ ATIMach64PreInit #ifndef AVOID_CPIO - if (pATI->UseSmallApertures) + if (pATI->VGAAdapter) { pATIHW->config_cntl |= CFG_MEM_VGA_AP_EN; } diff --git a/src/atimach64accel.c b/src/atimach64accel.c index e1908b1..090ae78 100644 --- a/src/atimach64accel.c +++ b/src/atimach64accel.c @@ -981,16 +981,7 @@ ATIMach64AccelInit if (pATI->XModifier == 1) { pXAAInfo->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS; - -#ifndef AVOID_CPIO - - if (!pATI->BankInfo.BankSize) - -#endif /* AVOID_CPIO */ - - { - pXAAInfo->Flags |= LINEAR_FRAMEBUFFER; - } + pXAAInfo->Flags |= LINEAR_FRAMEBUFFER; } /* Sync */ diff --git a/src/atimode.c b/src/atimode.c index 36d548f..f5979d6 100644 --- a/src/atimode.c +++ b/src/atimode.c @@ -230,16 +230,6 @@ ATISwap /* Back to bank 0 */ (*pATIHW->SetBank)(pATI, 0); - - /* - * If restoring video memory for a server video mode, free the frame buffer - * save area. - */ - if (ToFB && (pATIHW == &pATI->NewHW)) - { - xfree(pATIHW->frame_buffer); - pATIHW->frame_buffer = NULL; - } } #endif /* AVOID_CPIO */ @@ -505,25 +495,16 @@ ATIModeSave /* Save RAMDAC state */ ATIDACSave(pATI, pATIHW); - /* - * The server has already saved video memory contents when switching out of - * its virtual console, so don't do it again. - */ if (pATIHW != &pATI->NewHW) { pATIHW->FeedbackDivider = 0; /* Don't programme clock */ + } #ifndef AVOID_CPIO /* Save video memory */ ATISwap(pScreenInfo->scrnIndex, pATI, pATIHW, FALSE); -#endif /* AVOID_CPIO */ - - } - -#ifndef AVOID_CPIO - if (pATI->VGAAdapter) ATIVGASaveScreen(pATI, SCREEN_SAVER_OFF); /* Turn on screen */ @@ -1037,7 +1018,7 @@ ATIModeSet #ifndef AVOID_CPIO - if (pATI->UseSmallApertures) + if (pATI->VGAAdapter) { /* Oddly enough, these need to be set also, maybe others */ PutReg(SEQX, 0x02U, pATIHW->seq[2]); diff --git a/src/atipreinit.c b/src/atipreinit.c index 7d77eec..9b48eb0 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -472,16 +472,6 @@ ATIPreInit /* Finish private area initialisation */ pATI->DAC = ATI_DAC_GENERIC; -#ifndef AVOID_CPIO - - pATI->NewHW.SetBank = ATIx8800SetBank; - pATI->BankInfo.SetSourceBank = ATIx8800SetRead; - pATI->BankInfo.SetDestinationBank = ATIx8800SetWrite; - pATI->BankInfo.SetSourceAndDestinationBanks = ATIx8800SetReadWrite; - pATI->BankInfo.BankSize = 0x00010000U; /* 64kB */ - -#endif /* AVOID_CPIO */ - pATI->LCDPanelID = -1; pATI->nFIFOEntries = 16; /* For now */ pATI->Audio = ATI_AUDIO_NONE; @@ -2000,24 +1990,6 @@ ATIPreInit } } -#ifndef AVOID_CPIO - - if (pATI->VGAAdapter) - { - pATI->UseSmallApertures = TRUE; - - /* Set banking functions */ - { - pATI->NewHW.SetBank = ATIMach64SetBankPacked; - pATI->BankInfo.SetSourceBank = ATIMach64SetReadPacked; - pATI->BankInfo.SetDestinationBank = ATIMach64SetWritePacked; - pATI->BankInfo.SetSourceAndDestinationBanks = - ATIMach64SetReadWritePacked; - } - } - -#endif /* AVOID_CPIO */ - if (!pATI->LinearBase || !pATI->LinearSize) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, @@ -2104,40 +2076,36 @@ ATIPreInit if (!pATI->VGAAdapter) { + pATI->NewHW.SetBank = ATIx8800SetBank; + pATI->NewHW.nPlane = 0; + pATIHW->crtc = pATI->NewHW.crtc; pATIHW->SetBank = (ATIBankProcPtr)NoopDDA; - pATI->BankInfo.BankSize = 0; /* No banking */ } else { + Bool ext_disp_en = (pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN); + Bool vga_ap_en = (pATI->LockData.config_cntl & CFG_MEM_VGA_AP_EN); + Bool vga_color_256 = (GetReg(SEQX, 0x04U) & 0x08U); + + pATI->NewHW.SetBank = ATIMach64SetBankPacked; + pATI->NewHW.nPlane = 1; + pATIHW->crtc = ATI_CRTC_VGA; - if ((pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN)) - { - pATIHW->crtc = ATI_CRTC_MACH64; - } - { - pATI->BankInfo.nBankDepth = pATI->depth; - pATI->NewHW.nPlane = 1; - } + if (ext_disp_en) + pATIHW->crtc = ATI_CRTC_MACH64; - if ((pATIHW->crtc != ATI_CRTC_VGA) || (GetReg(SEQX, 0x04U) & 0x08U)) + if ((pATIHW->crtc != ATI_CRTC_VGA) || vga_color_256) pATIHW->nPlane = 1; else pATIHW->nPlane = 4; - pATIHW->nBank = ATIDivide(pATI->VideoRAM, - pATIHW->nPlane * pATI->BankInfo.BankSize, 10, 1); - pATI->NewHW.nBank = ATIDivide(pATI->VideoRAM, - pATI->NewHW.nPlane * pATI->BankInfo.BankSize, 10, 1); + /* VideoRAM is a multiple of 512kB and BankSize is 64kB */ + pATIHW->nBank = pATI->VideoRAM / (pATIHW->nPlane * 0x40U); - if (!pATI->UseSmallApertures) - { - pATIHW->SetBank = pATI->NewHW.SetBank; - } - else if ((pATIHW->crtc == ATI_CRTC_VGA) && - !(pATI->LockData.config_cntl & CFG_MEM_VGA_AP_EN)) + if ((pATIHW->crtc == ATI_CRTC_VGA) && !vga_ap_en) { pATIHW->SetBank = (ATIBankProcPtr)NoopDDA; pATIHW->nBank = 1; @@ -2150,10 +2118,6 @@ ATIPreInit { pATIHW->SetBank = ATIMach64SetBankPlanar; } - - if (((ApertureSize * pATI->depth) / pATI->BankInfo.nBankDepth) >= - (unsigned)(pScreenInfo->videoRam * 1024)) - pATI->BankInfo.BankSize = 0; /* No banking */ } #else /* AVOID_CPIO */ @@ -2168,18 +2132,6 @@ ATIPreInit { /* Until ShadowFB becomes a true screen wrapper, if it ever does... */ -#ifndef AVOID_CPIO - - if (pATI->BankInfo.BankSize) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Cannot shadow a banked frame buffer.\n"); - pATI->OptionShadowFB = FALSE; - } - else - -#endif /* AVOID_CPIO */ - if (pATI->OptionAccel) { xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, diff --git a/src/atiscreen.c b/src/atiscreen.c index b9984ae..e849941 100644 --- a/src/atiscreen.c +++ b/src/atiscreen.c @@ -63,7 +63,6 @@ #include "fb.h" -#include "mibank.h" #include "micmap.h" #include "mipointer.h" @@ -136,11 +135,6 @@ ATIMach64SetupMemXAA_NoDRI int maxScanlines = ATIMach64MaxY; int maxPixelArea, PixelArea; -#ifndef AVOID_CPIO - - if (!pATI->BankInfo.BankSize) - -#endif /* AVOID_CPIO */ { /* * Note: If PixelArea exceeds the engine's maximum, the excess is @@ -500,19 +494,6 @@ ATIScreenInit "RENDER extension not supported with a shadowed" " framebuffer.\n"); } - -#ifndef AVOID_CPIO - - else if (pATI->BankInfo.BankSize) - { - if (serverGeneration == 1) - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "RENDER extension not supported with a banked" - " framebuffer.\n"); - } - -#endif /* AVOID_CPIO */ - else if (!fbPictureInit(pScreen, NULL, 0) && (serverGeneration == 1)) { @@ -523,16 +504,6 @@ ATIScreenInit xf86SetBlackWhitePixels(pScreen); -#ifndef AVOID_CPIO - - /* Initialise banking if needed */ - if (!miInitializeBanking(pScreen, - pScreenInfo->virtualX, pScreenInfo->virtualY, - pATI->displayWidth, &pATI->BankInfo)) - return FALSE; - -#endif /* AVOID_CPIO */ - #ifdef USE_XAA if (!pATI->useEXA) { diff --git a/src/atistruct.h b/src/atistruct.h index 0cf88ba..f652576 100644 --- a/src/atistruct.h +++ b/src/atistruct.h @@ -250,7 +250,6 @@ typedef struct _ATIRec * Processor I/O port definitions for VGA Wonder. */ IOADDRESS CPIO_VGAWonder; - CARD8 B2Reg; /* The B2 mirror */ #endif /* AVOID_CPIO */ @@ -305,9 +304,7 @@ typedef struct _ATIRec /* * Banking interface. */ - miBankInfoRec BankInfo; pointer pBank; - CARD8 UseSmallApertures; #endif /* AVOID_CPIO */ diff --git a/src/ativga.c b/src/ativga.c index 391ea72..8f4b0da 100644 --- a/src/ativga.c +++ b/src/ativga.c @@ -74,7 +74,7 @@ ATIVGAPreInit /* Initialise graphics controller register values */ if (pATI->Chip >= ATI_CHIP_264CT) pATIHW->gra[5] = 0x40U; - if (pATI->UseSmallApertures && (pATI->Chip >= ATI_CHIP_264VT)) + if (pATI->Chip >= ATI_CHIP_264VT) pATIHW->gra[6] = 0x01U; /* 128kB aperture */ else pATIHW->gra[6] = 0x05U; /* 64kB aperture */ diff --git a/src/atividmem.c b/src/atividmem.c index 89e164d..99560f5 100644 --- a/src/atividmem.c +++ b/src/atividmem.c @@ -86,7 +86,7 @@ ATIUnmapVGA xf86UnMapVidMem(iScreen, pATI->pBank, 0x00010000U); - pATI->pBank = pATI->BankInfo.pBankA = pATI->BankInfo.pBankB = NULL; + pATI->pBank = NULL; } #endif /* AVOID_CPIO */ @@ -193,9 +193,6 @@ ATIMapApertures if (!pATI->pBank) return FALSE; - pATI->BankInfo.pBankA = - pATI->BankInfo.pBankB = pATI->pBank; - pATI->Mapped = TRUE; } |