summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@gmail.com>2008-08-16 13:08:25 +0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-08-16 19:16:28 -0300
commitf6110b1ef5934b45812ee95e70b1e64f44386dda (patch)
tree31df2a8cc8a4895960ca2c5b7c38094099189018
parent209097ba5b44a0ce0da7f1ea52150dcace2b5244 (diff)
Some fixes in the EXA UTS/DTS code.
In DTS: * It uses the screen Bpp inestead of the pixmap Bpp... this gives some problems when using pixmaps with different depth to the screen. In UTS: * aligned_pitch was computed from src_pitch inestead of the pixmap width. * When writing the target coordinates to the DE registers, it does y*0xFFFF inestead of y & 0xFFFF. * I renamed source_pitch to src_pixelpitch as it is very confusing to have src_pitch and source_pitch. * It isn't necessary to call WaitQueue before copying each scanline, but it seems it almost doesn't affect performance. Signed-off-by: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
-rw-r--r--src/smi_exa.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/smi_exa.c b/src/smi_exa.c
index 515f8a4..06bad95 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -434,8 +434,8 @@ SMI_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
exaWaitSync(pSrc->drawable.pScreen);
- src += (y * src_pitch) + (x * pSmi->Bpp);
- w *= pSmi->Bpp;
+ src += (y * src_pitch) + (x * pSrc->drawable.bitsPerPixel/8);
+ w *= pSrc->drawable.bitsPerPixel/8;
while (h--) {
memcpy(dst, src, w);
@@ -443,8 +443,8 @@ SMI_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
dst += dst_pitch;
}
- return TRUE;
LEAVE_PROC("SMI_DownloadFromScreen");
+ return TRUE;
}
Bool
@@ -453,7 +453,7 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
{
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
SMIPtr pSmi = SMIPTR(pScrn);
- int dst_pitch, source_pitch, align, aligned_pitch;
+ int dst_pixelpitch, src_pixelpitch, align, aligned_pitch;
unsigned long dst_offset;
ENTER_PROC("SMI_UploadToScreen");
@@ -466,11 +466,11 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
align = 128 / pDst->drawable.bitsPerPixel;
}
- aligned_pitch = (src_pitch + align - 1) & ~(align - 1);
+ aligned_pitch = ((w*pDst->drawable.bitsPerPixel >> 3) + align - 1) & ~(align - 1);
/* calculate pitch in pixel unit */
- dst_pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel >> 3);
- source_pitch = src_pitch / (pDst->drawable.bitsPerPixel >> 3);
+ dst_pixelpitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel >> 3);
+ src_pixelpitch = src_pitch / (pDst->drawable.bitsPerPixel >> 3);
/* calculate offset in 8 byte (64 bit) unit */
dst_offset = exaGetPixmapOffset(pDst) >> 3;
@@ -483,19 +483,19 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
WaitQueue(7);
/* Destination and Source Window Widths */
- WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (source_pitch & 0xFFFF));
+ WRITE_DPR(pSmi, 0x3C, (dst_pixelpitch << 16) | (src_pixelpitch & 0xFFFF));
if (pDst->drawable.bitsPerPixel == 24) {
x *= 3;
w *= 3;
- dst_pitch *= 3;
+ dst_pixelpitch *= 3;
if (pSmi->Chipset == SMI_LYNX) {
y *= 3;
}
}
/* Source and Destination Row Pitch */
- WRITE_DPR(pSmi, 0x10, (dst_pitch << 16) | (source_pitch & 0xFFFF));
+ WRITE_DPR(pSmi, 0x10, (dst_pixelpitch << 16) | (src_pixelpitch & 0xFFFF));
/* Drawing engine data format */
WRITE_DPR(pSmi, 0x1C,PIXMAP_FORMAT(pDst));
/* Source and Destination Base Address (offset) */
@@ -504,11 +504,11 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
WRITE_DPR(pSmi, 0x00, 0);
- WRITE_DPR(pSmi, 0x04, (x << 16) | (y * 0xFFFF));
+ WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF));
WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
while (h--) {
- WaitQueue(aligned_pitch);
+/* WaitQueue(aligned_pitch); */
memcpy(pSmi->DataPortBase, src, aligned_pitch);
src += src_pitch;
}