diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-02-24 11:06:32 -0500 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2009-02-24 11:06:32 -0500 |
commit | 34a3f94b91406aa8e6355787f5474cbb6bfc0052 (patch) | |
tree | a425010b35fbd032f32fe761840d7af3ca355a6f | |
parent | b7f951db4aed18b5e55a65fb079410113239e58d (diff) |
R6xx/R7xx EXA: optimize overlapping copy using temp surface
- allocate temp surface in PrepareCopy()
- fallback to old OverlapCopy() path is we're not able to
allocate a temp surface
-rw-r--r-- | src/r600_exa.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/r600_exa.c b/src/r600_exa.c index 52e594f..a945539 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -697,11 +697,14 @@ R600PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, accel_state->planemask = planemask; if (exaGetPixmapOffset(pSrc) == exaGetPixmapOffset(pDst)) { + unsigned long size = pDst->drawable.height * accel_state->dst_pitch * pDst->drawable.bitsPerPixel/8; accel_state->same_surface = TRUE; -#ifdef SHOW_VERTEXES - ErrorF("same surface!\n"); -#endif + if (accel_state->copy_area) { + exaOffscreenFree(pDst->drawable.pScreen, accel_state->copy_area); + accel_state->copy_area = NULL; + } + accel_state->copy_area = exaOffscreenAlloc(pDst->drawable.pScreen, size, 256, TRUE, NULL, NULL); } else { accel_state->same_surface = FALSE; @@ -871,29 +874,27 @@ R600Copy(PixmapPtr pDst, struct r6xx_accel_state *accel_state = rhdPtr->TwoDPrivate; if (accel_state->same_surface && is_overlap(srcX, srcX + w, srcY, srcY + h, dstX, dstX + w, dstY, dstY + h)) { - uint32_t pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8); - uint32_t orig_offset, tmp_offset; + if (accel_state->copy_area) { + uint32_t pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8); + uint32_t orig_offset, tmp_offset; - if(!(accel_state->copy_area)) { - unsigned long size=pDst->drawable.height*pitch*pDst->drawable.bitsPerPixel/8; - accel_state->copy_area=exaOffscreenAlloc(pDst->drawable.pScreen, size, 256, TRUE, NULL, NULL); - } + tmp_offset = accel_state->copy_area->offset + rhdPtr->FbIntAddress + rhdPtr->FbScanoutStart; + orig_offset = exaGetPixmapOffset(pDst) + rhdPtr->FbIntAddress + rhdPtr->FbScanoutStart; - tmp_offset = accel_state->copy_area->offset + rhdPtr->FbIntAddress + rhdPtr->FbScanoutStart; - orig_offset = exaGetPixmapOffset(pDst) + rhdPtr->FbIntAddress + rhdPtr->FbScanoutStart; - - R600DoPrepareCopy(pScrn, - pitch, pDst->drawable.width, pDst->drawable.height, orig_offset, pDst->drawable.bitsPerPixel, - pitch, pDst->drawable.height, tmp_offset, pDst->drawable.bitsPerPixel, - accel_state->rop, accel_state->planemask); - R600AppendCopyVertex(pScrn, srcX, srcY, dstX, dstY, w, h); - R600DoCopy(pScrn); - R600DoPrepareCopy(pScrn, - pitch, pDst->drawable.width, pDst->drawable.height, tmp_offset, pDst->drawable.bitsPerPixel, - pitch, pDst->drawable.height, orig_offset, pDst->drawable.bitsPerPixel, - accel_state->rop, accel_state->planemask); - R600AppendCopyVertex(pScrn, dstX, dstY, dstX, dstY, w, h); - R600DoCopy(pScrn); + R600DoPrepareCopy(pScrn, + pitch, pDst->drawable.width, pDst->drawable.height, orig_offset, pDst->drawable.bitsPerPixel, + pitch, pDst->drawable.height, tmp_offset, pDst->drawable.bitsPerPixel, + accel_state->rop, accel_state->planemask); + R600AppendCopyVertex(pScrn, srcX, srcY, dstX, dstY, w, h); + R600DoCopy(pScrn); + R600DoPrepareCopy(pScrn, + pitch, pDst->drawable.width, pDst->drawable.height, tmp_offset, pDst->drawable.bitsPerPixel, + pitch, pDst->drawable.height, orig_offset, pDst->drawable.bitsPerPixel, + accel_state->rop, accel_state->planemask); + R600AppendCopyVertex(pScrn, dstX, dstY, dstX, dstY, w, h); + R600DoCopy(pScrn); + } else + R600OverlapCopy(pDst, srcX, srcY, dstX, dstY, w, h); } else if(accel_state->same_surface) { uint32_t pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8); uint32_t offset = exaGetPixmapOffset(pDst) + rhdPtr->FbIntAddress + rhdPtr->FbScanoutStart; @@ -4324,6 +4325,7 @@ R6xxEXAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) RHDPTR(pScrn)->EXAInfo = EXAInfo; accel_state->XHas3DEngineState = FALSE; + accel_state->copy_area = NULL; rhdPtr->TwoDPrivate = accel_state; |