summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-06-10 09:50:59 +0000
committerEric Anholt <anholt@freebsd.org>2004-06-10 09:50:59 +0000
commitc3bc6dd551436d5e37a07f37b3b77a83bb5b5da0 (patch)
treee150a3e1fa6abab42bddcfca156253e2a8f8b769
parentcf3f95d2164604047866b283fe0071574bf16dbc (diff)
Align scratch area offsets to the offscreen byte alignment.
-rw-r--r--hw/kdrive/ati/ati_draw.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/hw/kdrive/ati/ati_draw.c b/hw/kdrive/ati/ati_draw.c
index dd9a1f4db..4a9967275 100644
--- a/hw/kdrive/ati/ati_draw.c
+++ b/hw/kdrive/ati/ati_draw.c
@@ -85,7 +85,6 @@ ATIDrawSetup(ScreenPtr pScreen)
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
- char *mmio = atic->reg_base;
RING_LOCALS;
/* XXX: this shouldn't be necessary, but fixes some R128 composite
@@ -605,7 +604,9 @@ ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
* KAA flag we check for (and supported in kaa.c in general) since many
* older bits of hardware are going to want POT pitches.
*/
- w = 1 << (ATILog2(pSrc->drawable.width - 1) + 1);
+ w = pSrc->drawable.width;
+ if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT)
+ w = 1 << (ATILog2(w - 1) + 1);
dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 +
atis->kaa.offscreenPitch - 1) & ~(atis->kaa.offscreenPitch - 1);
@@ -614,6 +615,9 @@ ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
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) {
/* Only sync when we've used all of the scratch area. */
@@ -673,6 +677,7 @@ 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);
@@ -706,6 +711,13 @@ 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;