diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/smi_accel.c | 4 | ||||
-rw-r--r-- | src/smi_dac.c | 6 | ||||
-rw-r--r-- | src/smi_dga.c | 6 | ||||
-rw-r--r-- | src/smi_driver.c | 4 | ||||
-rw-r--r-- | src/smi_hwcurs.c | 78 | ||||
-rw-r--r-- | src/smi_i2c.c | 6 | ||||
-rw-r--r-- | src/smi_shadow.c | 162 | ||||
-rw-r--r-- | src/smi_video.c | 4 |
8 files changed, 265 insertions, 5 deletions
diff --git a/src/smi_accel.c b/src/smi_accel.c index 0c70973..1dc6608 100644 --- a/src/smi_accel.c +++ b/src/smi_accel.c @@ -28,6 +28,10 @@ authorization from the XFree86 Project and silicon Motion. */ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.7tsi Exp $ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "smi.h" #include "miline.h" diff --git a/src/smi_dac.c b/src/smi_dac.c index 627b892..7489ddd 100644 --- a/src/smi_dac.c +++ b/src/smi_dac.c @@ -26,7 +26,11 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c,v 1.2 2001/11/30 12:11:59 eich Exp $ */ +/* $XFree86$ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "smi.h" diff --git a/src/smi_dga.c b/src/smi_dga.c index 9f090b9..4b7a2fa 100644 --- a/src/smi_dga.c +++ b/src/smi_dga.c @@ -26,7 +26,11 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c,v 1.2 2001/02/15 18:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/smi_driver.c b/src/smi_driver.c index 53999fd..169a736 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -28,6 +28,10 @@ authorization from The XFree86 Project or Silicon Motion. */ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.36tsi Exp $ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "xf86Resources.h" #include "xf86RAC.h" #include "xf86DDC.h" diff --git a/src/smi_hwcurs.c b/src/smi_hwcurs.c index b2f8d69..003e7ef 100644 --- a/src/smi_hwcurs.c +++ b/src/smi_hwcurs.c @@ -26,7 +26,11 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.2 2001/03/03 22:26:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "cursorstr.h" #include "smi.h" @@ -211,6 +215,17 @@ SMI_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | ((pSmi->FBCursorOffset / 2048) >> 8)); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + /* put address in upper word, and disable the cursor */ + fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCCOLORS; + fpr15c |= (pSmi->FBCursorOffset / 2048) << 16; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + /* Copy cursor image to framebuffer storage */ memcpy(pSmi->FBBase + pSmi->FBCursorOffset, src, 1024); @@ -229,6 +244,17 @@ SMI_ShowCursor(ScrnInfoPtr pScrn) tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | 0x80); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + /* turn on the top bit */ + fpr15c = READ_FPR(pSmi, FPR15C); + fpr15c |= FPR15C_MASK_HWCENABLE; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + LEAVE_PROC("SMI_ShowCursor"); } @@ -244,6 +270,17 @@ SMI_HideCursor(ScrnInfoPtr pScrn) tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp & ~0x80); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + /* turn off the top bit */ + fpr15c = READ_FPR(pSmi, FPR15C); + fpr15c &= ~FPR15C_MASK_HWCENABLE; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + LEAVE_PROC("SMI_HideCursor"); } @@ -301,6 +338,34 @@ SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8B, 0x08); } + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr158; + + if (xoff >= 0) + { + fpr158 = (xoff & FPR158_MASK_MAXBITS)<<16; + } + else + { + fpr158 = (((-xoff) & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY)<<16; + } + + if (yoff >= 0) + { + fpr158 |= (yoff & FPR158_MASK_MAXBITS); + } + else + { + fpr158 |= (((-yoff) & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY); + } + + /* Program combined coordinates */ + WRITE_FPR(pSmi, FPR158, fpr158); + + } + LEAVE_PROC("SMI_SetCursorPosition"); } @@ -326,6 +391,17 @@ SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8C, packedFG); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8D, packedBG); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCADDREN; + fpr15c |= packedFG; + fpr15c |= packedBG<<8; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + LEAVE_PROC("SMI_SetCursorColors"); } diff --git a/src/smi_i2c.c b/src/smi_i2c.c index 3a73ced..9b7bf30 100644 --- a/src/smi_i2c.c +++ b/src/smi_i2c.c @@ -26,7 +26,11 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c,v 1.2 2001/12/20 21:35:39 eich Exp $ */ +/* $XFree86$ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/smi_shadow.c b/src/smi_shadow.c index 5ef9ba5..ffc488f 100644 --- a/src/smi_shadow.c +++ b/src/smi_shadow.c @@ -26,7 +26,11 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "xf86.h" #include "xf86_OSproc.h" @@ -181,6 +185,162 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) LEAVE_PROC("SMI_RefreshArea"); } +/* Custom version for the 730 series (Cougar3DR). + This chipset has problems with large rotate-blts. */ + +void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SMIPtr pSmi = SMIPTR(pScrn); + int width, height, srcX, srcY, destX, destY; + int maxPixels, tempWidth; + + ENTER_PROC("SMI_RefreshArea730"); + + /* #671 */ + if (pSmi->polyLines) + { + pSmi->polyLines = FALSE; + return; + } + + if (pSmi->rotate) + { + /* IF we need to do rotation, setup the hardware here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); + } + + /* #672 */ + if (pSmi->ClipTurnedOn) + { + WaitQueue(1); + WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); + pSmi->ClipTurnedOn = FALSE; + } + + /* SM731 cannot rotate-blt more than a certain number of pixels + (based on a calculation from the Windows driver source */ + maxPixels = 1280 / pScrn->bitsPerPixel; + + while (num--) + { + /* Get coordinates of the box to refresh. */ + srcX = pbox->x1; + srcY = pbox->y1; + width = pbox->x2 - srcX; + height = pbox->y2 - srcY; + + DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); + + if ((width > 0) && (height > 0)) + { + switch (pSmi->rotate) + { + case SMI_ROTATE_CW: + /* 90 degrees CW rotation. Calculate destination + coordinates: + + *---+ + | | +-----* + | | | | destX = shadowHeight - srcY - 1 + | | --> | | destY = srcX + | | | | + | | +-----+ + +---+ + */ + destX = pSmi->ShadowHeight - srcY - 1; + destY = srcX; + + for (tempWidth=width; tempWidth>0;) + { + if (width>maxPixels) + width = maxPixels; + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CW | SMI_START_ENGINE); + destY += maxPixels; + srcX += maxPixels; + tempWidth -= maxPixels; + width = tempWidth; + } + + break; + + case SMI_ROTATE_CCW: + /* 90 degrees CCW rotatation. Calculate destination + coordinates: + + *---+ + | | +-----+ + | | | | destX = srcY + | | --> | | destY = shadowWidth - srcX - 1 + | | | | + | | *-----+ + +---+ + */ + destX = srcY; + destY = pSmi->ShadowWidth - srcX - 1; + + for (tempWidth=width; tempWidth>0;) + { + if (width>maxPixels) + width = maxPixels; + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CCW | SMI_START_ENGINE); + destY -= maxPixels; + srcX += maxPixels; + tempWidth -= maxPixels; + width = tempWidth; + } + + break; + + default: + /* No rotation, perform a normal copy. */ + if (pScrn->bitsPerPixel == 24) + { + srcX *= 3; + width *= 3; + + if (pSmi->Chipset == SMI_LYNX) + { + srcY *= 3; + } + } + + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, SMI_BITBLT + SMI_START_ENGINE + 0xCC); + break; + } + } + + pbox++; + } + + if (pSmi->rotate) + { + /* If we did a rotation, we need to restore the hardware state here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x44, 0); + } + + LEAVE_PROC("SMI_RefreshArea730"); +} + /******************************************************************************\ |* SMI_PointerMoved |*============================================================================= diff --git a/src/smi_video.c b/src/smi_video.c index ed18d30..67c58c0 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -44,6 +44,10 @@ Date: 2.11.2001 /* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.3 2004/07/31 01:21:51 anholt Exp $ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.13 2003/11/10 18:22:26 tsi Exp $ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "smi.h" #include "smi_video.h" |