diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-25 19:57:05 -0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-25 19:57:05 -0200 |
commit | 06c78cee718a86b1521c1fc1075d08bb9ad257f1 (patch) | |
tree | 2d5a97ef42bdbf10a93373279fc88bbe3d41f722 /src | |
parent | 9570cfdc132b0acb1d2b70edc6a3a5a812ef9691 (diff) |
Remove smi_dga.c and polylines code from smi_xaa.c.
DGA was also not being properly test to not enable the pSmi fields,
but since the dga implementation is very basic, it is better to just
remove it (if compiling the sources on pre 1.4 X Server, DGA will be
disabled).
The polylines code in xmi_xaa.c was already if 0'ed for some time,
but it may be reinstantiated to accelerate (back) xaa rotated modes.
Currently only randr+exa accelerates rotated modes.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/smi.h | 17 | ||||
-rw-r--r-- | src/smi_dga.c | 279 | ||||
-rw-r--r-- | src/smi_driver.c | 3 | ||||
-rw-r--r-- | src/smi_xaa.c | 160 |
5 files changed, 0 insertions, 463 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5170211..811b456 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,7 +51,3 @@ siliconmotion_drv_la_SOURCES = \ smilynx.h \ smi501_crtc.c \ smi501_output.c - -if !XMODES -siliconmotion_drv_la_SOURCES += smi_dga.c -endif @@ -245,14 +245,6 @@ typedef struct as framebuffer */ PictTransformPtr renderTransform; -#ifndef XMODES - /* DGA */ - DGAModePtr DGAModes; /* Pointer to DGA modes */ - int numDGAModes; /* Number of DGA modes */ - Bool DGAactive; /* Flag if DGA is active */ - int DGAViewportStatus; -#endif - /* DPMS */ int CurrentDPMS; /* Current DPMS state */ @@ -261,15 +253,6 @@ typedef struct int lcdWidth; /* LCD width */ int lcdHeight; /* LCD height */ -#if 0 - /* Polylines - #671 */ - ValidateGCProcPtr ValidatePolylines; /* Org. - ValidatePolylines - function */ - Bool polyLines; /* Our polylines patch is - active */ -#endif - /* XvExtension */ int videoKey; /* Video chroma key */ Bool ByteSwap; /* Byte swap for ZV port */ diff --git a/src/smi_dga.c b/src/smi_dga.c deleted file mode 100644 index e0758ca..0000000 --- a/src/smi_dga.c +++ /dev/null @@ -1,279 +0,0 @@ -/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_dga.c-arc 1.5 27 Nov 2000 15:47:18 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 "xf86Pci.h" -#include "xf86PciInfo.h" -#include "xaa.h" -#include "xaalocal.h" - -#include "smi.h" -#include "dgaproc.h" - -static Bool SMI_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *, - int *, int *); -static Bool SMI_SetMode(ScrnInfoPtr, DGAModePtr); -static int SMI_GetViewport(ScrnInfoPtr); -static void SMI_SetViewport(ScrnInfoPtr, int, int, int); -static void SMI_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); -static void SMI_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -static void SMI_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); - -static -DGAFunctionRec SMI_DGAFuncs = -{ - SMI_OpenFramebuffer, - NULL, - SMI_SetMode, - SMI_SetViewport, - SMI_GetViewport, - SMI_AccelSync, - SMI_FillRect, - SMI_BlitRect, - SMI_BlitTransRect -}; - -Bool -SMI_DGAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SMIPtr pSmi = SMIPTR(pScrn); - DGAModePtr modes = NULL, newmodes = NULL, currentMode; - DisplayModePtr pMode, firstMode; - int Bpp = pScrn->bitsPerPixel >> 3; - int num = 0; - Bool ret; - - ENTER(); - - pMode = firstMode = pScrn->modes; - - while (pMode) { - newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); - if (newmodes == NULL) { - xfree(modes); - LEAVE(FALSE); - } - - modes = newmodes; - - currentMode = modes + num; - num++; - - currentMode->mode = pMode; - currentMode->flags = DGA_PIXMAP_AVAILABLE; - if (!pSmi->NoAccel) { - currentMode->flags |= DGA_FILL_RECT - | DGA_BLIT_RECT - | DGA_BLIT_RECT_TRANS; - } - if (pMode->Flags & V_DBLSCAN) { - currentMode->flags |= DGA_DOUBLESCAN; - } - if (pMode->Flags & V_INTERLACE) { - currentMode->flags |= DGA_INTERLACED; - } - - currentMode->byteOrder = pScrn->imageByteOrder; - currentMode->depth = pScrn->depth; - currentMode->bitsPerPixel = pScrn->bitsPerPixel; - currentMode->red_mask = pScrn->mask.red; - currentMode->green_mask = pScrn->mask.green; - currentMode->blue_mask = pScrn->mask.blue; - currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; - currentMode->viewportWidth = pMode->HDisplay; - currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = (Bpp == 3) ? 8 : (8 / Bpp); - currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = 0; - currentMode->address = pSmi->FBBase; - - xf86ErrorFVerb(VERBLEV, "\tSMI_DGAInit %dx%d @ %d bpp\n", - currentMode->viewportWidth, currentMode->viewportHeight, - currentMode->bitsPerPixel); - - currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 15) & ~15L; - currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = pSmi->FBReserved / currentMode->bytesPerScanline; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - currentMode->viewportWidth; - currentMode->maxViewportY = currentMode->imageHeight - currentMode->viewportHeight; - - pMode = pMode->next; - if (pMode == firstMode) { - break; - } - } - - pSmi->numDGAModes = num; - pSmi->DGAModes = modes; - - ret = DGAInit(pScreen, &SMI_DGAFuncs, modes, num); - - LEAVE(ret); -} - -static Bool -SMI_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) -{ - static int OldDisplayWidth[MAXSCREENS]; - int index = pScrn->pScreen->myNum; - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (pMode == NULL) { - /* restore the original mode */ - - /* put the ScreenParameters back */ - pScrn->displayWidth = OldDisplayWidth[index]; - - SMI_SwitchMode(index, pScrn->currentMode, 0); - pSmi->DGAactive = FALSE; - } else { - if (!pSmi->DGAactive) { - /* save the old parameters */ - OldDisplayWidth[index] = pScrn->displayWidth; - - pSmi->DGAactive = TRUE; - } - - pScrn->displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3); - - SMI_SwitchMode(index, pMode->mode, 0); - } - - LEAVE(TRUE); -} - - -static int -SMI_GetViewport(ScrnInfoPtr pScrn) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - LEAVE(pSmi->DGAViewportStatus); -} - -static void -SMI_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - SMI_AdjustFrame(pScrn->pScreen->myNum, x, y, flags); - pSmi->DGAViewportStatus = 0; - - LEAVE(); -} - -static void -SMI_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (pSmi->XAAInfoRec) { - (*pSmi->XAAInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*pSmi->XAAInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(pSmi->XAAInfoRec); - } - - LEAVE(); -} - -static void -SMI_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, - int dsty) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (pSmi->XAAInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pSmi->XAAInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, ~0, -1); - (*pSmi->XAAInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pSmi->XAAInfoRec); - } - - LEAVE(); -} - -static void -SMI_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, - int dsty, unsigned long color) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (pSmi->XAAInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pSmi->XAAInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, ~0, color); - (*pSmi->XAAInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pSmi->XAAInfoRec); - } - - LEAVE(); -} - -static Bool -SMI_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem, - int *size, int *offset, int *flags) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - *name = NULL; /* no special device */ - *mem = (unsigned char*)pSmi->FBBase; - *size = pSmi->videoRAMBytes; - *offset = 0; - *flags = DGA_NEED_ROOT; - - LEAVE(TRUE); -} - diff --git a/src/smi_driver.c b/src/smi_driver.c index 2d88a76..8449eb9 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -1820,9 +1820,6 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen) exaDriverFini(pScreen); pSmi->EXADriverPtr = NULL; } - if (pSmi->DGAModes != NULL) { - xfree(pSmi->DGAModes); - } if (pSmi->pInt10 != NULL) { xf86FreeInt10(pSmi->pInt10); pSmi->pInt10 = NULL; diff --git a/src/smi_xaa.c b/src/smi_xaa.c index 5b9e32d..29b7c4d 100644 --- a/src/smi_xaa.c +++ b/src/smi_xaa.c @@ -60,11 +60,6 @@ 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) @@ -724,158 +719,3 @@ SMI_SubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, LEAVE(); } #endif - -#if 0 -/******************************************************************************/ -/* Polylines #671 */ -/******************************************************************************/ - -/* - -In order to speed up the "logout" screen in rotated modes, we need to intercept -the Polylines function. Normally, the polylines are drawn and the shadowFB is -then sending a request of the bounding rectangle of those poylines. This should -be okay, if it weren't for the fact that the Gnome logout screen is drawing -polylines in rectangles and this asks for a rotation of the entire rectangle. -This is very slow. - -To circumvent this slowness, we intercept the ValidatePolylines function and -override the default "Fallback" Polylines with our own Polylines function. Our -Polylines function first draws the polylines through the original Fallback -function and then rotates the lines, line by line. We then set a flag and -return control to the shadowFB which will try to rotate the bounding rectangle. -However, the flag has been set and the RefreshArea function does nothing but -clear the flag so the next Refresh that comes in shoiuld be handled correctly. - -All this code improves the speed quite a bit. - -*/ - -#define IS_VISIBLE(pWin) \ -( \ - pScrn->vtSema \ - && (((WindowPtr) pWin)->visibility != VisibilityFullyObscured) \ -) - -#define TRIM_BOX(box, pGC) \ -{ \ - BoxPtr extents = &pGC->pCompositeClip->extents; \ - if (box.x1 < extents->x1) box.x1 = extents->x1; \ - if (box.y1 < extents->y1) box.y1 = extents->y1; \ - if (box.x2 > extents->x2) box.x2 = extents->x2; \ - if (box.y2 > extents->y2) box.y2 = extents->y2; \ -} - -#define TRANSLATE_BOX(box, pDraw) \ -{ \ - box.x1 += pDraw->x; \ - box.y1 += pDraw->y; \ - box.x2 += pDraw->x; \ - box.y2 += pDraw->y; \ -} - -#define BOX_NOT_EMPTY(box) \ - ((box.x2 > box.x1) && (box.y2 > box.y1)) - -static void -SMI_ValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - SMIPtr pSmi = SMIPTR(infoRec->pScrn); - - ENTER(); - - pSmi->ValidatePolylines(pGC, changes, pDraw); - if (pGC->ops->Polylines == XAAGetFallbackOps()->Polylines) { - /* Override the Polylines function with our own Polylines function. */ - pGC->ops->Polylines = SMI_Polylines; - } - - LEAVE(); -} - -static void -SMI_Polylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt, - DDXPointPtr pptInit) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - ScrnInfoPtr pScrn = infoRec->pScrn; - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - /* Call the original Polylines function. */ - pGC->ops->Polylines = XAAGetFallbackOps()->Polylines; - (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - pGC->ops->Polylines = SMI_Polylines; - - if (IS_VISIBLE(pDraw) && npt) { - /* Allocate a temporary buffer for all segments of the polyline. */ - BoxPtr pBox = xnfcalloc(sizeof(BoxRec), npt); - int extra = pGC->lineWidth >> 1, box; - - if (npt > 1) { - /* Adjust the extra space required per polyline segment. */ - if (pGC->joinStyle == JoinMiter) { - extra = 6 * pGC->lineWidth; - } else if (pGC->capStyle == CapProjecting) { - extra = pGC->lineWidth; - } - } - - for (box = 0; --npt;) { - /* Setup the bounding box for one polyline segment. */ - pBox[box].x1 = pptInit->x; - pBox[box].y1 = pptInit->y; - pptInit++; - pBox[box].x2 = pptInit->x; - pBox[box].y2 = pptInit->y; - if (mode == CoordModePrevious) { - pBox[box].x2 += pBox[box].x1; - pBox[box].y2 += pBox[box].y1; - } - - /* Sort coordinates. */ - if (pBox[box].x1 > pBox[box].x2) { - int tmp = pBox[box].x1; - pBox[box].x1 = pBox[box].x2; - pBox[box].x2 = tmp; - } - if (pBox[box].y1 > pBox[box].y2) { - int tmp = pBox[box].y1; - pBox[box].y1 = pBox[box].y2; - pBox[box].y2 = tmp; - } - - /* Add extra space required for each polyline segment. */ - pBox[box].x1 -= extra; - pBox[box].y1 -= extra; - pBox[box].x2 += extra + 1; - pBox[box].y2 += extra + 1; - - /* See if we need to draw this polyline segment. */ - TRANSLATE_BOX(pBox[box], pDraw); - TRIM_BOX(pBox[box], pGC); - if (BOX_NOT_EMPTY(pBox[box])) { - box++; - } - } - - if (box) { - /* Refresh all polyline segments now. */ - if (pSmi->Chipset == SMI_COUGAR3DR) { - SMI_RefreshArea730(pScrn, box, pBox); - } else { - SMI_RefreshArea(pScrn, box, pBox); - } - } - - /* Free the temporary buffer. */ - xfree(pBox); - } - - pSmi->polyLines = TRUE; - LEAVE(); -} - -#endif |