summaryrefslogtreecommitdiff
path: root/src/apm_driver.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2010-06-04 17:10:07 -0400
committerAdam Jackson <ajax@redhat.com>2010-06-04 17:29:49 -0400
commit413eee03287b6e161ce0337df712099b585aa722 (patch)
tree860f9dd3ebf0e161f9f90885f72dce7bfbc43c43 /src/apm_driver.c
parentaa26b72a5f76012e8246de1e885f707f29e5fc4c (diff)
Remove non-linear framebuffer mapping
It hasn't worked since the pciaccess conversion anyway. Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'src/apm_driver.c')
-rw-r--r--src/apm_driver.c255
1 files changed, 70 insertions, 185 deletions
diff --git a/src/apm_driver.c b/src/apm_driver.c
index f172bab..8ee708f 100644
--- a/src/apm_driver.c
+++ b/src/apm_driver.c
@@ -200,7 +200,7 @@ ApmFreeRec(ScrnInfoPtr pScrn)
static void
ApmUnlock(ApmPtr pApm)
{
- if (pApm->Chipset >= AT3D && !pApm->noLinear)
+ if (pApm->Chipset >= AT3D)
ApmWriteSeq(0x10, 0x12);
else
wrinx(pApm->xport, 0x10, 0x12);
@@ -210,7 +210,7 @@ ApmUnlock(ApmPtr pApm)
static void
ApmLock(ApmPtr pApm)
{
- if (pApm->Chipset >= AT3D && !pApm->noLinear)
+ if (pApm->Chipset >= AT3D)
ApmWriteSeq(0x10, pApm->savedSR10 ? 0 : 0x12);
else
wrinx(pApm->xport, 0x10, pApm->savedSR10 ? 0 : 0x12);
@@ -494,21 +494,11 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags)
/* Default to 8 */
pScrn->rgbBits = 8;
}
-#ifndef XSERVER_LIBPCIACCESS
- /* you're getting a linear framebuffer with pciaccess */
- if (xf86ReturnOptValBool(pApm->Options, OPTION_NOLINEAR, FALSE)) {
- pApm->noLinear = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "No linear framebuffer\n");
- }
-#else
- pApm->noLinear = FALSE;
-#endif
from = X_DEFAULT;
pApm->hwCursor = FALSE;
if (xf86GetOptValBool(pApm->Options, OPTION_HW_CURSOR, &pApm->hwCursor))
from = X_CONFIG;
- if (pApm->noLinear ||
- xf86ReturnOptValBool(pApm->Options, OPTION_SW_CURSOR, FALSE)) {
+ if (xf86ReturnOptValBool(pApm->Options, OPTION_SW_CURSOR, FALSE)) {
from = X_CONFIG;
pApm->hwCursor = FALSE;
}
@@ -683,23 +673,11 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- if (pApm->noLinear) {
- /*
- * TODO not AT3D.
- * XXX ICI XXX
- */
- pApm->LinMapSize = 4 * 1024 * 1024 /* 0x10000 */;
- pApm->FbMapSize = 4 * 1024 * 1024 /* 0x10000 */;
- if (pApm->Chipset >= AT3D)
- pApm->LinAddress += 8 * 1024 * 1024 /* 0xA0000 */;
- }
- else {
- if (pApm->Chipset >= AT3D)
- pApm->LinMapSize = 16 * 1024 * 1024;
- else
- pApm->LinMapSize = 6 * 1024 * 1024;
- pApm->FbMapSize = 4 * 1024 * 1024;
- }
+ if (pApm->Chipset >= AT3D)
+ pApm->LinMapSize = 16 * 1024 * 1024;
+ else
+ pApm->LinMapSize = 6 * 1024 * 1024;
+ pApm->FbMapSize = 4 * 1024 * 1024;
if (xf86LoadSubModule(pScrn, "int10")) {
void *ptr;
@@ -722,7 +700,7 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags)
if (pEnt->device->videoRam != 0) {
pScrn->videoRam = pEnt->device->videoRam;
from = X_CONFIG;
- } else if (!pApm->noLinear && pApm->Chipset >= AT3D) {
+ } else if (pApm->Chipset >= AT3D) {
unsigned char d9, db, uc;
/*unsigned long save;*/
volatile unsigned char *LinMap;
@@ -1077,55 +1055,42 @@ ApmMapMem(ScrnInfoPtr pScrn)
if (pApm->LinMap == NULL)
return FALSE;
- if (!pApm->noLinear) {
- if (pApm->Chipset >= AT3D) {
- pApm->FbBase = (void *)(((char *)pApm->LinMap) + 0x800000);
- pApm->VGAMap = ((char *)pApm->LinMap) + 0xFFF000;
- pApm->MemMap = ((char *)pApm->LinMap) + 0xFFEC00;
- pApm->BltMap = (void *)(((char *)pApm->LinMap) + 0x3F8000);
+ if (pApm->Chipset >= AT3D) {
+ pApm->FbBase = (void *)(((char *)pApm->LinMap) + 0x800000);
+ pApm->VGAMap = ((char *)pApm->LinMap) + 0xFFF000;
+ pApm->MemMap = ((char *)pApm->LinMap) + 0xFFEC00;
+ pApm->BltMap = (void *)(((char *)pApm->LinMap) + 0x3F8000);
+ }
+ else {
+ pApm->FbBase = (void *)pApm->LinMap;
+ pApm->VGAMap = NULL;
+ if (pScrn->videoRam == 6 * 1024 - 32) {
+ pApm->MemMap = ((char *)pApm->LinMap) + 0x5FF800;
+ pApm->BltMap = (void *)(((char *)pApm->LinMap) + 0x5F8000);
}
else {
- pApm->FbBase = (void *)pApm->LinMap;
- pApm->VGAMap = NULL;
- if (pScrn->videoRam == 6 * 1024 - 32) {
- pApm->MemMap = ((char *)pApm->LinMap) + 0x5FF800;
- pApm->BltMap = (void *)(((char *)pApm->LinMap) + 0x5F8000);
- }
- else {
- pApm->MemMap = ((char *)pApm->LinMap) + 0x3FF800;
- pApm->BltMap = (void *)(((char *)pApm->LinMap) + 0x3F8000);
- }
+ pApm->MemMap = ((char *)pApm->LinMap) + 0x3FF800;
+ pApm->BltMap = (void *)(((char *)pApm->LinMap) + 0x3F8000);
}
+ }
- /*
- * Initialize chipset
- */
- pApm->c9 = RDXB(0xC9);
- if (pApm->Chipset >= AT3D) {
- pApm->d9 = RDXB(0xD9);
- pApm->db = RDXB(0xDB);
+ /*
+ * Initialize chipset
+ */
+ pApm->c9 = RDXB(0xC9);
+ if (pApm->Chipset >= AT3D) {
+ pApm->d9 = RDXB(0xD9);
+ pApm->db = RDXB(0xDB);
- /* If you change these two, change them also in apm_funcs.c */
- WRXB(0xDB, (pApm->db & 0xF4) | 0x0A);
- WRXB(0xD9, (pApm->d9 & 0xCF) | 0x20);
+ /* If you change these two, change them also in apm_funcs.c */
+ WRXB(0xDB, (pApm->db & 0xF4) | 0x0A);
+ WRXB(0xD9, (pApm->d9 & 0xCF) | 0x20);
- vgaHWSetMmioFuncs(hwp, (CARD8 *)pApm->LinMap, 0xFFF000);
- }
- if (pApm->Chipset >= AP6422)
- WRXB(0xC9, pApm->c9 | 0x10);
+ vgaHWSetMmioFuncs(hwp, (CARD8 *)pApm->LinMap, 0xFFF000);
}
- else {
- pApm->FbBase = pApm->LinMap;
+ if (pApm->Chipset >= AP6422)
+ WRXB(0xC9, pApm->c9 | 0x10);
- /*
- * Initialize chipset
- */
- if (pApm->Chipset >= AT3D) {
- pApm->d9 = RDXB_IOP(0xD9);
- pApm->db = RDXB_IOP(0xDB);
- WRXB_IOP(0xDB, pApm->db & 0xF4);
- }
- }
/*
* Save color mode
*/
@@ -1150,14 +1115,8 @@ ApmUnmapMem(ScrnInfoPtr pScrn)
hwp->writeMiscOut(hwp, pApm->MiscOut);
if (pApm->LinMap) {
if (pApm->Chipset >= AT3D) {
- if (!pApm->noLinear) {
- WRXB(0xD9, pApm->d9);
- WRXB(0xDB, pApm->db);
- }
- else {
- WRXB_IOP(0xD9, pApm->d9);
- WRXB_IOP(0xDB, pApm->db);
- }
+ WRXB(0xD9, pApm->d9);
+ WRXB(0xDB, pApm->db);
}
WRXB(0xC9, pApm->c9);
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pApm->LinMap, pApm->LinMapSize);
@@ -1239,18 +1198,10 @@ ApmSave(ScrnInfoPtr pScrn)
ApmReg->SEQ[0x1C] = rdinx(pApm->xport, 0x1C);
/* Hardware cursor registers. */
- if (pApm->noLinear) {
- ApmReg->EX[XR140] = RDXL_IOP(0x140);
- ApmReg->EX[XR144] = RDXW_IOP(0x144);
- ApmReg->EX[XR148] = RDXL_IOP(0x148);
- ApmReg->EX[XR14C] = RDXW_IOP(0x14C);
- }
- else {
- ApmReg->EX[XR140] = RDXL(0x140);
- ApmReg->EX[XR144] = RDXW(0x144);
- ApmReg->EX[XR148] = RDXL(0x148);
- ApmReg->EX[XR14C] = RDXW(0x14C);
- }
+ ApmReg->EX[XR140] = RDXL(0x140);
+ ApmReg->EX[XR144] = RDXW(0x144);
+ ApmReg->EX[XR148] = RDXL(0x148);
+ ApmReg->EX[XR14C] = RDXW(0x14C);
ApmReg->CRT[0x19] = rdinx(pApm->iobase + 0x3D4, 0x19);
ApmReg->CRT[0x1A] = rdinx(pApm->iobase + 0x3D4, 0x1A);
@@ -1259,26 +1210,14 @@ ApmSave(ScrnInfoPtr pScrn)
ApmReg->CRT[0x1D] = rdinx(pApm->iobase + 0x3D4, 0x1D);
ApmReg->CRT[0x1E] = rdinx(pApm->iobase + 0x3D4, 0x1E);
- if (pApm->noLinear) {
- /* RAMDAC registers. */
- ApmReg->EX[XRE8] = RDXL_IOP(0xE8);
- ApmReg->EX[XREC] = RDXL_IOP(0xEC);
-
- /* Color correction */
- ApmReg->EX[XRE0] = RDXL_IOP(0xE0);
-
- ApmReg->EX[XR80] = RDXB_IOP(0x80);
- }
- else {
- /* RAMDAC registers. */
- ApmReg->EX[XRE8] = RDXL(0xE8);
- ApmReg->EX[XREC] = RDXL(0xEC);
+ /* RAMDAC registers. */
+ ApmReg->EX[XRE8] = RDXL(0xE8);
+ ApmReg->EX[XREC] = RDXL(0xEC);
- /* Color correction */
- ApmReg->EX[XRE0] = RDXL(0xE0);
+ /* Color correction */
+ ApmReg->EX[XRE0] = RDXL(0xE0);
- ApmReg->EX[XR80] = RDXB(0x80);
- }
+ ApmReg->EX[XR80] = RDXB(0x80);
}
}
@@ -1539,10 +1478,8 @@ ApmModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
ApmReg->EX[XRE8] = 0x071F01E8; /* Enable 58MHz MCLK (actually 57.3 MHz)
This is what is used in the Windows
drivers. The BIOS sets it to 50MHz. */
- else if (!pApm->noLinear)
- ApmReg->EX[XRE8] = RDXL(0xE8); /* No change */
else
- ApmReg->EX[XRE8] = RDXL_IOP(0xE8); /* No change */
+ ApmReg->EX[XRE8] = RDXL(0xE8); /* No change */
ApmReg->EX[XRE0] = 0x10;
@@ -1626,10 +1563,7 @@ ApmRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, ApmRegPtr ApmReg)
}
else {
/* Set aperture index to 0. */
- if (pApm->noLinear)
- WRXW_IOP(0xC0, 0);
- else
- WRXW(0xC0, 0);
+ WRXW(0xC0, 0);
/*
* Write the extended registers first
@@ -1638,18 +1572,10 @@ ApmRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, ApmRegPtr ApmReg)
wrinx(pApm->xport, 0x1C, ApmReg->SEQ[0x1C]);
/* Hardware cursor registers. */
- if (pApm->noLinear) {
- WRXL_IOP(0x140, ApmReg->EX[XR140]);
- WRXW_IOP(0x144, ApmReg->EX[XR144]);
- WRXL_IOP(0x148, ApmReg->EX[XR148]);
- WRXW_IOP(0x14C, ApmReg->EX[XR14C]);
- }
- else {
- WRXL(0x140, ApmReg->EX[XR140]);
- WRXW(0x144, ApmReg->EX[XR144]);
- WRXL(0x148, ApmReg->EX[XR148]);
- WRXW(0x14C, ApmReg->EX[XR14C]);
- }
+ WRXL(0x140, ApmReg->EX[XR140]);
+ WRXW(0x144, ApmReg->EX[XR144]);
+ WRXL(0x148, ApmReg->EX[XR148]);
+ WRXW(0x14C, ApmReg->EX[XR14C]);
wrinx(pApm->iobase + 0x3D4, 0x19, ApmReg->CRT[0x19]);
wrinx(pApm->iobase + 0x3D4, 0x1A, ApmReg->CRT[0x1A]);
@@ -1659,27 +1585,14 @@ ApmRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, ApmRegPtr ApmReg)
wrinx(pApm->iobase + 0x3D4, 0x1E, ApmReg->CRT[0x1E]);
/* RAMDAC registers. */
- if (pApm->noLinear) {
- WRXL_IOP(0xE8, ApmReg->EX[XRE8]);
- WRXL_IOP(0xEC, ApmReg->EX[XREC] & ~(1 << 7));
- WRXL_IOP(0xEC, ApmReg->EX[XREC] | (1 << 7)); /* Do a PLL resync */
- }
- else {
- WRXL(0xE8, ApmReg->EX[XRE8]);
- WRXL(0xEC, ApmReg->EX[XREC] & ~(1 << 7));
- WRXL(0xEC, ApmReg->EX[XREC] | (1 << 7)); /* Do a PLL resync */
- }
+ WRXL(0xE8, ApmReg->EX[XRE8]);
+ WRXL(0xEC, ApmReg->EX[XREC] & ~(1 << 7));
+ WRXL(0xEC, ApmReg->EX[XREC] | (1 << 7)); /* Do a PLL resync */
/* Color correction */
- if (pApm->noLinear)
- WRXL_IOP(0xE0, ApmReg->EX[XRE0]);
- else
- WRXL(0xE0, ApmReg->EX[XRE0]);
+ WRXL(0xE0, ApmReg->EX[XRE0]);
- if (pApm->noLinear)
- WRXB_IOP(0x80, ApmReg->EX[XR80]);
- else
- WRXB(0x80, ApmReg->EX[XR80]);
+ WRXB(0x80, ApmReg->EX[XR80]);
/*
* This function handles restoring the generic VGA registers.
@@ -1735,17 +1648,8 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pApm->pScreen = pScreen;
/* Map the chip memory and MMIO areas */
- if (pApm->noLinear) {
- PCI_READ_LONG(pApm->PciInfo, &pApm->saveCmd, PCI_CMD_STAT_REG);
- PCI_WRITE_LONG(pApm->PciInfo, pApm->saveCmd | (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE), PCI_CMD_STAT_REG);
-#ifndef XSERVER_LIBPCIACCESS
- pApm->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
- pApm->PciTag, 0xA0000, 0x10000);
-#endif
- }
- else
- if (!ApmMapMem(pScrn))
- return FALSE;
+ if (!ApmMapMem(pScrn))
+ return FALSE;
/* No memory reserved yet */
pApm->OffscreenReserved = 0;
@@ -1895,10 +1799,7 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DPMSInit(pScreen, ApmDisplayPowerManagementSet, 0);
- if (pApm->noLinear)
- ApmInitVideo_IOP(pScreen);
- else
- ApmInitVideo(pScreen);
+ ApmInitVideo(pScreen);
pScreen->SaveScreen = ApmSaveScreen;
@@ -2023,14 +1924,9 @@ ApmEnterVT(int scrnIndex, int flags)
vgaHWPtr hwp = VGAHWPTR(pScrn);
if (pApm->Chipset >= AT3D) {
- if (!pApm->noLinear) {
- /* If you change it, change it also in apm_funcs.c */
- WRXB(0xDB, (pApm->db & 0xF4) | 0x0A | pApm->Rush);
- WRXB(0xD9, (pApm->d9 & 0xCF) | 0x20);
- }
- else {
- WRXB_IOP(0xDB, pApm->db & 0xF4);
- }
+ /* If you change it, change it also in apm_funcs.c */
+ WRXB(0xDB, (pApm->db & 0xF4) | 0x0A | pApm->Rush);
+ WRXB(0xD9, (pApm->d9 & 0xCF) | 0x20);
}
if (pApm->Chipset >= AP6422)
WRXB(0xC9, pApm->c9 | 0x10);
@@ -2064,14 +1960,8 @@ ApmLeaveVT(int scrnIndex, int flags)
vgaHWLock(hwp);
ApmLock(pApm);
if (pApm->Chipset >= AT3D) {
- if (!pApm->noLinear) {
- WRXB(0xD9, pApm->d9);
- WRXB(0xDB, pApm->db);
- }
- else {
- WRXB_IOP(0xD9, pApm->d9);
- WRXB_IOP(0xDB, pApm->db);
- }
+ WRXB(0xD9, pApm->d9);
+ WRXB(0xDB, pApm->db);
}
WRXB(0xC9, pApm->c9);
@@ -2178,13 +2068,8 @@ ApmDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
default:
dpmsreg = 0;
}
- if (pApm->noLinear) {
- tmp = RDXB_IOP(0xD0);
- WRXB_IOP(0xD0, (tmp & 0xFC) | dpmsreg);
- } else {
- tmp = RDXB(0xD0);
- WRXB(0xD0, (tmp & 0xFC) | dpmsreg);
- }
+ tmp = RDXB(0xD0);
+ WRXB(0xD0, (tmp & 0xFC) | dpmsreg);
}
static Bool