diff options
author | Eric Anholt <eric@anholt.net> | 2007-08-06 17:01:37 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-08-07 15:13:10 -0700 |
commit | da82a47a558597f3653e2b33bc6adbab18574b57 (patch) | |
tree | d651a7ea7b521fa2611afd2f6892d1d87357a8d3 /src/i830_exa.c | |
parent | 3510d5728fa972b36d022b4f9189d46ff98d7b16 (diff) |
Fix EXA rendering with tiled front buffer on pre-965.
The 915 and earlier appear to respect the fence registers, while only the 965
requires the per-operation tiling setting and pitch shifting. This will also
fix issues with rendering on the 965 involving multiple cliprects, where the
pitch would get divided repeatedly.
This removes the offset < 4096 fallback, which essentially resulted in no
acceleration to tiled buffers, hiding the issues.
Diffstat (limited to 'src/i830_exa.c')
-rw-r--r-- | src/i830_exa.c | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/src/i830_exa.c b/src/i830_exa.c index 19f4e30a..b0029d1d 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -152,10 +152,8 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) I830FALLBACK("pixmap offset not aligned"); if (pitch % pI830->EXADriverPtr->pixmapPitchAlign != 0) I830FALLBACK("pixmap pitch not aligned"); - if (exaPixmapTiled(pPixmap) && offset > 4096) - I830FALLBACK("offset limited to 4k for tiled targets"); - pI830->BR[13] = (pitch & 0xffff); + pI830->BR[13] = (I830PatternROP[alu] & 0xff) << 16 ; switch (pPixmap->drawable.bitsPerPixel) { case 8: break; @@ -168,7 +166,6 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) pI830->BR[13] |= ((1 << 24) | (1 << 25)); break; } - pI830->BR[13] |= (I830PatternROP[alu] & 0xff) << 16 ; pI830->BR[16] = fg; return TRUE; } @@ -178,10 +175,11 @@ I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - unsigned long offset; + unsigned long offset, pitch; uint32_t cmd; offset = exaGetPixmapOffset(pPixmap); + pitch = exaGetPixmapPitch(pPixmap); { BEGIN_LP_RING(6); @@ -191,16 +189,15 @@ I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) if (pPixmap->drawable.bitsPerPixel == 32) cmd |= XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB; - if (exaPixmapTiled(pPixmap)) { - /* Fixup pitch for destination if tiled */ - pI830->BR[13] = (ROUND_TO(pI830->BR[13] & 0xffff, 512) >> 2) | - (pI830->BR[13] & 0xffff0000); + if (IS_I965G(pI830) && exaPixmapTiled(pPixmap)) { + assert((pitch % 512) == 0); + pitch >>= 2; cmd |= XY_COLOR_BLT_TILED; } OUT_RING(cmd); - OUT_RING(pI830->BR[13]); + OUT_RING(pI830->BR[13] | pitch); OUT_RING((y1 << 16) | (x1 & 0xffff)); OUT_RING((y2 << 16) | (x2 & 0xffff)); OUT_RING(offset); @@ -233,17 +230,9 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask)) I830FALLBACK("planemask is not solid"); - pI830->copy_src_pitch = exaGetPixmapPitch(pSrcPixmap); - pI830->copy_src_off = exaGetPixmapOffset(pSrcPixmap); - pI830->copy_src_tiled = exaPixmapTiled(pSrcPixmap); - - if (pI830->copy_src_tiled && pI830->copy_src_off > 4096) - I830FALLBACK("offset limited to 4k for tiled targets"); - if (exaPixmapTiled(pDstPixmap) && exaGetPixmapOffset(pDstPixmap) > 4096) - I830FALLBACK("offset limited to 4k for tiled targets"); + pI830->pSrcPixmap = pSrcPixmap; - pI830->BR[13] = exaGetPixmapPitch(pDstPixmap); - pI830->BR[13] |= I830CopyROP[alu] << 16; + pI830->BR[13] = I830CopyROP[alu] << 16; switch (pSrcPixmap->drawable.bitsPerPixel) { case 8: @@ -266,12 +255,15 @@ I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1, I830Ptr pI830 = I830PTR(pScrn); uint32_t cmd; int dst_x2, dst_y2; - unsigned int dst_off; + unsigned int dst_off, dst_pitch, src_off, src_pitch; dst_x2 = dst_x1 + w; dst_y2 = dst_y1 + h; dst_off = exaGetPixmapOffset(pDstPixmap); + dst_pitch = exaGetPixmapPitch(pDstPixmap); + src_off = exaGetPixmapOffset(pI830->pSrcPixmap); + src_pitch = exaGetPixmapPitch(pI830->pSrcPixmap); { BEGIN_LP_RING(8); @@ -281,29 +273,29 @@ I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1, if (pDstPixmap->drawable.bitsPerPixel == 32) cmd |= XY_SRC_COPY_BLT_WRITE_ALPHA | XY_SRC_COPY_BLT_WRITE_RGB; - if (exaPixmapTiled(pDstPixmap)) { - /* Fixup pitch for destination if tiled */ - pI830->BR[13] = (ROUND_TO(pI830->BR[13] & 0xffff, 512) >> 2) | - (pI830->BR[13] & 0xffff0000); - cmd |= XY_SRC_COPY_BLT_DST_TILED; - } + if (IS_I965G(pI830)) { + if (exaPixmapTiled(pDstPixmap)) { + assert((dst_pitch % 512) == 0); + dst_pitch >>= 2; + cmd |= XY_SRC_COPY_BLT_DST_TILED; + } - if (pI830->copy_src_tiled) { - pI830->copy_src_pitch = - (ROUND_TO(pI830->copy_src_pitch & 0xffff, 512) >> 2) | - (pI830->copy_src_pitch & 0xffff0000); - cmd |= XY_SRC_COPY_BLT_SRC_TILED; + if (exaPixmapTiled(pI830->pSrcPixmap)) { + assert((src_pitch % 512) == 0); + src_pitch >>= 2; + cmd |= XY_SRC_COPY_BLT_SRC_TILED; + } } OUT_RING(cmd); - OUT_RING(pI830->BR[13]); + OUT_RING(pI830->BR[13] | dst_pitch); OUT_RING((dst_y1 << 16) | (dst_x1 & 0xffff)); OUT_RING((dst_y2 << 16) | (dst_x2 & 0xffff)); OUT_RING(dst_off); OUT_RING((src_y1 << 16) | (src_x1 & 0xffff)); - OUT_RING(pI830->copy_src_pitch); - OUT_RING(pI830->copy_src_off); + OUT_RING(src_pitch); + OUT_RING(src_off); ADVANCE_LP_RING(); } |