diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-12-19 20:55:14 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-12-19 20:55:14 +0000 |
commit | ac5b2461e620df7026eefda6a389127e7d41f67d (patch) | |
tree | 1620333d873b1001441ce11586a1d2cf774a0ca3 /src/smi_video.c | |
parent | 14cd4af100e1deb1c7b63e9f19587e38ce1f08f2 (diff) |
XFree86 4.3.99.902 (RC 2)xf86-4_3_99_903_specialxf86-4_3_99_902xf86-012804-2330
Diffstat (limited to 'src/smi_video.c')
-rw-r--r-- | src/smi_video.c | 112 |
1 files changed, 26 insertions, 86 deletions
diff --git a/src/smi_video.c b/src/smi_video.c index 06dcc3a..029c293 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -41,7 +41,7 @@ Author of changes: Corvin Zahn <zahn@zac.de> Date: 2.11.2001 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.13 2003/11/10 18:22:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.14 2003/12/08 16:03:58 alanh Exp $ */ #include "smi.h" #include "smi_video.h" @@ -133,11 +133,6 @@ static void SMI_WaitForSync(ScrnInfoPtr pScrn); static void SMI_InitOffscreenImages(ScreenPtr pScreen); static FBAreaPtr SMI_AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area, int numLines); -static void SMI_CopyData(unsigned char *src, unsigned char *dst, int srcPitch, - int dstPitch, int height, int width); -static void SMI_CopyYV12Data(unsigned char *src1, unsigned char *src2, - unsigned char *src3, unsigned char *dst, int srcPitch1, int srcPitch2, - int dstPitch, int height, int width); static int SMI_AllocSurface(ScrnInfoPtr pScrn, int id, unsigned short width, unsigned short height, @@ -1690,27 +1685,31 @@ SMI_PutImage( offset = (pPort->area->box.y1 * fbPitch) + (top * dstPitch); dstStart = pSmi->FBBase + offset + left; - switch (id) - { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - tmp = ((top >> 1) * srcPitch2) + (left >> 2); - offset2 += tmp; - offset3 += tmp; - nLines = ((((y2 + 0xFFFF) >> 16) + 1) & ~1) - top; - SMI_CopyYV12Data(buf + (top * srcPitch) + (left >> 1), - buf + offset2, buf + offset3, dstStart, srcPitch, srcPitch2, - dstPitch, nLines, nPixels); - break; - - default: - buf += (top * srcPitch) + left; - nLines = ((y2 + 0xFFFF) >> 16) - top; - SMI_CopyData(buf, dstStart, srcPitch, dstPitch, nLines, - nPixels * bpp); - break; - } + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + tmp = ((top >> 1) * srcPitch2) + (left >> 2); + offset2 += tmp; + offset3 += tmp; + if(id == FOURCC_I420) { + tmp = offset2; + offset2 = offset3; + offset3 = tmp; + } + nLines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1), + buf + offset2, buf + offset3, dstStart, + srcPitch, srcPitch2, dstPitch, nLines, nPixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + buf += (top * srcPitch) + left; + nLines = ((y2 + 0xffff) >> 16) - top; + xf86XVCopyPacked(buf, dstStart, srcPitch, dstPitch, nLines, nPixels); + break; + } #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0) if (!RegionsEqual(&pPort->clip, clipBoxes)) @@ -2349,65 +2348,6 @@ SMI_AllocateMemory( return(area); } -static void -SMI_CopyData( - unsigned char *src, - unsigned char *dst, - int srcPitch, - int dstPitch, - int height, - int width -) -{ - ENTER_PROC("SMI_CopyData"); - - while (height-- > 0) - { - memcpy(dst, src, width); - src += srcPitch; - dst += dstPitch; - } - - LEAVE_PROC("SMI_CopyData"); -} - -static void -SMI_CopyYV12Data( - unsigned char *src1, - unsigned char *src2, - unsigned char *src3, - unsigned char *dst, - int srcPitch1, - int srcPitch2, - int dstPitch, - int height, - int width -) -{ - CARD32 *pDst = (CARD32 *) dst; - int i, j; - - ENTER_PROC("SMI_CopyYV12Data"); - - for (j = 0; j < height; j++) - { - for (i =0; i < width; i++) - { - pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | - (src3[i] << 8) | (src2[i] << 24); - } - pDst += dstPitch >> 2; - src1 += srcPitch1; - if (j & 1) - { - src2 += srcPitch2; - src3 += srcPitch2; - } - } - - LEAVE_PROC("SMI_CopyYV12Data"); -} - static int SMI_AllocSurface( ScrnInfoPtr pScrn, |