summaryrefslogtreecommitdiff
path: root/hw/kdrive/ati/ati_draw.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-07-19 07:53:54 +0000
committerEric Anholt <anholt@freebsd.org>2004-07-19 07:53:54 +0000
commit9fe216a45836b98b5aea55725019668de3900e83 (patch)
tree0a17bb3ee2f28755c0f197732560254aee3c1d49 /hw/kdrive/ati/ati_draw.c
parente2bb9f38cdcb74fd7630f4efe310ad14d597171e (diff)
downloadxserver-9fe216a45836b98b5aea55725019668de3900e83.tar.gz
Use the offscreen memory manager as much as possible to do the reservation
of memory at startup. Do some drive-by cleanups while I'm here (sorry!).
Diffstat (limited to 'hw/kdrive/ati/ati_draw.c')
-rw-r--r--hw/kdrive/ati/ati_draw.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/hw/kdrive/ati/ati_draw.c b/hw/kdrive/ati/ati_draw.c
index 5b6681a04..48998040d 100644
--- a/hw/kdrive/ati/ati_draw.c
+++ b/hw/kdrive/ati/ati_draw.c
@@ -91,6 +91,7 @@ ATIDrawSetup(ScreenPtr pScreen)
* issues.
*/
/*if (!atic->is_radeon) {
+ char *mmio = atic->reg_base;
ATIWaitIdle(atis);
MMIO_OUT32(mmio, R128_REG_PC_GUI_MODE,
R128_PC_BYPASS_EN);
@@ -615,23 +616,23 @@ ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
atis->kaa.offscreenPitch - 1) & ~(atis->kaa.offscreenPitch - 1);
size = dst_pitch * pSrc->drawable.height;
- if (size > atis->scratch_size)
+ if (size > atis->scratch_area->size)
ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n",
pSrc->drawable.width, pSrc->drawable.height));
atis->scratch_next = (atis->scratch_next +
atis->kaa.offscreenByteAlign - 1) &
~(atis->kaa.offscreenByteAlign - 1);
- if (atis->scratch_next + size > atis->scratch_offset +
- atis->scratch_size) {
+ if (atis->scratch_next + size > atis->scratch_area->offset +
+ atis->scratch_area->size) {
/* Only sync when we've used all of the scratch area. */
KdCheckSync(pSrc->drawable.pScreen);
- atis->scratch_next = atis->scratch_offset;
+ atis->scratch_next = atis->scratch_area->offset;
}
memcpy(pDst, pSrc, sizeof(*pDst));
pDst->devKind = dst_pitch;
- pDst->devPrivate.ptr = atis->scratch_next +
- pScreenPriv->screen->memory_base;
+ pDst->devPrivate.ptr = pScreenPriv->screen->memory_base +
+ atis->scratch_next;
atis->scratch_next += size;
src = pSrc->devPrivate.ptr;
@@ -662,7 +663,7 @@ ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
}
static void
-ATIBlockHandler (pointer blockData, OSTimePtr timeout, pointer readmask)
+ATIBlockHandler(pointer blockData, OSTimePtr timeout, pointer readmask)
{
ScreenPtr pScreen = (ScreenPtr) blockData;
KdScreenPriv(pScreen);
@@ -675,7 +676,7 @@ ATIBlockHandler (pointer blockData, OSTimePtr timeout, pointer readmask)
}
static void
-ATIWakeupHandler (pointer blockData, int result, pointer readmask)
+ATIWakeupHandler(pointer blockData, int result, pointer readmask)
{
}
@@ -685,7 +686,6 @@ ATIDrawInit(ScreenPtr pScreen)
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
- int align_scratch;
ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth,
pScreenPriv->screen->fb[0].bitsPerPixel);
@@ -719,19 +719,21 @@ ATIDrawInit(ScreenPtr pScreen)
atis->kaa.offscreenPitch = 32;
}
- /* Align the scratch area to what offscreenByteAlign requires. */
- align_scratch = (atis->scratch_offset +
- atis->kaa.offscreenByteAlign - 1) &
- ~(atis->kaa.offscreenByteAlign - 1);
- atis->scratch_size -= align_scratch - atis->scratch_offset;
- atis->scratch_offset = align_scratch;
-
if (!kaaDrawInit(pScreen, &atis->kaa))
return FALSE;
return TRUE;
}
+static void
+ATIScratchSave(ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+
+ atis->scratch_area = NULL;
+}
+
void
ATIDrawEnable(ScreenPtr pScreen)
{
@@ -780,7 +782,18 @@ ATIDrawEnable(ScreenPtr pScreen)
}
atis->kaa.UploadToScreen = ATIUploadToScreen;
- atis->kaa.UploadToScratch = ATIUploadToScratch;
+
+ /* Reserve a scratch area. It'll be used for storing glyph data during
+ * Composite operations, because glyphs aren't in real pixmaps and thus
+ * can't be migrated.
+ */
+ atis->scratch_area = KdOffscreenAlloc(pScreen, 131072,
+ atis->kaa.offscreenByteAlign, TRUE, ATIScratchSave, atis);
+ if (atis->scratch_area != NULL) {
+ atis->scratch_next = atis->scratch_area->offset;
+ atis->kaa.UploadToScratch = ATIUploadToScratch;
+ } else
+ atis->kaa.UploadToScratch = NULL;
RegisterBlockAndWakeupHandlers (ATIBlockHandler, ATIWakeupHandler,
pScreen);
@@ -791,10 +804,10 @@ ATIDrawEnable(ScreenPtr pScreen)
void
ATIDrawDisable(ScreenPtr pScreen)
{
- ATIDMATeardown(pScreen);
-
RemoveBlockAndWakeupHandlers (ATIBlockHandler, ATIWakeupHandler,
pScreen);
+
+ ATIDMATeardown(pScreen);
}
void