diff options
author | Francisco Jerez <currojerez@gmail.com> | 2008-10-28 00:13:55 +0100 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-10-28 15:09:47 -0200 |
commit | 91b5613fb07fec0f319623ca7ec1efd67f04379b (patch) | |
tree | 20624de12510cfa1d9617166f2e07cfb97dd620c /src | |
parent | 0faeddb208d8fade4737be4bcadb8814696bd7b4 (diff) |
Remove shadowfb based rotation support.
Also done some clean up, like removing unused/redundant members of the
screen private structure, and removing now unused configuration file
options.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/smi.h | 171 | ||||
-rw-r--r-- | src/smi_accel.c | 33 | ||||
-rw-r--r-- | src/smi_driver.c | 57 | ||||
-rw-r--r-- | src/smi_shadow.c | 356 | ||||
-rw-r--r-- | src/smi_video.c | 177 | ||||
-rw-r--r-- | src/smi_xaa.c | 7 | ||||
-rw-r--r-- | src/smilynx_hw.c | 7 |
8 files changed, 96 insertions, 713 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index aff239f..282fbae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,7 +42,6 @@ siliconmotion_drv_la_SOURCES = \ smi_hwcurs.c \ smi_i2c.c \ smi_pcirename.h \ - smi_shadow.c \ smi_video.c \ smi_video.h \ smi_crtc.h \ @@ -106,15 +106,53 @@ typedef struct /* Global PDEV structure. */ typedef struct { - /* accel additions */ - CARD32 AccelCmd; /* Value for DPR0C */ - CARD32 Stride; /* Stride of frame buffer */ - CARD32 ScissorsLeft; /* Left/top of current - scissors */ - CARD32 ScissorsRight; /* Right/bottom of current - scissors */ - Bool ClipTurnedOn; /* Clipping was turned on by - the previous command */ + int Bpp; /* Bytes per pixel */ + int MCLK; /* Memory Clock */ + ClockRanges clockRange; /* Allowed pixel clock range */ + CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped + CloseScreen function */ + + xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */ + I2CBusPtr I2C; /* Pointer into I2C module */ + xf86Int10InfoPtr pInt10; /* Pointer to INT10 module */ + vbeInfoPtr pVbe; /* Pointer to VBE module */ + + pciVideoPtr PciInfo; /* PCI info vars */ +#ifndef XSERVER_LIBPCIACCESS + PCITAG PciTag; +#endif + int Chipset; /* Chip info, set using PCI + above */ + int ChipRev; + Bool IsSecondary; + + OptionInfoPtr Options; + Bool Dualhead; + Bool UseFBDev; + Bool PCIBurst; /* Enable PCI burst mode for + reads? */ + Bool PCIRetry; /* Enable PCI retries */ + Bool fifo_conservative; /* Adjust fifo for + acceleration? */ + Bool fifo_moderate; /* Adjust fifo for + acceleration? */ + Bool fifo_aggressive; /* Adjust fifo for + acceleration? */ + Bool HwCursor; /* hardware cursor enabled */ + + CARD8 DACmask; + int vgaCRIndex, vgaCRReg; + Bool PrimaryVidMapped; /* Flag indicating if + vgaHWMapMem was used + successfully for + this screen */ + Bool ModeStructInit; /* Flag indicating ModeReg has + been duped from console + state */ + + /* Hardware state */ + void (*Save)(ScrnInfoPtr pScrn); /* Function used to save the + current register state */ CARD8 SR18Value; /* PDR#521: original SR18 value */ CARD8 SR21Value; /* PDR#521: original SR21 @@ -123,17 +161,8 @@ typedef struct registers */ void *mode; /* XServer video state mode registers */ - xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */ - Bool ModeStructInit; /* Flag indicating ModeReg has - been duped from console - state */ - int vgaCRIndex, vgaCRReg; - int width, height; /* Width and height of the - screen */ - int Bpp; /* Bytes per pixel */ - - /* XAA */ + /* Memory layout */ int videoRAMBytes; /* In units as noted, set in PreInit */ int videoRAMKBytes; /* In units as noted, set in @@ -151,52 +180,40 @@ typedef struct CARD8 * IOBase; /* Base of MMIO VGA ports */ IOADDRESS PIOBase; /* Base of I/O ports */ unsigned char * FBBase; /* Base of FB */ + CARD32 fbMapOffset; /* offset for fb mapping */ CARD32 FBOffset; /* Current visual FB starting location */ CARD32 FBCursorOffset; /* Cursor storage location */ CARD32 FBReserved; /* Reserved memory in frame buffer */ - - Bool PrimaryVidMapped; /* Flag indicating if - vgaHWMapMem was used - successfully for - this screen */ - int MCLK; /* Memory Clock */ + + /* accel additions */ + CARD32 AccelCmd; /* Value for DPR0C */ + Bool NoAccel; /* Disable Acceleration */ + CARD32 ScissorsLeft; /* Left/top of current + scissors */ + CARD32 ScissorsRight; /* Right/bottom of current + scissors */ + Bool ClipTurnedOn; /* Clipping was turned on by + the previous command */ int GEResetCnt; /* Limit the number of errors printed using a counter */ - Bool PCIBurst; /* Enable PCI burst mode for - reads? */ - Bool PCIRetry; /* Enable PCI retries */ - Bool fifo_conservative; /* Adjust fifo for - acceleration? */ - Bool fifo_moderate; /* Adjust fifo for - acceleration? */ - Bool fifo_aggressive; /* Adjust fifo for - acceleration? */ - Bool NoAccel; /* Disable Acceleration */ - Bool HwCursor; /* hardware cursor enabled */ - Bool ShowCache; /* Debugging option */ + + /* XAA */ + CARD32 Stride; /* Stride of frame buffer */ + Bool useBIOS; /* Use BIOS for mode sets */ Bool zoomOnLCD; /* Zoom on LCD */ - - CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped - CloseScreen function */ XAAInfoRecPtr XAAInfoRec; /* XAA info Rec */ /* EXA */ ExaDriverPtr EXADriverPtr; - Bool useEXA; /* enable exa acceleration */ + Bool useEXA; /* enable exa acceleration */ + ExaOffscreenArea* fbArea; /* EXA offscreen area used + as framebuffer */ PictTransformPtr renderTransform; - pciVideoPtr PciInfo; /* PCI info vars */ -#ifndef XSERVER_LIBPCIACCESS - PCITAG PciTag; -#endif - int Chipset; /* Chip info, set using PCI - above */ - int ChipRev; - /* DGA */ DGAModePtr DGAModes; /* Pointer to DGA modes */ int numDGAModes; /* Number of DGA modes */ @@ -205,74 +222,29 @@ typedef struct /* DPMS */ int CurrentDPMS; /* Current DPMS state */ - unsigned char DPMS_SR20; /* Saved DPMS SR20 register */ -/* unsigned char DPMS_SR21; /\* Saved DPMS SR21 register *\/ */ -/* unsigned char DPMS_SR31; /\* Saved DPMS SR31 register *\/ */ - unsigned char DPMS_SR34; /* Saved DPMS SR34 register */ /* Panel information */ Bool lcd; /* LCD active, 1=DSTN, 2=TFT */ int lcdWidth; /* LCD width */ int lcdHeight; /* LCD height */ - I2CBusPtr I2C; /* Pointer into I2C module */ - xf86Int10InfoPtr pInt10; /* Pointer to INT10 module */ - vbeInfoPtr pVbe; /* Pointer to VBE module */ - - /* Shadow frame buffer (rotation) */ - Bool shadowFB; /* Flag if shadow buffer is - used */ - int rotate; /* Rotation flags */ - Bool randrRotation; /* Allow RandR rotation */ - CARD32 screenStride; /* Stride of the on-screen framebuffer */ - /* when using a shadow fb*/ - int ShadowWidthBytes; /* Width of shadow - buffer in bytes */ - int ShadowWidth; /* Width of shadow buffer in - pixels */ - int ShadowHeight; /* Height of shadow buffer in - pixels */ - CARD32 saveBufferSize; /* #670 - FB save buffer size */ - void * pSaveBuffer; /* #670 - FB save buffer */ - CARD32 fbMapOffset; /* offset for fb mapping */ - CARD32 savedFBOffset; /* #670 - Saved FBOffset value */ - CARD32 savedFBReserved; /* #670 - Saved - FBReserved value */ - CARD8 * paletteBuffer; /* #920 - Palette save buffer */ - +#if 0 /* Polylines - #671 */ ValidateGCProcPtr ValidatePolylines; /* Org. ValidatePolylines function */ Bool polyLines; /* Our polylines patch is active */ +#endif - void (*Save)(ScrnInfoPtr pScrn); - Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); - void (*PointerMoved)(int index, int x, int y); - + /* XvExtension */ int videoKey; /* Video chroma key */ Bool ByteSwap; /* Byte swap for ZV port */ Bool interlaced; /* True: Interlaced Video */ - /* XvExtension */ XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter structure */ void (*BlockHandler)(int i, pointer blockData, pointer pTimeout, pointer pReadMask); - GCPtr videoGC; - OptionInfoPtr Options; - CARD8 DACmask; - - Bool Dualhead; - Bool IsSecondary; - EntityInfoPtr pEnt; - - Bool IsSwitching; /* when switching modes */ - Bool UseFBDev; - - /* CRTCs */ - ClockRanges clockRange; - ExaOffscreenArea* fbArea; } SMIRec, *SMIPtr; #define SMIPTR(p) ((SMIPtr)((p)->driverPrivate)) @@ -390,11 +362,6 @@ void SMI_PrintRegs(ScrnInfoPtr pScrn); /* smi_dga.c */ Bool SMI_DGAInit(ScreenPtr pScrn); -/* smi_shadow.c */ -void SMI_PointerMoved(int index, int x, int y); -void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox); - /* smi_video.c */ void SMI_InitVideo(ScreenPtr pScreen); diff --git a/src/smi_accel.c b/src/smi_accel.c index 0d6af9a..f3c7974 100644 --- a/src/smi_accel.c +++ b/src/smi_accel.c @@ -96,22 +96,15 @@ SMI_EngineReset(ScrnInfoPtr pScrn) ENTER(); - pSmi->Stride = ((pSmi->width * pSmi->Bpp + 15) & ~15) / pSmi->Bpp; + pSmi->Stride = ((pScrn->virtualX * pSmi->Bpp + 15) & ~15) / pSmi->Bpp; if(pScrn->bitsPerPixel==24) pSmi->Stride *= 3; - DEDataFormat = SMI_DEDataFormat(pScrn->bitsPerPixel); + DEDataFormat = SMI_DEDataFormat(pScrn->bitsPerPixel); for (i = 0; i < sizeof(xyAddress) / sizeof(xyAddress[0]); i++) { - if (pSmi->rotate) { - if (xyAddress[i] == pSmi->height) { - DEDataFormat |= i << 16; - break; - } - } else { - if (xyAddress[i] == pSmi->width) { - DEDataFormat |= i << 16; - break; - } + if (xyAddress[i] == pScrn->virtualX) { + DEDataFormat |= i << 16; + break; } } @@ -121,13 +114,9 @@ SMI_EngineReset(ScrnInfoPtr pScrn) WRITE_DPR(pSmi, 0x24, 0xFFFFFFFF); WRITE_DPR(pSmi, 0x28, 0xFFFFFFFF); WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); - if(pSmi->shadowFB){ - WRITE_DPR(pSmi, 0x40, 0); - WRITE_DPR(pSmi, 0x44, 0); /* The shadow framebuffer is located at offset 0 */ - }else{ - WRITE_DPR(pSmi, 0x40, pSmi->FBOffset >> 3); - WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); - } + WRITE_DPR(pSmi, 0x40, pSmi->FBOffset >> 3); + WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); + CHECK_SECONDARY(pSmi); SMI_DisableClipping(pScrn); @@ -192,12 +181,12 @@ SMI_DisableClipping(ScrnInfoPtr pScrn) pSmi->ScissorsLeft = 0; if (pScrn->bitsPerPixel == 24) { if (pSmi->Chipset == SMI_LYNX) { - pSmi->ScissorsRight = ((pSmi->height * 3) << 16) | (pSmi->width * 3); + pSmi->ScissorsRight = ((pScrn->virtualY * 3) << 16) | (pScrn->virtualX * 3); } else { - pSmi->ScissorsRight = (pSmi->height << 16) | (pSmi->width * 3); + pSmi->ScissorsRight = (pScrn->virtualY << 16) | (pScrn->virtualX * 3); } } else { - pSmi->ScissorsRight = (pSmi->height << 16) | pSmi->width; + pSmi->ScissorsRight = (pScrn->virtualY << 16) | pScrn->virtualX; } pSmi->ClipTurnedOn = FALSE; diff --git a/src/smi_driver.c b/src/smi_driver.c index 90ae7ad..4e496c6 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -36,7 +36,6 @@ authorization from The XFree86 Project or Silicon Motion. #include "xf86DDC.h" #include "xf86int10.h" #include "vbe.h" -#include "shadowfb.h" #include "smi.h" #include "smi_501.h" @@ -154,7 +153,6 @@ typedef enum OPTION_PCI_RETRY, OPTION_NOACCEL, OPTION_MCLK, - OPTION_SHOWCACHE, OPTION_SWCURSOR, OPTION_HWCURSOR, OPTION_VIDEOKEY, @@ -180,13 +178,12 @@ static const OptionInfoRec SMIOptions[] = { OPTION_PCI_RETRY, "pci_retry", OPTV_BOOLEAN, {0}, TRUE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_MCLK, "set_mclk", OPTV_FREQ, {0}, FALSE }, - { OPTION_SHOWCACHE, "show_cache", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, TRUE }, { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_VIDEOKEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, { OPTION_BYTESWAP, "ByteSwap", OPTV_BOOLEAN, {0}, FALSE }, /* CZ 26.10.2001: interlaced video */ - { OPTION_INTERLACED, "Interlaced", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_INTERLACED, "Interlaced", OPTV_BOOLEAN, {0}, FALSE }, /* end CZ */ { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ZOOMONLCD, "ZoomOnLCD", OPTV_BOOLEAN, {0}, FALSE }, @@ -280,12 +277,6 @@ static const char *i2cSymbols[] = NULL }; -static const char *shadowSymbols[] = -{ - "ShadowFBInit", - NULL -}; - static const char *int10Symbols[] = { "xf86ExecX86int10", @@ -361,7 +352,7 @@ siliconmotionSetup(pointer module, pointer opts, int *errmaj, int *errmin) */ LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, exaSymbols, ramdacSymbols, ddcSymbols, i2cSymbols, int10Symbols, vbeSymbols, - shadowSymbols, NULL); + NULL); /* * The return value must be non-NULL on success even though there @@ -549,7 +540,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) SMI_FreeRec(pScrn); RETURN(FALSE); } - pSmi->pEnt = pEnt; pSmi->PciInfo = xf86GetPciInfoForEntity(pEnt->index); /* Set pScrn->monitor */ @@ -695,13 +685,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) pSmi->NoAccel = FALSE; } - if (xf86ReturnOptValBool(pSmi->Options, OPTION_SHOWCACHE, FALSE)) { - pSmi->ShowCache = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: show_cache set\n"); - } else { - pSmi->ShowCache = FALSE; - } - if (IS_MSOC(pSmi)) { from = X_DEFAULT; if (xf86GetOptValBool(pSmi->Options, OPTION_USE_FBDEV, &pSmi->UseFBDev)) @@ -931,8 +914,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) SMI_DetectMCLK(pScrn); - pSmi->IsSwitching = FALSE; - /* * Setup the ClockRanges, which describe what clock ranges are available, * and what sort of modes they can be used for. @@ -1019,14 +1000,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(ramdacSymbols, NULL); } - if (pSmi->shadowFB) { - if (!xf86LoadSubModule(pScrn, "shadowfb")) { - SMI_FreeRec(pScrn); - RETURN(FALSE); - } - xf86LoaderReqSymLists(shadowSymbols, NULL); - } - RETURN(TRUE); } @@ -1724,29 +1697,19 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (pSmi->NoAccel || !pSmi->useEXA) { int numLines; BoxRec AvailFBArea; - RegionRec AvailFBRegion; - pSmi->width = pScrn->virtualX; - pSmi->height = pScrn->virtualY; - pSmi->Stride = (pSmi->width * pSmi->Bpp + 15) & ~15; numLines = pSmi->FBReserved / (pScrn->displayWidth * pSmi->Bpp); AvailFBArea.x1 = 0; - if(pSmi->randrRotation) /* The rotated mode could need more memory */ - AvailFBArea.y1= max(((pScrn->virtualX * pSmi->Bpp + 15) & ~15) * - pScrn->virtualY, - ((pScrn->virtualY * pSmi->Bpp + 15) & ~15) * - pScrn->virtualX) / (pScrn->virtualX * pSmi->Bpp); - else - AvailFBArea.y1 = pScrn->virtualY; + AvailFBArea.y1 = 0; AvailFBArea.x2 = pScrn->virtualX; AvailFBArea.y2 = numLines; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FrameBuffer Box: %d,%d - %d,%d\n", AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2); - REGION_INIT(pScreen, &AvailFBRegion, &AvailFBArea, 1); - xf86InitFBManagerRegion(pScreen, &AvailFBRegion); - REGION_UNINIT(pScreen, &AvailFBRegion); + + xf86InitFBManager(pScreen, &AvailFBArea); } /* Initialize acceleration layer */ @@ -1890,14 +1853,6 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen) if (pSmi->BlockHandler != NULL) { pScreen->BlockHandler = pSmi->BlockHandler; } - /* #670 */ - if (pSmi->pSaveBuffer) { - xfree(pSmi->pSaveBuffer); - } -/* #920 */ - if (pSmi->paletteBuffer) { - xfree(pSmi->paletteBuffer); - } pScrn->vtSema = FALSE; pScreen->CloseScreen = pSmi->CloseScreen; diff --git a/src/smi_shadow.c b/src/smi_shadow.c deleted file mode 100644 index b015580..0000000 --- a/src/smi_shadow.c +++ /dev/null @@ -1,356 +0,0 @@ -/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_shadow.c-arc 1.10 30 Nov 2000 11:40:38 Frido $ */ - -/* -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. -Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the names of the XFree86 Project and -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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#include "shadowfb.h" -#include "servermd.h" - -#include "smi.h" - -/******************************************************************************\ -|* SMI_RefreshArea -|*============================================================================= -|* -|* PARAMETERS: pScrn Pointer to ScrnInfo structure. -|* num Number of boxes to refresh. -|* pbox Pointer to an array of boxes to refresh. -|* -|* DESCRIPTION: Refresh a portion of the shadow buffer to the visual screen -|* buffer. This is mainly used for rotation purposes. -|* -|* RETURNS: Nothing. -|* -\******************************************************************************/ -void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) -{ - SMIPtr pSmi = SMIPTR(pScrn); - int width, height, srcX, srcY, destX, destY; - - ENTER(); - - /* #671 */ - if (pSmi->polyLines) { - pSmi->polyLines = FALSE; - LEAVE(); - return; - } - - WaitIdle(); - if(pSmi->useEXA) /* Some other function may have set SMI_QUICK_START */ - WRITE_DPR(pSmi, 0x0C, 0); - - WRITE_DPR(pSmi, 0x10, ((pSmi->screenStride) << 16) | (pSmi->Stride)); - WRITE_DPR(pSmi, 0x3C, ((pSmi->screenStride) << 16) | (pSmi->Stride)); - - WRITE_DPR(pSmi, 0x40, 0); /*Source offset = Shadow FB*/ - WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); /* Destination = Screen FB*/ - - WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pScrn->bitsPerPixel)); - - /* #672 */ - if (pSmi->ClipTurnedOn) { - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } - - while (num--) { - /* Get coordinates of the box to refresh. */ - srcX = pbox->x1; - srcY = pbox->y1; - width = pbox->x2 - srcX; - height = pbox->y2 - srcY; - - DEBUG("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; - - WaitQueue(); - 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); - 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; - - WaitQueue(); - 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); - break; - default: - /* No rotation, perform a normal copy. */ - if (pScrn->bitsPerPixel == 24) { - srcX *= 3; - width *= 3; - - if (pSmi->Chipset == SMI_LYNX) { - srcY *= 3; - } - } - - WaitQueue(); - 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, 0xCC | SMI_BITBLT | SMI_START_ENGINE); - break; - } - } - - pbox++; - } - - WaitIdle(); - WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x44, 0); - - LEAVE(); -} - -/* 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(); - - /* #671 */ - if (pSmi->polyLines) { - pSmi->polyLines = FALSE; - LEAVE(); - return; - } - - WaitIdle(); - if(pSmi->useEXA) /* Some other function may have set SMI_QUICK_START */ - WRITE_DPR(pSmi, 0x0C, 0); - - WRITE_DPR(pSmi, 0x10, ((pSmi->screenStride) << 16) | (pSmi->Stride)); - WRITE_DPR(pSmi, 0x3C, ((pSmi->screenStride) << 16) | (pSmi->Stride)); - - WRITE_DPR(pSmi, 0x40, 0); /*Source offset = Shadow FB*/ - WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); /* Destination = Screen FB*/ - - WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pScrn->bitsPerPixel)); - - /* #672 */ - if (pSmi->ClipTurnedOn) { - 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("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(); - 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(); - 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(); - 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, 0xCC | SMI_BITBLT | SMI_START_ENGINE); - break; - } - } - - pbox++; - } - - WaitIdle(); - WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x44, 0); - - LEAVE(); -} - -/******************************************************************************\ -|* SMI_PointerMoved -|*============================================================================= -|* -|* PARAMETERS: index Index of current screen. -|* x X location of pointer. -|* y Y location of pointer. -|* -|* DESCRIPTION: Adjust the pointer location if we are in rotation mode. -|* -|* RETURNS: Nothing. -|* -\******************************************************************************/ -void SMI_PointerMoved(int index, int x, int y) -{ - ScrnInfoPtr pScrn = xf86Screens[index]; - SMIPtr pSmi = SMIPTR(pScrn); - int newX, newY; - - switch (pSmi->rotate) { - case SMI_ROTATE_CW: - /* 90 degrees CW rotation. */ - newX = pScrn->pScreen->height - y - 1; - newY = x; - break; - case SMI_ROTATE_CCW: - /* 90 degrees CCW rotation. */ - newX = y; - newY = pScrn->pScreen->width - x - 1; - break; - default: - /* No rotation. */ - newX = x; - newY = y; - break; - } - - /* Pass adjusted pointer coordinates original PointerMoved function. */ - (*pSmi->PointerMoved)(index, newX, newY); -} - diff --git a/src/smi_video.c b/src/smi_video.c index 4df0d74..4a06d75 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -81,37 +81,6 @@ The default value can be set with the driver option Interlaced #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -#define ROTATE_COORDS(x,y) do{ \ - long x0=x; \ - if(pSmi->rotate==SMI_ROTATE_CCW){ \ - x = pScrn->virtualY - y; y = x0; \ - }else{ \ - x = y; y = pScrn->virtualX - x0; \ - } \ - }while(0) - -#define UNROTATE_COORDS(x,y) do{ \ - long x0=x; \ - if(pSmi->rotate==SMI_ROTATE_CW){ \ - x = pScrn->virtualX - y; y = x0; \ - }else{ \ - x = y; y = pScrn->virtualY - x0; \ - } \ - }while(0) - -#define ROTATE_DIMS(w,h) do{ long w0=w; w=h; h=w0; } while(0) -#define UNROTATE_DIMS(w,h) ROTATE_DIMS(w,h) - -#define ROTATE_BOX(b) do{ \ - if(pSmi->rotate==SMI_ROTATE_CCW) ROTATE_DIMS(b.y1,b.y2); \ - else ROTATE_DIMS(b.x1,b.x2); \ - ROTATE_COORDS(b.x1,b.y1); ROTATE_COORDS(b.x2,b.y2); } while(0) -#define UNROTATE_BOX(b) do{ \ - if(pSmi->rotate==SMI_ROTATE_CW) ROTATE_DIMS(b.y1,b.y2); \ - else ROTATE_DIMS(b.x1,b.x2); \ - UNROTATE_COORDS(b.x1,b.y1); UNROTATE_COORDS(b.x2,b.y2); } while(0) - - #if SMI_USE_VIDEO #include "dixstruct.h" @@ -146,9 +115,6 @@ static int SMI_QueryImageAttributes(ScrnInfoPtr pScrn, int id, unsigned short *width, unsigned short *height, int *picthes, int *offsets); -static Bool SMI_ClipVideo(ScrnInfoPtr pScrn, BoxPtr dst, - INT32 *x1, INT32 *y1, INT32 *x2, INT32 *y2, - RegionPtr reg, INT32 width, INT32 height); static void SMI_DisplayVideo(ScrnInfoPtr pScrn, int id, int offset, short width, short height, int pitch, int x1, int y1, int x2, int y2, BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h); @@ -669,12 +635,9 @@ SMI_InitVideo(ScreenPtr pScreen) DEBUG("numAdaptors=%d\n", numAdaptors); -/* if (psmi->rotate == 0) */ -/* { */ - newAdaptor = SMI_SetupVideo(pScreen); - DEBUG("newAdaptor=%p\n", newAdaptor); - SMI_InitOffscreenImages(pScreen); -/* } */ + newAdaptor = SMI_SetupVideo(pScreen); + DEBUG("newAdaptor=%p\n", newAdaptor); + SMI_InitOffscreenImages(pScreen); if (newAdaptor != NULL) { if (numAdaptors == 0) { @@ -1755,140 +1718,6 @@ SMI_QueryImageAttributes( ** S U P P O R T F U N C T I O N S ** ** ** \******************************************************************************/ -#if 0 -static void -SMI_WaitForSync( - ScrnInfoPtr pScrn -) -{ - SMIPtr pSmi = SMIPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); - int vgaIOBase = hwp->IOBase; - int vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET; - int vgaCRData = vgaIOBase + VGA_CRTC_DATA_OFFSET; - - VerticalRetraceWait(); -} -#endif - -static Bool -SMI_ClipVideo( - ScrnInfoPtr pScrn, - BoxPtr dst, - INT32 *x1, - INT32 *y1, - INT32 *x2, - INT32 *y2, - RegionPtr reg, - INT32 width, - INT32 height -) -{ - SMIPtr pSmi = SMIPTR(pScrn); - INT32 vscale, hscale; - int diff; - RegionRec VPReg; - BoxRec VPBox = { pScrn->frameX0 , pScrn->frameY0, - pScrn->frameX1 + 1 , pScrn->frameY1 + 1}; - BoxPtr extents = REGION_EXTENTS(pScreen, reg); - - ENTER(); - DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - - /* Rotate the viewport before clipping */ - if (pSmi->rotate) - ROTATE_BOX(VPBox); - REGION_INIT(pScrn->pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(pScrn->pScreen, reg, reg, &VPReg); - REGION_UNINIT(pScrn->pScreen, &VPReg); - - /* PDR#941 */ - extents->x1 = max(extents->x1, VPBox.x1); - extents->y1 = max(extents->y1, VPBox.y1); - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *y1 <<= 16; - *x2 <<= 16; *y2 <<= 16; - - DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - - diff = extents->x1 - dst->x1; - if (diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - - diff = extents->y1 - dst->y1; - if (diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - - diff = dst->x2 - extents->x2; - if (diff > 0) { - dst->x2 = extents->x2; /* PDR#687 */ - *x2 -= diff * hscale; - } - - diff = dst->y2 - extents->y2; - if (diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - - if (*x1 < 0) { - diff = (-*x1 + hscale - 1) / hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - - if (*y1 < 0) { - diff = (-*y1 + vscale - 1) / vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - - DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - -#if 0 /* aaa was macht dieser code? */ - delta = *x2 - (width << 16); - if (delta > 0) - { - diff = (delta + hscale - 1) / hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - - delta = *y2 - (height << 16); - if (delta > 0) - { - diff = (delta + vscale - 1) / vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } -#endif - - DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - - if ((*x1 >= *x2) || (*y1 >= *y2)) - RETURN(FALSE); - - if ((dst->x1 != extents->x1) || (dst->y1 != extents->y1) || - (dst->x2 != extents->x2) || (dst->y2 != extents->y2)) { - RegionRec clipReg; - REGION_INIT(pScrn->pScreen, &clipReg, dst, 1); - REGION_INTERSECT(pScrn->pScreen, reg, reg, &clipReg); - REGION_UNINIT(pScrn->pScreen, &clipReg); - } - - DEBUG("ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16); - - RETURN(TRUE); -} static void SMI_DisplayVideo( diff --git a/src/smi_xaa.c b/src/smi_xaa.c index 4ffda45..c4b8316 100644 --- a/src/smi_xaa.c +++ b/src/smi_xaa.c @@ -60,10 +60,11 @@ static void SMI_SetupForImageWrite(ScrnInfoPtr, int, unsigned int, int, int, int); static void SMI_SubsequentImageWriteRect(ScrnInfoPtr, int, int, int, int, int); #endif +#if 0 /* #671 */ static void SMI_ValidatePolylines(GCPtr, unsigned long, DrawablePtr); static void SMI_Polylines(DrawablePtr, GCPtr, int, int, DDXPointPtr); - +#endif Bool SMI_XAAInit(ScreenPtr pScreen) @@ -215,10 +216,12 @@ SMI_XAAInit(ScreenPtr pScreen) #endif ret = XAAInit(pScreen, infoPtr); +#if 0 if (ret && pSmi->shadowFB) /* #671 */ { pSmi->ValidatePolylines = infoPtr->ValidatePolylines; infoPtr->ValidatePolylines = SMI_ValidatePolylines; } +#endif RETURN(ret); } @@ -763,6 +766,7 @@ SMI_SubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, } #endif +#if 0 /******************************************************************************/ /* Polylines #671 */ /******************************************************************************/ @@ -915,3 +919,4 @@ SMI_Polylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, LEAVE(); } +#endif diff --git a/src/smilynx_hw.c b/src/smilynx_hw.c index 41223e1..d909531 100644 --- a/src/smilynx_hw.c +++ b/src/smilynx_hw.c @@ -325,9 +325,6 @@ void SMILynx_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore) { SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - int i; CARD8 tmp; CARD32 offset; @@ -336,9 +333,7 @@ SMILynx_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore) int vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET; int vgaCRData = vgaIOBase + VGA_CRTC_DATA_OFFSET; - /* Wait for engine to become idle */ - if (pSmi->IsSwitching) - WaitIdle(); + ENTER(); if (pSmi->useBIOS && pSmi->pInt10 != NULL && restore->mode != 0) { pSmi->pInt10->num = 0x10; |