diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-02-24 10:51:13 -0500 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2009-02-24 10:51:13 -0500 |
commit | 95ce13572dc2d9f5dd6cf55c23411e275c0aadf1 (patch) | |
tree | d059afb3c44ed8d6730bc6c188fb1c07365de9ad /src/r600_exa.c | |
parent | 1a7db3fc2a0277d724d60d028064d8ef75019c28 (diff) |
R6xx/R7xx EXA: Optimize temp surface for overlapping copies
- allocate temp surface in PrepareCopy()
- fall back to old OverlapCopy() path if we are not able
to allocate a temp surface
Diffstat (limited to 'src/r600_exa.c')
-rw-r--r-- | src/r600_exa.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/r600_exa.c b/src/r600_exa.c index 8da0b4d2..b4db38db 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -694,13 +694,15 @@ 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; R600DoPrepareCopy(pScrn, @@ -868,29 +870,27 @@ R600Copy(PixmapPtr pDst, struct radeon_accel_state *accel_state = info->accel_state; 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 + info->fbLocation + pScrn->fbOffset; - orig_offset = exaGetPixmapOffset(pDst) + info->fbLocation + pScrn->fbOffset; + tmp_offset = accel_state->copy_area->offset + info->fbLocation + pScrn->fbOffset; + orig_offset = exaGetPixmapOffset(pDst) + info->fbLocation + pScrn->fbOffset; - 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) + info->fbLocation + pScrn->fbOffset; @@ -914,12 +914,12 @@ R600DoneCopy(PixmapPtr pDst) RADEONInfoPtr info = RADEONPTR(pScrn); struct radeon_accel_state *accel_state = info->accel_state; - if(!(accel_state->same_surface)) + if (!accel_state->same_surface) R600DoCopy(pScrn); if (accel_state->copy_area) { exaOffscreenFree(pDst->drawable.pScreen, accel_state->copy_area); - accel_state->copy_area=NULL; + accel_state->copy_area = NULL; } } |