From e3192738669bc85df2412fdea328f1512339b420 Mon Sep 17 00:00:00 2001 From: glevand Date: Sun, 30 Sep 2012 09:23:26 -0800 Subject: [PATCH] Ps3GpuTransferData cannot handle negative X and Y copy directions, fallback to software copy for now --- src/ps3gpu_accel.c | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/src/ps3gpu_accel.c b/src/ps3gpu_accel.c index 992bac3..7701fd5 100644 --- a/src/ps3gpu_accel.c +++ b/src/ps3gpu_accel.c @@ -191,11 +191,14 @@ Ps3GpuContextInit(ScrnInfoPtr pScrn) static inline Bool Ps3GpuTransferData(ScrnInfoPtr pScrn, int mode, CARD32 dst_offset, CARD32 dst_pitch, CARD32 src_offset, CARD32 src_pitch, - CARD32 row_length, CARD32 row_count, int dy) + CARD32 row_length, CARD32 row_count) { Ps3GpuPtr gPtr = PS3GPUPTR(pScrn); CARD32 src, dst; + if (row_length == 0 || row_count == 0) + return (TRUE); + switch (mode) { case XFER_MODE_VIDEO_TO_VIDEO: src = 0xfeed0000; @@ -234,13 +237,8 @@ Ps3GpuTransferData(ScrnInfoPtr pScrn, int mode, Ps3GpuFifoPut(pScrn, 0x00000101); Ps3GpuFifoPut(pScrn, 0x00000000); - if (dy > 0) { - src_offset += src_pitch; - dst_offset += dst_pitch; - } else { - src_offset -= src_pitch; - dst_offset -= dst_pitch; - } + src_offset += src_pitch; + dst_offset += dst_pitch; } Ps3GpuFifoKick(pScrn); @@ -298,7 +296,7 @@ Ps3GpuUploadDma(PixmapPtr pDst, int x, int y, int w, int h, Ps3GpuTransferData(pScrn, XFER_MODE_GART_TO_VIDEO, gPtr->fbGpuAddress + dst_offset, dst_pitch, gPtr->gartGpuAddress, row_length, - row_length, row_count, 1); + row_length, row_count); exaWaitSync(pDst->drawable.pScreen); @@ -332,7 +330,7 @@ Ps3GpuDownloadDma(PixmapPtr pSrc, int x, int y, int w, int h, Ps3GpuTransferData(pScrn, XFER_MODE_VIDEO_TO_GART, gPtr->gartGpuAddress, row_length, gPtr->fbGpuAddress + src_offset, src_pitch, - row_length, row_count, 1); + row_length, row_count); exaWaitSync(pSrc->drawable.pScreen); @@ -383,10 +381,17 @@ Ps3GpuPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, ScrnInfoPtr pScrn = xf86Screens[pSrcPixmap->drawable.pScreen->myNum]; Ps3GpuPtr gPtr = PS3GPUPTR(pScrn); + DPRINTF(pScrn, "%s:%d: sbpp=%d dbpp=%d dx=%d dy=%d alu=%d\n", + __func__, __LINE__, pSrcPixmap->drawable.bitsPerPixel, + pDstPixmap->drawable.bitsPerPixel, dx, dy, alu); + if (pSrcPixmap->drawable.bitsPerPixel != pDstPixmap->drawable.bitsPerPixel) return (FALSE); + if (dx < 0 || dy < 0) + return (FALSE); + planemask |= ~0 << pDstPixmap->drawable.bitsPerPixel; if (planemask != ~0 || alu != GXcopy) @@ -413,26 +418,13 @@ Ps3GpuCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, int dst_offset = exaGetPixmapOffset(pDstPixmap) + dstY * dst_pitch + dstX * cpp; - if (srcY == dstY && dstX > srcX && dstX <= (srcX + width)) { - Ps3GpuTransferData(pScrn, XFER_MODE_VIDEO_TO_VIDEO, - gPtr->fbGpuAddress + dst_offset + (dstX - srcX) * cpp, - dst_pitch, - gPtr->fbGpuAddress + src_offset + (dstX - srcX) * cpp, - src_pitch, - (srcX + width - dstX) * cpp, height, gPtr->copyDy); - - width = dstX - srcX; - } - - if (gPtr->copyDy < 0) { - src_offset += (height - 1) * src_pitch; - dst_offset += (height - 1) * dst_pitch; - } + DPRINTF(pScrn, "%s:%d: srcX=%d srcY=%d dstX=%d dstY=%d width=%d height=%d\n", + __func__, __LINE__, srcX, srcY, dstX, dstY, width, height); Ps3GpuTransferData(pScrn, XFER_MODE_VIDEO_TO_VIDEO, gPtr->fbGpuAddress + dst_offset, dst_pitch, gPtr->fbGpuAddress + src_offset, src_pitch, - width * cpp, height, gPtr->copyDy); + width * cpp, height); } static void -- 2.11.4.GIT