diff options
author | George Fufutos <fufutos610@hotmail.com> | 2006-06-07 19:25:10 +0300 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2006-06-14 06:12:38 +0200 |
commit | 27d277bef3b10de26f238c5331c1af2ec464e366 (patch) | |
tree | 94f01458fa0f55f9900462be85522f3cc8ed4dad | |
parent | f2b1fc58d68f6421a5ae80dc784576d923419c35 (diff) |
[PATCH] Add memcpy-based UTS/DFS.
EXA hits more optimized paths when it does not have to fallback because of
missing UTS/DFS.
-rw-r--r-- | src/atimach64exa.c | 74 |
1 files changed, 68 insertions, 6 deletions
diff --git a/src/atimach64exa.c b/src/atimach64exa.c index 8ba3e09..2adf2ca 100644 --- a/src/atimach64exa.c +++ b/src/atimach64exa.c @@ -56,6 +56,8 @@ #include "config.h" #endif +#include <string.h> + #include "ati.h" #include "atichip.h" #include "atidri.h" @@ -299,7 +301,8 @@ Mach64Copy * for the fact that the problem occurs less often (but still occurs) when * copying larger rectangles. */ - if ((pATI->Chip >= ATI_CHIP_264VTB) && !pATI->OptionDevel) { + if ((pATI->Chip >= ATI_CHIP_264VTB) && !pATI->OptionDevel) + { exaMarkSync(pScreenInfo->pScreen); /* Force sync. */ exaWaitSync(pScreenInfo->pScreen); /* Sync and notify EXA. */ } @@ -384,6 +387,60 @@ Mach64Solid static void Mach64DoneSolid(PixmapPtr pPixmap) { } +/* + * Memcpy-based UTS. + */ +static Bool +Mach64UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, + char *src, int src_pitch) +{ + char *dst = pDst->devPrivate.ptr; + int dst_pitch = exaGetPixmapPitch(pDst); + + int bpp = pDst->drawable.bitsPerPixel; + int cpp = (bpp + 7) / 8; + int wBytes = w * cpp; + + exaWaitSync(pDst->drawable.pScreen); + + dst += (x * cpp) + (y * dst_pitch); + + while (h--) { + memcpy(dst, src, wBytes); + src += src_pitch; + dst += dst_pitch; + } + + return TRUE; +} + +/* + * Memcpy-based DFS. + */ +static Bool +Mach64DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, + char *dst, int dst_pitch) +{ + char *src = pSrc->devPrivate.ptr; + int src_pitch = exaGetPixmapPitch(pSrc); + + int bpp = pSrc->drawable.bitsPerPixel; + int cpp = (bpp + 7) / 8; + int wBytes = w * cpp; + + exaWaitSync(pSrc->drawable.pScreen); + + src += (x * cpp) + (y * src_pitch); + + while (h--) { + memcpy(dst, src, wBytes); + src += src_pitch; + dst += dst_pitch; + } + + return TRUE; +} + /* Compute log base 2 of val. */ static __inline__ int Mach64Log2(int val) { @@ -562,7 +619,8 @@ Mach64SetupMemEXA(ScreenPtr pScreen) "Will use depth buffer at offset 0x%x\n", pATIDRIServer->depthOffset); - if (pATIDRIServer->textureSize > 0) { + if (pATIDRIServer->textureSize > 0) + { xf86DrvMsg(pScreen->myNum, X_INFO, "Will use %d kB for local textures at offset 0x%x\n", pATIDRIServer->textureSize/1024, @@ -571,10 +629,8 @@ Mach64SetupMemEXA(ScreenPtr pScreen) } #endif /* XF86DRI_DEVEL */ - /* FIXME: set to 64 if that helps for hostdata blits or textures */ - /* FIXME: must be multiple of 8 pixels; 32 is ok for 16bpp, 32bpp */ - pExa->pixmapOffsetAlign = 32; - pExa->pixmapPitchAlign = 32; + pExa->pixmapOffsetAlign = 64; + pExa->pixmapPitchAlign = 64; pExa->flags = EXA_OFFSCREEN_PIXMAPS; @@ -618,6 +674,12 @@ Bool ATIMach64ExaInit(ScreenPtr pScreen) pExa->Copy = Mach64Copy; pExa->DoneCopy = Mach64DoneCopy; + /* EXA hits more optimized paths when it does not have to fallback because + * of missing UTS/DFS, hook memcpy-based UTS/DFS. + */ + pExa->UploadToScreen = Mach64UploadToScreen; + pExa->DownloadFromScreen = Mach64DownloadFromScreen; + if (!exaDriverInit(pScreen, pATI->pExa)) { xfree(pATI->pExa); pATI->pExa = NULL; |