xf86-video-ati: Branch 'pci-rework'
George Sapountzis
gsap7 at kemper.freedesktop.org
Fri Mar 16 19:35:30 EET 2007
src/atividmem.c | 82 +++++++++++++++++++++++++++++---------------------------
1 files changed, 43 insertions(+), 39 deletions(-)
New commits:
diff-tree aec1ab0a365786223a0c713764aa705e443126ba (from c3b57b1e6ea0c37ef0e84680b8451b4b6ac81f5b)
Author: George Sapountzis <gsap7 at yahoo.gr>
Date: Fri Mar 16 19:21:33 2007 +0200
[mach64] Make mapping code friendlier to source-code compatibility.
diff --git a/src/atividmem.c b/src/atividmem.c
index e6e15c9..486c249 100644
--- a/src/atividmem.c
+++ b/src/atividmem.c
@@ -67,6 +67,25 @@ const char *ATIMemoryTypeNames_264xT[] =
"Unknown video memory type"
};
+#ifndef PCIACCESS
+
+/* Called implicitely by xf86MapPciMem(VIDMEM_FRAMEBUFFER) */
+#define setWC(_screenNum, _base, _size, _enable) \
+do { \
+} while (0)
+
+#else /* PCIACCESS */
+
+/*
+ * FIXME: This is an internal Xserver function that should be exported and
+ * called explicitely with pci-rework, pci-rework does not setup mtrr's.
+ */
+#define setWC(_screenNum, _base, _size, _enable) \
+do { \
+} while (0)
+
+#endif /* PCIACCESS */
+
#ifndef AVOID_CPIO
/*
@@ -106,7 +125,12 @@ ATIUnmapLinear
pciVideoPtr pVideo = pATI->PCIInfo;
if (pATI->pMemoryLE)
+ {
+ if (pATI->LinearBase)
+ setWC(iScreen, pATI->LinearBase, pATI->LinearSize, FALSE);
+
xf86UnMapVidMem(iScreen, pATI->pMemoryLE, (1U << pVideo->size[0]));
+ }
pATI->pMemory = pATI->pMemoryLE = NULL;
@@ -167,7 +191,7 @@ ATIMapApertures
PCI_CFG_TAG(pVideo), 0x000A0000U, 0x00010000U);
if (!pATI->pBank)
- return FALSE;
+ goto bail;
pATI->Mapped = TRUE;
}
@@ -190,17 +214,7 @@ ATIMapApertures
(1U << pVideo->size[0]));
if (!pATI->pMemoryLE)
- {
-
-#ifndef AVOID_CPIO
-
- ATIUnmapVGA(iScreen, pATI);
-
-#endif /* AVOID_CPIO */
-
- pATI->Mapped = FALSE;
- return FALSE;
- }
+ goto bail;
pATI->Mapped = TRUE;
@@ -214,11 +228,9 @@ ATIMapApertures
#endif /* X_BYTE_ORDER */
- /* FIXME: Set write-combining for the FB */
-#if 0
+ /* Set write-combining for the FB (and the HW cursor on LE) */
if (pATI->LinearBase)
setWC(iScreen, pATI->LinearBase, pATI->LinearSize, TRUE);
-#endif
if (pATI->CursorBase)
pATI->pCursorImage = (char *)pATI->pMemoryLE + pATI->CursorOffset;
@@ -233,18 +245,7 @@ ATIMapApertures
getpagesize());
if (!pATI->pMMIO)
- {
- ATIUnmapLinear(iScreen, pATI);
-
-#ifndef AVOID_CPIO
-
- ATIUnmapVGA(iScreen, pATI);
-
-#endif /* AVOID_CPIO */
-
- pATI->Mapped = FALSE;
- return FALSE;
- }
+ goto bail;
pATI->Mapped = TRUE;
@@ -269,18 +270,7 @@ ATIMapApertures
* extended BE aperture which would give a size of 8MB).
*/
if (mmio_offset + 0x00000400U > linear_size)
- {
- ATIUnmapLinear(iScreen, pATI);
-
-#ifndef AVOID_CPIO
-
- ATIUnmapVGA(iScreen, pATI);
-
-#endif /* AVOID_CPIO */
-
- pATI->Mapped = FALSE;
- return FALSE;
- }
+ goto bail;
pATI->Mapped = TRUE;
@@ -291,6 +281,20 @@ ATIMapApertures
}
return TRUE;
+
+bail:
+
+ ATIUnmapLinear(iScreen, pATI);
+
+#ifndef AVOID_CPIO
+
+ ATIUnmapVGA(iScreen, pATI);
+
+#endif /* AVOID_CPIO */
+
+ pATI->Mapped = FALSE;
+
+ return FALSE;
}
/*
More information about the xorg-commit
mailing list