diff --git a/README b/README index c2d4394..40b33d3 100644 --- a/README +++ b/README @@ -43,7 +43,7 @@ o Hardware cursor; 315/330/340 series: Color HW cursor - o XAA; EXA; XVideo (Xv); RENDER and other extensions + o EXA; XVideo (Xv); RENDER and other extensions o 6326: TV output @@ -89,12 +89,6 @@ Disables 2D acceleration. By default, 2D acceleration is enabled. - Option "AccelMethod" [string] - Determines which acceleration architecture should be used. - Possible arguments are "XAA" or "EXA". As of this writing, EXA - is still experimental and it is not recommended to be used on - production machines. By default, XAA will be used. - Option "Rotate" [string] This option enables clockwise ("CW") or counter-clockwise ("CCW") rotation of the display. Enabling either CW or CCW @@ -287,14 +281,6 @@ 2.5. 315/330/340 series specific options - - - Option "RenderAcceleration" [boolean] - Enables or disables RENDER acceleration. This feature, for - instance, accelerates output of anti-aliased text. By default, - RENDER acceleration is enabled. RENDER acceleration is currently - only supported for XAA, not EXA. - Option "XvOnCRT2" [boolean] (For 315, 650, 740, 330, 340 and XGI chips only) This option selects whether the XVideo (Xv) overlay should be displayed on diff --git a/configure.ac b/configure.ac index 858abe2..d768a70 100644 --- a/configure.ac +++ b/configure.ac @@ -107,24 +107,6 @@ if test "$DRI" = yes; then AC_DEFINE(SISDRI_DEVEL,1,[Enable developmental DRI driver support]) fi -AC_ARG_ENABLE(xaa, - AS_HELP_STRING([--enable-xaa], - [Enable legacy X Acceleration Architecture (XAA) [default=auto]]), - [XAA="$enableval"], - [XAA=auto]) -if test "x$XAA" != xno; then - save_CFLAGS=$CFLAGS - save_CPPFLAGS=$CPPFLAGS - CFLAGS=$XORG_CFLAGS - CPPFLAGS="$XORG_CFLAGS" - AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no) - CFLAGS=$save_CFLAGS - CPPFLAGS=$save_CPPFLAGS -fi -AC_MSG_CHECKING([whether to include XAA support]) -AM_CONDITIONAL(XAA, test "x$XAA" = xyes) -AC_MSG_RESULT([$XAA]) - # technically this should be a configure flag. meh. AC_DEFINE(USE_EXA, 1, [Build support for EXA]) diff --git a/src/sis.h b/src/sis.h index b37d800..f4ba021 100644 --- a/src/sis.h +++ b/src/sis.h @@ -147,23 +147,12 @@ #define SIS_XINERAMA_MINOR_VERSION 1 #endif -#ifdef HAVE_XAA_H -#define SIS_USE_XAA /* Include code for XAA */ -#endif - #if defined(SIS_HAVE_EXA) || (defined(USE_EXA) && (USE_EXA != 0)) #define SIS_USE_EXA /* Include code for EXA */ #endif /* End of configurable stuff --------------------------------- */ -#if !defined(SIS_USE_XAA) && !defined(SIS_USE_EXA) -#define SIS_USE_XAA -#endif - -#ifdef SIS_USE_XAA -#include "xaa.h" -#endif #ifdef SIS_USE_EXA #include "exa.h" #endif @@ -932,16 +921,6 @@ typedef struct { Bool ClipEnabled; int Xdirection; /* for temp use in accel */ int Ydirection; /* for temp use in accel */ -#ifdef SIS_USE_XAA - XAAInfoRecPtr AccelInfoPtr; - UChar *XAAScanlineColorExpandBuffers[2]; - Bool DoColorExpand; - Bool ColorExpandBusy; - int xcurrent; /* for temp use in accel */ - int ycurrent; /* for temp use in accel */ - int sisPatternReg[4]; - int ROPReg; -#endif #ifdef SIS_USE_EXA ExaDriverPtr EXADriverPtr; int fillPitch, fillBpp; @@ -998,11 +977,6 @@ typedef struct { unsigned int DRIheapstart, DRIheapend; Bool NeedFlush; /* Need to flush cmd buf mem (760) */ -#ifdef SIS_USE_XAA - void (*RenderCallback)(ScrnInfoPtr); - Time RenderTime; - FBLinearPtr AccelLinearScratch; -#endif #ifdef SIS_USE_EXA void (*ExaRenderCallback)(ScrnInfoPtr); Time ExaRenderTime; diff --git a/src/sis300_accel.c b/src/sis300_accel.c index aaed6ed..bc87ac8 100644 --- a/src/sis300_accel.c +++ b/src/sis300_accel.c @@ -46,17 +46,6 @@ /* This is the offset to the memory for each head */ #define HEADOFFSET (pSiS->dhmOffset) -#ifdef SIS_USE_XAA - -#undef STSCE /* Use/Don't use ScreenToScreenColorExpand - does not work */ - -#undef TRAP /* Use/Don't use Trapezoid Fills - does not work - XAA provides - * illegal trapezoid data (left and right edges cross each other - * sometimes) which causes drawing errors. Further, I have not found - * out how to draw polygones with a height greater than 127... - */ -#endif /* XAA */ - #ifdef SIS_USE_EXA extern void SiSScratchSave(ScreenPtr pScreen, ExaOffscreenArea *area); extern Bool SiSUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst); @@ -68,11 +57,6 @@ extern UChar SiSGetPatternROP(int rop); static void SiSInitializeAccelerator(ScrnInfoPtr pScrn) { -#ifdef SIS_USE_XAA - SISPtr pSiS = SISPTR(pScrn); - - pSiS->DoColorExpand = FALSE; -#endif } static void @@ -205,675 +189,6 @@ SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, SiSDoCMD } -#ifdef SIS_USE_XAA /* ---------------------------- XAA -------------------------- */ - -#ifdef SISDUALHEAD -static void -SiSRestoreAccelState(ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - - /* We don't need to do anything special here; forcing the - * other head to re-read the CmdQueLen is not necessary: - * After the Sync in RestoreAccelState(), the real queue - * length is always larger than (or at least equal to) - * the amount stored in CmdQueueLen of the other head, - * so the only thing that might happen is one unnecessary - * Sync on the other head. I think we can live with that. - */ - pSiS->DoColorExpand = FALSE; - SiSIdle -} -#endif - -/* Trapezoid */ -/* This would work better if XAA would provide us with valid trapezoids. - * In fact, with small trapezoids the left and the right edge often cross - * each other or result in a line length of 0 which causes drawing errors - * (filling over whole scanline). - * Furthermore, I have not found out how to draw trapezoids with a height - * greater than 127. - */ -#ifdef TRAP -static void -SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR ) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase; -#if 0 - float kL, kR; -#endif - - dstbase = 0; - if(y >= 2048) { - dstbase=pSiS->scrnOffset*y; - y = 0; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - dstbase += HEADOFFSET; - } -#endif - SiSSetupDSTBase(dstbase) - /* SiSSetupRect(w,h) */ - -#if 1 - SiSSetupPATFG(0xff0000) /* FOR TESTING */ -#endif - - /* Clear CommandReg because SetUp can be used for Rect and Trap */ - pSiS->CommandReg &= ~(T_L_X_INC | T_L_Y_INC | - T_R_X_INC | T_R_Y_INC | - T_XISMAJORL | T_XISMAJORR | - BITBLT); - - xf86DrvMsg(0, X_INFO, "Trap (%d %d %d %d) dxL %d dyL %d eL %d dxR %d dyR %d eR %d\n", - left, right, y, h, dxL, dyL, eL, dxR, dyR, eR); - - /* Unfortunately, we must check if the right and the left edge - * cross each other... INCOMPLETE (line equation wrong) - */ -#if 0 - if (dxL == 0) kL = 0; - else kL = (float)dyL / (float)dxL; - if (dxR == 0) kR = 0; - else kR = (float)dyR / (float)dxR; - xf86DrvMsg(0, X_INFO, "kL %f kR %f!\n", kL, kR); - if ( (kR != kL) && - (!(kR == 0 && kL == 0)) && - (!(kR < 0 && kL > 0)) ) { - xf86DrvMsg(0, X_INFO, "Inside if (%f - %d)\n", ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - left) + y), h+y); - if ( ( ( kL * ( ( ((float)right - (float)left) / (kL - kR) ) - (float)left) + (float)y) < (h + y) ) ) { - xf86DrvMsg(0, X_INFO, "Cross detected!\n"); - } - } -#endif - - /* Determine edge angles */ - if(dxL < 0) { dxL = -dxL; } - else { SiSSetupCMDFlag(T_L_X_INC) } - if(dxR < 0) { dxR = -dxR; } - else { SiSSetupCMDFlag(T_R_X_INC) } - - /* (Y direction always positive - do this anyway) */ - if(dyL < 0) { dyL = -dyL; } - else { SiSSetupCMDFlag(T_L_Y_INC) } - if(dyR < 0) { dyR = -dyR; } - else { SiSSetupCMDFlag(T_R_Y_INC) } - - /* Determine major axis */ - if(dxL >= dyL) { /* X is major axis */ - SiSSetupCMDFlag(T_XISMAJORL) - } - if(dxR >= dyR) { /* X is major axis */ - SiSSetupCMDFlag(T_XISMAJORR) - } - - /* Set up deltas */ - SiSSetupdL(dxL, dyL) - SiSSetupdR(dxR, dyR) - -#if 0 /* Could it be that this crappy engine can only draw trapezoids up to 127 pixels high? */ - h &= 0x7F; - if (h == 0) h = 10; -#endif - - /* Set up y, h, left, right */ - SiSSetupYH(y,h) - SiSSetupLR(left,right) - - /* Set up initial error term */ - SiSSetupEL(eL) - SiSSetupER(eR) - - SiSSetupCMDFlag(TRAPAZOID_FILL); - - SiSDoCMD -} -#endif - -static void -SiSSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupLineCount(1) - SiSSetupPATFG(color) - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(pSiS->DstColor); - SiSSetupROP(SiSGetPatternROP(rop)) - SiSSetupCMDFlag(PATFG | LINE) -} - -static void -SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) -{ - SISPtr pSiS = SISPTR(pScrn); - int miny, maxy; - CARD32 dstbase = 0; - - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= 2048) { - dstbase = pSiS->scrnOffset * miny; - y1 -= miny; - y2 -= miny; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - dstbase += HEADOFFSET; - } -#endif - SiSSetupDSTBase(dstbase) - - SiSSetupX0Y0(x1,y1) - SiSSetupX1Y1(x2,y2) - if(flags & OMIT_LAST) { - SiSSetupCMDFlag(NO_LAST_PIXEL) - } else { - pSiS->CommandReg &= ~(NO_LAST_PIXEL); - } - - SiSDoCMD -} - -static void -SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - len--; /* starting point is included! */ - - if((y >= 2048) || ((dir != DEGREES_0) && ((y + len) >= 2048))) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - dstbase += HEADOFFSET; - } -#endif - SiSSetupDSTBase(dstbase) - - SiSSetupX0Y0(x,y) - if(dir == DEGREES_0) { - SiSSetupX1Y1(x + len, y); - } else { - SiSSetupX1Y1(x, y + len); - } - - SiSDoCMD -} - -static void -SiSSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask, - int length, UChar *pattern) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupLineCount(1) - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(pSiS->DstColor); - SiSSetupStyleLow(*pattern) - SiSSetupStyleHigh(*(pattern+4)) - SiSSetupStylePeriod(length-1); - SiSSetupROP(SiSGetPatternROP(rop)) - SiSSetupPATFG(fg) - SiSSetupCMDFlag(LINE | LINE_STYLE) - if(bg != -1) { - SiSSetupPATBG(bg) - } else { - SiSSetupCMDFlag(TRANSPARENT); - } -} - -static void -SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase) -{ - SISPtr pSiS = SISPTR(pScrn); - int miny, maxy; - CARD32 dstbase = 0; - - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= 2048) { - dstbase = pSiS->scrnOffset * miny; - y1 -= miny; - y2 -= miny; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - dstbase += HEADOFFSET; - } -#endif - SiSSetupDSTBase(dstbase) - - SiSSetupX0Y0(x1,y1) - SiSSetupX1Y1(x2,y2) - if(flags & OMIT_LAST) { - SiSSetupCMDFlag(NO_LAST_PIXEL) - } else { - pSiS->CommandReg &= ~(NO_LAST_PIXEL); - } - - SiSDoCMD -} - -static void -SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(pSiS->DstColor); - SiSSetupMONOPAT(patx,paty) - SiSSetupPATFG(fg) - SiSSetupROP(SiSGetPatternROP(rop)) - SiSSetupCMDFlag(PATMONO) - if(bg != -1) { - SiSSetupPATBG(bg) - } else { - SiSSetupCMDFlag(TRANSPARENT) - } -} - -static void -SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - if(y >= 2048) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - dstbase += HEADOFFSET; - } -#endif - SiSSetupDSTBase(dstbase) - SiSSetupDSTXY(x, y) - SiSSetupRect(w, h) - /* Clear commandReg because Setup can be used for Rect and Trap */ - pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | - T_L_X_INC | T_L_Y_INC | - T_R_X_INC | T_R_Y_INC | - TRAPAZOID_FILL); - SiSSetupCMDFlag(X_INC | Y_INC) - - SiSDoCMD -} - -/* Trapezoid */ -#ifdef TRAP -static void -SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn, - int patx, int paty, - int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR ) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - if(y >= 2048) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - dstbase += HEADOFFSET; - } -#endif - SiSSetupDSTBase(dstbase) - - /* Clear CommandReg because SetUp can be used for Rect and Trap */ - pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | - T_L_X_INC | T_L_Y_INC | - T_R_X_INC | T_R_Y_INC | - BITBLT); - - if(dxL < 0) { dxL = -dxL; } - else { SiSSetupCMDFlag(T_L_X_INC) } - if(dxR < 0) { dxR = -dxR; } - else { SiSSetupCMDFlag(T_R_X_INC) } - - if(dyL < 0) { dyL = -dyL; } - else { SiSSetupCMDFlag(T_L_Y_INC) } - if(dyR < 0) { dyR = -dyR; } - else { SiSSetupCMDFlag(T_R_Y_INC) } - - /* Determine major axis */ - if(dxL >= dyL) { /* X is major axis */ - SiSSetupCMDFlag(T_XISMAJORL) - } - if(dxR >= dyR) { /* X is major axis */ - SiSSetupCMDFlag(T_XISMAJORR) - } - - SiSSetupYH(y,h) - SiSSetupLR(left,right) - - SiSSetupdL(dxL, dyL) - SiSSetupdR(dxR, dyR) - - SiSSetupEL(eL) - SiSSetupER(eR) - - SiSSetupCMDFlag(TRAPAZOID_FILL); - - SiSDoCMD -} -#endif - -/* ------ Screen To Screen Color Expand ------------------------------- */ - -/* The hareware does not seem to support this the way we need it */ - -#ifdef STSCE -static void -SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupDSTColorDepth(pSiS->DstColor) - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupROP(SiSGetCopyROP(rop)) - SiSSetupSRCFG(fg) - /* SiSSetupSRCXY(0,0) */ - - if(bg == -1) { - SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | X_INC | - Y_INC | SRCVIDEO); - } else { - SiSSetupSRCBG(bg); - SiSSetupCMDFlag(ENCOLOREXP | X_INC | Y_INC | - SRCVIDEO); - }; -} -#endif - -/* This method blits in a single task; this does not seem to work - * because the hardware does not use the source pitch as scanline - * offset but only to calculate pattern address from source X and Y. - * XAA provides the pattern bitmap with scrnOffset (displayWidth * bpp/8) - * offset, but this does not seem to be supported by the hardware. - */ -#ifdef STSCE - -/* For testing, these are the methods: (use only one at a time!) */ - -#undef npitch /* Normal: Use srcx/y as srcx/y, use scrnOffset as source pitch - * This would work if the hareware used the source pitch for - * incrementing the source address after each scanline - but - * it doesn't do this! The first line of the area is correctly - * color expanded, but since the source pitch is ignored and - * the source address not incremented correctly, the following - * lines are color expanded with any bit pattern that is left - * in the unused space of the source bitmap (which is organized - * with the depth of the screen framebuffer hence with a pitch - * of scrnOffset). - */ - -#undef pitchdw /* Use source pitch "displayWidth / 8" instead - * of scrnOffset (=displayWidth * bpp / 8) - * This can't work, because the pitch of the source - * bitmap is scrnoffset! - */ - -#define nopitch /* Calculate srcbase with srcx and srcy, set the - * pitch to scrnOffset (which IS the correct pitch - * for the source bitmap) and set srcx and srcy both - * to 0. - * This would work if the hareware used the source pitch for - * incrementing the source address after each scanline - but - * it doesn't do this! Again: The first line of the area is - * correctly color expanded, but since the source pitch is - * ignored for scanline address incremention, the following - * lines are not correctly color expanded. - * WHATEVER I write to source pitch is ignored! - */ - -static void -SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 srcbase, dstbase; -#if 0 - int _x0, _y0, _x1, _y1; -#endif -#ifdef pitchdw - int newsrcx, newsrcy; - - /* srcx and srcy are provided based on a scrnOffset pitch ( = displayWidth * bpp / 8 ) - * We recalculate srcx and srcy based on pitch = displayWidth / 8 - */ - newsrcy = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) / - (pScrn->displayWidth/8); - newsrcx = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) % - (pScrn->displayWidth/8); -#endif - xf86DrvMsg(0, X_INFO, "Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", - x, y, w, h, srcx, srcy, skipleft); - - srcbase = dstbase = 0; - -#ifdef pitchdw - if(newsrcy >= 2048) { - srcbase = (pScrn->displayWidth / 8) * newsrcy; - newsrcy = 0; - } -#endif -#ifdef nopitch - srcbase = (pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8)); -#endif -#ifdef npitch - if(srcy >= 2048) { - srcbase = pSiS->scrnOffset * srcy; - srcy = 0; - } -#endif - if(y >= 2048) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - srcbase += HEADOFFSET; - dstbase += HEADOFFSET; - } -#endif - SiSSetupSRCBase(srcbase) - SiSSetupDSTBase(dstbase) - -#ifdef pitchdw - SiSSetupSRCPitch(pScrn->displayWidth/8) -#endif -#ifdef nopitch - SiSSetupSRCPitch(pSiS->scrnOffset) - /* SiSSetupSRCPitch(100) */ /* For test - has NO effect WHATSOEVER */ -#endif -#ifdef npitch - SiSSetupSRCPitch(pSiS->scrnOffset) -#endif - - SiSSetupRect(w,h) - -#if 0 /* How do I implement the offset? Not this way, that's for sure.. */ - if (skipleft > 0) { - _x0 = x+skipleft; - _y0 = y; - _x1 = x+w; - _y1 = y+h; - SiSSetupClipLT(_x0, _y0); - SiSSetupClipRB(_x1, _y1); - SiSSetupCMDFlag(CLIPENABLE); - } -#endif -#ifdef pitchdw - SiSSetupSRCXY(newsrcx, newsrcy) -#endif -#ifdef nopitch - SiSSetupSRCXY(0,0) -#endif -#ifdef npitch - SiSSetupSRCXY(srcx, srcy) -#endif - - SiSSetupDSTXY(x,y) - - SiSDoCMD -} -#endif - -/* ----- CPU To Screen Color Expand (scanline-wise) ----------------- */ - -/* We do it using the indirect method */ - -static void -SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask) -{ - SISPtr pSiS=SISPTR(pScrn); - - /* Make sure that current CPU-driven BitBlt buffer stage is 0 - * This is required!!! (Otherwise -> drawing errors) - */ - while((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */ - - SiSSetupSRCXY(0,0); - SiSSetupROP(SiSGetCopyROP(rop)); - SiSSetupSRCFG(fg); - SiSSetupDSTRect(pSiS->scrnOffset, -1); - SiSSetupDSTColorDepth(pSiS->DstColor); - if(bg == -1) { - SiSSetupCMDFlag(TRANSPARENT | - ENCOLOREXP | - X_INC | Y_INC | - SRCCPUBLITBUF); - } else { - SiSSetupSRCBG(bg); - SiSSetupCMDFlag(ENCOLOREXP | - X_INC | Y_INC | - SRCCPUBLITBUF); - } -} - - -static void -SiSSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, int x, int y, int w, - int h, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - int _x0, _y0, _x1, _y1; - CARD32 dstbase = 0; - - if((y >= 2048) || ((y + h) >= 2048)) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - dstbase += HEADOFFSET; - } -#endif - - /* Wait until there is no color expansion command in queue - * (This solves the OpenOffice.org window-move bug) - * Added Idle-check - bit 23 is set sometimes, although - * engine is actually idle! - * Update: Bit 23 is not reliable. After heavy 3D engine - * action, this bit never gets cleared again. So do - * SiSIdle instead. - */ - if((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { - /* while ((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ - SiSIdle - } - - SiSSetupDSTBase(dstbase) - - if(skipleft > 0) { - _x0 = x + skipleft; - _y0 = y; - _x1 = x + w; - _y1 = y + h; - SiSSetupClipLT(_x0, _y0); - SiSSetupClipRB(_x1, _y1); - SiSSetupCMDFlag(CLIPENABLE); - } else { - pSiS->CommandReg &= (~CLIPENABLE); - } - - SiSSetupRect(w, 1); - SiSSetupSRCPitch(((((w + 7) / 8) + 3) >> 2) * 4); - pSiS->xcurrent = x; - pSiS->ycurrent = y; -} - -static void -SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - SISPtr pSiS=SISPTR(pScrn); -#if 0 - int newhead,bltbufstage,newtail; -#endif - CARD32 cbo; - - cbo = pSiS->ColorExpandBufferScreenOffset[bufno]; -#ifdef SISDUALHEAD - if(pSiS->VGAEngine != SIS_530_VGA) { - cbo += HEADOFFSET; - } -#endif - - /* Wait until there is no color expansion command in queue - * (This solves the GTK-big-font bug) - * Added Idle-check - bit 23 is set sometimes, although - * engine is actually idle! - * Update: Bit 23 is not reliable. After heavy 3D engine - * action, this bit never gets cleared again. So do - * SiSIdle instead. - */ - if((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { - /* while ((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ - SiSIdle - } - - SiSSetupSRCBase(cbo); - - SiSSetupDSTXY(pSiS->xcurrent, pSiS->ycurrent); - - SiSDoCMD - - pSiS->ycurrent++; - - if(pSiS->VGAEngine == SIS_530_VGA) { - while(SIS_MMIO_IN8(pSiS->IOBase, 0x8242) & 0x80) {} - } -} - -#endif /* XAA */ - #ifdef SIS_USE_EXA /* ---------------------------- EXA -------------------------- */ static const unsigned short dstcol[] = { 0x0000, 0x8000, 0xc000 }; @@ -1063,19 +378,10 @@ SiS300AccelInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); SISPtr pSiS = SISPTR(pScrn); -#ifdef SIS_USE_XAA - XAAInfoRecPtr infoPtr = NULL; - UChar *AvailBufBase; - int topFB, reservedFbSize, usableFbSize, i; - BoxRec Avail; -#endif /* XAA */ pSiS->ColorExpandBufferNumber = 0; pSiS->PerColorExpandBufferSize = 0; pSiS->RenderAccelArray = NULL; -#ifdef SIS_USE_XAA - pSiS->AccelInfoPtr = NULL; -#endif #ifdef SIS_USE_EXA pSiS->EXADriverPtr = NULL; pSiS->exa_scratch = NULL; @@ -1088,12 +394,6 @@ SiS300AccelInit(ScreenPtr pScreen) } if(!pSiS->NoAccel) { -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if(!infoPtr) pSiS->NoAccel = TRUE; - } -#endif #ifdef SIS_USE_EXA if(pSiS->useEXA) { if(!(pSiS->EXADriverPtr = exaDriverAlloc())) { @@ -1113,118 +413,6 @@ SiS300AccelInit(ScreenPtr pScreen) pSiS->FillRect = SiSDGAFillRect; pSiS->BlitRect = SiSDGABlitRect; -#ifdef SIS_USE_XAA /* ----------------------- XAA ----------------------- */ - if(!pSiS->useEXA) { - - infoPtr->Flags = LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS | - PIXMAP_CACHE; - - /* sync */ - infoPtr->Sync = SiSSync; - - /* Although SiS states that the 300 series supports a - * virtual screen of 4096x4096, the 2D accelerator - * does not seem to know that. If the destination bitmap - * pitch is > 8192 (which easily happens in 32bpp mode), - * the accelerator engine collapses. - * TODO: Find out about the 530 and 620 - */ - - if(pSiS->scrnOffset < 8192) { - - /* screen to screen copy */ - infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | - TRANSPARENCY_GXCOPY_ONLY; - - /* solid fills */ - infoPtr->SetupForSolidFill = SiSSetupForSolidFill; - infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; -#ifdef TRAP - infoPtr->SubsequentSolidFillTrap = SiSSubsequentSolidFillTrap; -#endif - infoPtr->SolidFillFlags = NO_PLANEMASK; - - /* solid line */ - infoPtr->SetupForSolidLine = SiSSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; - infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; - infoPtr->SolidLineFlags = NO_PLANEMASK; - - /* dashed line */ - infoPtr->SetupForDashedLine = SiSSetupForDashedLine; - infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; - infoPtr->DashPatternMaxLength = 64; - infoPtr->DashedLineFlags = NO_PLANEMASK | - LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; - - /* 8x8 mono pattern fill */ - infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMonoPatternFill; -#ifdef TRAP - infoPtr->SubsequentMono8x8PatternFillTrap = SiSSubsequentMonoPatternFillTrap; -#endif - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - /* NO_TRANSPARENCY | */ - BIT_ORDER_IN_BYTE_MSBFIRST ; - -#ifdef STSCE - /* Screen To Screen Color Expand */ - /* The hardware does support this the way we need it */ - infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpand; - infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpand; - infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST ; -#endif - - /* per-scanline color expansion (using indirect method) */ - if(pSiS->VGAEngine == SIS_530_VGA) { - pSiS->ColorExpandBufferNumber = 4; - pSiS->ColorExpandBufferCountMask = 0x03; - } else { - pSiS->ColorExpandBufferNumber = 16; - pSiS->ColorExpandBufferCountMask = 0x0F; - } - - pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; - infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; - infoPtr->ScanlineColorExpandBuffers = (UChar **)&pSiS->ColorExpandBufferAddr[0]; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - SiSSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - SiSSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - SiSSubsequentColorExpandScanline; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | - CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST | - LEFT_EDGE_CLIPPING; - } else { - - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Virtual screen width too large for accelerator engine\n"); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "\t2D acceleration and Xv disabled\n"); - pSiS->NoXvideo = TRUE; - - } - -#ifdef SISDUALHEAD - if(pSiS->DualHeadMode) { - infoPtr->RestoreAccelState = SiSRestoreAccelState; - } -#endif - } /* !exa */ -#endif /* XAA */ - #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */ if(pSiS->useEXA) { @@ -1297,56 +485,6 @@ SiS300AccelInit(ScreenPtr pScreen) * topFB */ -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - - topFB = pSiS->maxxfbmem; - - reservedFbSize = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize; - - usableFbSize = topFB - reservedFbSize; - - AvailBufBase = pSiS->FbBase + usableFbSize; - for(i = 0; i < pSiS->ColorExpandBufferNumber; i++) { - pSiS->ColorExpandBufferAddr[i] = AvailBufBase + - i * pSiS->PerColorExpandBufferSize; - pSiS->ColorExpandBufferScreenOffset[i] = usableFbSize + - i * pSiS->PerColorExpandBufferSize; - } - - Avail.x1 = 0; - Avail.y1 = 0; - Avail.x2 = pScrn->displayWidth; - Avail.y2 = (usableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8)) - 1; - - if(Avail.y2 < 0) Avail.y2 = 32767; - - if(Avail.y2 < pScrn->currentMode->VDisplay) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Not enough video RAM for accelerator. At least " - "%dKB needed, %dKB available\n", - ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* +8 for make it sure */ - * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8, - pSiS->maxxfbmem/1024); - pSiS->NoAccel = TRUE; - pSiS->NoXvideo = TRUE; - XAADestroyInfoRec(pSiS->AccelInfoPtr); - pSiS->AccelInfoPtr = NULL; - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Framebuffer from (%d,%d) to (%d,%d)\n", - Avail.x1, Avail.y1, Avail.x2 - 1, Avail.y2 - 1); - - xf86InitFBManager(pScreen, &Avail); - - if(!pSiS->NoAccel) { - return XAAInit(pScreen, infoPtr); - } - } /* !exa */ -#endif /* XAA */ - #ifdef SIS_USE_EXA if(pSiS->useEXA) { @@ -1377,10 +515,3 @@ SiS300AccelInit(ScreenPtr pScreen) return TRUE; } - - - - - - - diff --git a/src/sis310_accel.c b/src/sis310_accel.c index 0e1565c..560ad65 100644 --- a/src/sis310_accel.c +++ b/src/sis310_accel.c @@ -52,50 +52,6 @@ #undef SIS_NEED_ARRAY -/* For XAA */ - -#ifdef SIS_USE_XAA - -#undef TRAP /* Use/Don't use Trapezoid Fills - * DOES NOT WORK. XAA sometimes provides illegal - * trapezoid data (left and right edges cross each - * other) which causes drawing errors. Since - * checking the trapezoid for such a case is very - * time-intensive, it is faster to let it be done - * by the generic polygon functions. - * Does not work on 330 series at all, hangs the engine. - * Even with correct trapezoids, this is slower than - * doing it by the CPU. - */ - -#undef CTSCE /* Use/Don't use CPUToScreenColorExpand. Disabled - * because it is slower than doing it by the CPU. - * Indirect mode does not work in VRAM queue mode. - * Does not work on 330 series (even in MMIO mode). - */ -#undef CTSCE_DIRECT /* Use direct method - This works (on both 315 and 330 at - * least in VRAM queue mode) but we don't use this either, - * because it's slower than doing it by the CPU. (Using it - * would require defining CTSCE) - */ - -#undef STSCE /* Use/Don't use ScreenToScreenColorExpand - does not work, - * see comments below. - */ - -#define INCL_RENDER /* Use/Don't use RENDER extension acceleration */ - -#ifdef INCL_RENDER -# ifdef RENDER -# include "mipict.h" -# include "dixstruct.h" -# define SIS_NEED_ARRAY -# define SISNEWRENDER -# endif -#endif - -#endif /* XAA */ - /* For EXA */ #ifdef SIS_USE_EXA @@ -109,19 +65,6 @@ #endif #endif -#ifdef SIS_USE_XAA /* XAA */ -#ifdef INCL_RENDER -#ifdef RENDER -static CARD32 SiSAlphaTextureFormats[2] = { PICT_a8 , 0 }; -static CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 }; -#ifdef SISNEWRENDER -static CARD32 SiSDstTextureFormats16[2] = { PICT_r5g6b5 , 0 }; -static CARD32 SiSDstTextureFormats32[3] = { PICT_x8r8g8b8, PICT_a8r8g8b8, 0 }; -#endif -#endif /* RENDER */ -#endif /* INCL_RENDER */ -#endif /* XAA */ - #ifdef SIS_USE_EXA /* EXA */ void SiSScratchSave(ScreenPtr pScreen, ExaOffscreenArea *area); Bool SiSUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst); @@ -197,20 +140,6 @@ SiSSync(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { -#ifdef CTSCE -#ifdef CTSCE_DIRECT - if(pSiS->DoColorExpand) { - SiSDoCMD - pSiS->ColorExpandBusy = TRUE; - } -#endif -#endif - pSiS->DoColorExpand = FALSE; - } -#endif - pSiS->alphaBlitBusy = FALSE; SiSIdle @@ -229,9 +158,6 @@ SiSInitializeAccelerator(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); -#ifdef SIS_USE_XAA - pSiS->DoColorExpand = FALSE; -#endif pSiS->alphaBlitBusy = FALSE; if(!pSiS->NoAccel) { @@ -365,1016 +291,6 @@ SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, SiSSetupDSTBaseDoCMD(dstbase) } -#ifdef SIS_USE_XAA /* ---------------------------- XAA -------------------------- */ - -/* Trapezoid */ -/* This would work better if XAA would provide us with valid trapezoids. - * In fact, with small trapezoids the left and the right edge often cross - * each other which causes drawing errors (filling over whole scanline). - * DOES NOT WORK ON 330 SERIES, HANGS THE ENGINE. - */ -#ifdef TRAP -static void -SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR ) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - if(y >= 2048) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } - - dstbase += FBOFFSET; - - SiSCheckQueue(16 * 10) - -#if 1 - SiSSetupPATFG(0xff0000) /* FOR TESTING */ -#endif - - /* Clear CommandReg because SetUp can be used for Rect and Trap */ - pSiS->CommandReg &= ~(T_L_X_INC | T_L_Y_INC | - T_R_X_INC | T_R_Y_INC | - T_XISMAJORL | T_XISMAJORR | - BITBLT); - - xf86DrvMsg(0, X_INFO, "Trap (%d %d %d %d) dxL %d dyL %d eL %d dxR %d dyR %d eR %d\n", - left, right, y, h, dxL, dyL, eL, dxR, dyR, eR); - - /* Determine edge angles */ - if(dxL < 0) { dxL = -dxL; } - else { SiSSetupCMDFlag(T_L_X_INC) } - if(dxR < 0) { dxR = -dxR; } - else { SiSSetupCMDFlag(T_R_X_INC) } - - /* (Y direction always positive - do this anyway) */ - if(dyL < 0) { dyL = -dyL; } - else { SiSSetupCMDFlag(T_L_Y_INC) } - if(dyR < 0) { dyR = -dyR; } - else { SiSSetupCMDFlag(T_R_Y_INC) } - - /* Determine major axis */ - if(dxL >= dyL) { SiSSetupCMDFlag(T_XISMAJORL) } - if(dxR >= dyR) { SiSSetupCMDFlag(T_XISMAJORR) } - - SiSSetupCMDFlag(TRAPAZOID_FILL); - - SiSSetupYHLR(y, h, left, right) - SiSSetupdLdR(dxL, dyL, dxR, dyR) - SiSSetupELER(eL, eR) - SiSSetupDSTBaseDoCMD(dstbase) -} -#endif - -static void -SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - SiSCheckQueue(16 * 3); - SiSSetupLineCountPeriod(1, 1) - SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, DEV_HEIGHT) - SiSSetupROP(SiSGetPatternROP(rop)) - SiSSetupCMDFlag(PATFG | LINE) - SiSSyncWP -} - -static void -SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) -{ - SISPtr pSiS = SISPTR(pScrn); - int miny, maxy; - CARD32 dstbase = 0; - - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= 2048) { - dstbase = pSiS->scrnOffset*miny; - y1 -= miny; - y2 -= miny; - } - - dstbase += FBOFFSET; - - if(flags & OMIT_LAST) { - SiSSetupCMDFlag(NO_LAST_PIXEL) - } else { - pSiS->CommandReg &= ~(NO_LAST_PIXEL); - } - - SiSCheckQueue(16 * 2); - SiSSetupX0Y0X1Y1(x1, y1, x2, y2) - SiSSetupDSTBaseDoCMD(dstbase) -} - -static void -SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - len--; /* starting point is included! */ - - if((y >= 2048) || ((y + len) >= 2048)) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } - - dstbase += FBOFFSET; - - SiSCheckQueue(16 * 2); - if(dir == DEGREES_0) { - SiSSetupX0Y0X1Y1(x, y, (x + len), y) - } else { - SiSSetupX0Y0X1Y1(x, y, x, (y + len)) - } - SiSSetupDSTBaseDoCMD(dstbase) -} - -static void -SiSSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask, - int length, unsigned char *pattern) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - SiSCheckQueue(16 * 3); - SiSSetupLineCountPeriod(1, (length - 1)) - SiSSetupStyle(*pattern,*(pattern + 4)) - SiSSetupPATFGDSTRect(fg, pSiS->scrnOffset, DEV_HEIGHT) - - SiSSetupROP(SiSGetPatternROP(rop)) - - SiSSetupCMDFlag(LINE | LINE_STYLE) - - if(bg != -1) { - SiSSetupPATBG(bg) - } else { - SiSSetupCMDFlag(TRANSPARENT) - } - - SiSSyncWP -} - -static void -SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase, miny, maxy; - - dstbase = 0; - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= 2048) { - dstbase = pSiS->scrnOffset * miny; - y1 -= miny; - y2 -= miny; - } - - dstbase += FBOFFSET; - - if(flags & OMIT_LAST) { - SiSSetupCMDFlag(NO_LAST_PIXEL) - } else { - pSiS->CommandReg &= ~(NO_LAST_PIXEL); - } - - SiSCheckQueue(16 * 2); - SiSSetupX0Y0X1Y1(x1, y1, x2, y2) - SiSSetupDSTBaseDoCMD(dstbase) -} - -static void -SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - SiSCheckQueue(16 * 3); - SiSSetupPATFGDSTRect(fg, pSiS->scrnOffset, DEV_HEIGHT) - - SiSSetupMONOPAT(patx,paty) - - SiSSetupROP(SiSGetPatternROP(rop)) - - SiSSetupCMDFlag(PATMONO) - - if(bg != -1) { - SiSSetupPATBG(bg) - } else { - SiSSetupCMDFlag(TRANSPARENT) - } - - SiSSyncWP -} - -static void -SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - if(y >= 2048) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } - - dstbase += FBOFFSET; - - /* Clear commandReg because Setup can be used for Rect and Trap */ - pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | - T_L_X_INC | T_L_Y_INC | - T_R_X_INC | T_R_Y_INC | - TRAPAZOID_FILL); - - SiSCheckQueue(16 * 2); - SiSSetupDSTXYRect(x,y,w,h) - SiSSetupDSTBaseDoCMD(dstbase) -} - -/* --- Trapezoid --- */ - -/* Does not work at all on 330 series */ - -#ifdef TRAP -static void -SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn, - int patx, int paty, - int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - if(y >= 2048) { - dstbase=pSiS->scrnOffset*y; - y = 0; - } - - dstbase += FBOFFSET; - - SiSCheckQueue(16 * 4); - - /* Clear CommandReg because SetUp can be used for Rect and Trap */ - pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR | - T_L_X_INC | T_L_Y_INC | - T_R_X_INC | T_R_Y_INC | - BITBLT); - - if(dxL < 0) { dxL = -dxL; } - else { SiSSetupCMDFlag(T_L_X_INC) } - if(dxR < 0) { dxR = -dxR; } - else { SiSSetupCMDFlag(T_R_X_INC) } - - if(dyL < 0) { dyL = -dyL; } - else { SiSSetupCMDFlag(T_L_Y_INC) } - if(dyR < 0) { dyR = -dyR; } - else { SiSSetupCMDFlag(T_R_Y_INC) } - - /* Determine major axis */ - if(dxL >= dyL) { SiSSetupCMDFlag(T_XISMAJORL) } - if(dxR >= dyR) { SiSSetupCMDFlag(T_XISMAJORR) } - - SiSSetupCMDFlag(TRAPAZOID_FILL); - - SiSSetupYHLR(y, h, left, right) - SiSSetupdLdR(dxL, dyL, dxR, dyR) - SiSSetupELER(eL, eR) - SiSSetupDSTBaseDoCMD(dstbase) -} -#endif - -/* Color 8x8 pattern */ - -static void -SiSSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, - int rop, unsigned int planemask, int trans_col) -{ - SISPtr pSiS = SISPTR(pScrn); - int j = pScrn->bitsPerPixel >> 3; - CARD32 *patadr = (CARD32 *)(pSiS->FbBase + (patterny * pSiS->scrnOffset) + - (patternx * j)); - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - SiSCheckQueue(16 * 3); - - SiSSetupDSTRectBurstHeader(pSiS->scrnOffset, DEV_HEIGHT, PATTERN_REG, (pScrn->bitsPerPixel << 1)) - - while(j--) { - SiSSetupPatternRegBurst(patadr[0], patadr[1], patadr[2], patadr[3]); - SiSSetupPatternRegBurst(patadr[4], patadr[5], patadr[6], patadr[7]); - SiSSetupPatternRegBurst(patadr[8], patadr[9], patadr[10], patadr[11]); - SiSSetupPatternRegBurst(patadr[12], patadr[13], patadr[14], patadr[15]); - patadr += 16; /* = 64 due to (CARD32 *) */ - } - - SiSSetupROP(SiSGetPatternROP(rop)) - - SiSSetupCMDFlag(PATPATREG) - - SiSSyncWP -} - -static void -SiSSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, - int patterny, int x, int y, int w, int h) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 dstbase = 0; - - if(y >= 2048) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } - - dstbase += FBOFFSET; - - /* SiSSetupCMDFlag(BITBLT) - BITBLT = 0 */ - - SiSCheckQueue(16 * 2) - SiSSetupDSTXYRect(x, y, w, h) - SiSSetupDSTBaseDoCMD(dstbase) -} - -/* ---- CPUToScreen Color Expand --- */ - -#ifdef CTSCE - -#ifdef CTSCE_DIRECT - -/* Direct method */ - -/* This is somewhat a fake. We let XAA copy its data not to an - * aperture, but to video RAM, and then do a ScreenToScreen - * color expansion. - * Since the data is sent AFTER the call to Subsequent, we - * don't execute the command here, but set a flag and do - * that in the (subsequent) call to Sync() - */ - -static void -SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask) -{ - SISPtr pSiS=SISPTR(pScrn); - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - SiSSetupROP(SiSGetCopyROP(rop)); - SiSSetupSRCFGDSTRect(fg, pSiS->scrnOffset, DEV_HEIGHT) - if(bg == -1) { - SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO); - } else { - SiSSetupSRCBG(bg); - SiSSetupCMDFlag(ENCOLOREXP | SRCVIDEO); - } - SiSSyncWP -} - -static void -SiSSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, int x, int y, int w, - int h, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - int _x0, _y0, _x1, _y1; - CARD32 srcbase, dstbase; - - srcbase = pSiS->ColorExpandBase; - - dstbase = 0; - if(y >= 2048) { - dstbase = pSiS->scrnOffset*y; - y = 0; - } - - srcbase += FBOFFSET; - dstbase += FBOFFSET; - - SiSSetupSRCDSTBase(srcbase,dstbase); - - if(skipleft > 0) { - _x0 = x + skipleft; - _y0 = y; - _x1 = x + w; - _y1 = y + h; - SiSSetupClip(_x0, _y0, _x1, _y1); - SiSSetupCMDFlag(CLIPENABLE); - } else { - pSiS->CommandReg &= (~CLIPENABLE); - } - - SiSSetupRectSRCPitch(w, h, ((((w + 7) >> 3) + 3) >> 2) << 2); - SiSSetupSRCDSTXY(0, 0, x, y); - - if(pSiS->ColorExpandBusy) { - pSiS->ColorExpandBusy = FALSE; - SiSIdle - } - - pSiS->DoColorExpand = TRUE; -} - -#else - -/* Indirect method */ - -/* This is SLOW, slower than the CPU on most chipsets */ -/* Does not work in VRAM queue mode. */ - -static void -SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask) -{ - SISPtr pSiS=SISPTR(pScrn); - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - - /* !!! DOES NOT WORK IN VRAM QUEUE MODE !!! */ - - /* (hence this is not optimized for VRAM mode) */ - SiSSetupSRCXY(0,0); - - SiSSetupROP(SiSGetCopyROP(rop)); - SiSSetupSRCFG(fg); - SiSSetupDSTRect(pSiS->scrnOffset, DEV_HEIGHT); - if(bg == -1) { - SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO); - } else { - SiSSetupSRCBG(bg); - SiSSetupCMDFlag(ENCOLOREXP | SRCCPUBLITBUF); - }; - -} - -static void -SiSSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, int x, int y, int w, - int h, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - int _x0, _y0, _x1, _y1; - CARD32 dstbase = 0; - - if(y >= 2048) { - dstbase = pSiS->scrnOffset*y; - y = 0; - } - - dstbase += FBOFFSET; - - SiSSetupDSTBase(dstbase) - - if(skipleft > 0) { - _x0 = x+skipleft; - _y0 = y; - _x1 = x+w; - _y1 = y+h; - SiSSetupClip(_x0, _y0, _x1, _y1); - SiSSetupCMDFlag(CLIPENABLE); - } else { - pSiS->CommandReg &= (~CLIPENABLE); - } - SiSSetupRect(w, 1); - SiSSetupSRCPitch(((((w+7)/8)+3) >> 2) * 4); - pSiS->ycurrent = y; - pSiS->xcurrent = x; - -} - -static void -SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 cbo; - - cbo = pSiS->ColorExpandBufferScreenOffset[bufno]; - cbo += FBOFFSET; - - SiSSetupSRCBase(cbo); - - SiSSetupDSTXY(pSiS->xcurrent, pSiS->ycurrent); - - SiSDoCMD - - pSiS->ycurrent++; -} -#endif -#endif - -/* --- Screen To Screen Color Expand --- */ - -/* This method blits in a single task; this does not work because - * the hardware does not use the source pitch as scanline offset - * but to calculate pattern address from source X and Y and to - * limit the drawing width (similar to width set by SetupRect). - * XAA provides the pattern bitmap with scrnOffset (displayWidth * bpp/8) - * offset, but this is not supported by the hardware. - * DOES NOT WORK ON 330 SERIES, HANGS ENGINE. - */ - -#ifdef STSCE -static void -SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - SiSSetupDSTRect(pSiS->scrnOffset, DEV_HEIGHT) - SiSSetupROP(SiSGetCopyROP(rop)) - SiSSetupSRCFG(fg) - /* SiSSetupSRCXY(0,0) */ - - if(bg == -1) { - SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO); - } else { - SiSSetupSRCBG(bg); - SiSSetupCMDFlag(ENCOLOREXP | SRCVIDEO); - }; - - SiSSyncWP -} - -/* For testing, these are the methods: (use only one at a time!) */ - -#undef npitch /* Normal: Use srcx/y as srcx/y, use scrnOffset as source pitch - * Does not work on 315 series, because the hardware does not - * regard the src x and y. Apart from this problem: - * This would work if the hareware used the source pitch for - * incrementing the source address after each scanline - but - * it doesn't do this! The first line of the area is correctly - * color expanded, but since the source pitch is ignored and - * the source address not incremented correctly, the following - * lines are color expanded with any bit pattern that is left - * in the unused space of the source bitmap (which is organized - * with the depth of the screen framebuffer hence with a pitch - * of scrnOffset). - */ - -#undef pitchdw /* Use source pitch "displayWidth / 8" instead - * of scrnOffset (=displayWidth * bpp / 8) - * This can't work, because the pitch of the source - * bitmap is scrnoffset! - */ - -#define nopitch /* Calculate srcbase with srcx and srcy, set the - * pitch to scrnOffset (which IS the correct pitch - * for the source bitmap) and set srcx and srcy both - * to 0. - * This would work if the hareware used the source pitch for - * incrementing the source address after each scanline - but - * it doesn't do this! Again: The first line of the area is - * correctly color expanded, but since the source pitch is - * ignored for scanline address incremention, the following - * lines are not correctly color expanded. - * This is the only way it works (apart from the problem - * described above). The hardware does not regard the src - * x and y values in any way. - */ - -static void -SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 srcbase, dstbase; -#if 0 - int _x0, _y0, _x1, _y1; -#endif -#ifdef pitchdw - int newsrcx, newsrcy; - - /* srcx and srcy are provided based on a scrnOffset pitch ( = displayWidth * bpp / 8 ) - * We recalculate srcx and srcy based on pitch = displayWidth / 8 - */ - newsrcy = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) / - (pScrn->displayWidth/8); - newsrcx = ((pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8))) % - (pScrn->displayWidth/8); -#endif - xf86DrvMsg(0, X_INFO, "Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", - x, y, w, h, srcx, srcy, skipleft); - - srcbase = dstbase = 0; - -#ifdef pitchdw - if(newsrcy >= 2048) { - srcbase = (pScrn->displayWidth / 8) * newsrcy; - newsrcy = 0; - } -#endif -#ifdef nopitch - srcbase = (pSiS->scrnOffset * srcy) + (srcx * ((pScrn->bitsPerPixel+7)/8)); -#endif -#ifdef npitch - if(srcy >= 2048) { - srcbase = pSiS->scrnOffset * srcy; - srcy = 0; - } -#endif - if(y >= 2048) { - dstbase = pSiS->scrnOffset * y; - y = 0; - } - - srcbase += FBOFFSET; - dstbase += FBOFFSET; - - SiSSetupSRCBase(srcbase) - SiSSetupDSTBase(dstbase) - - /* 315 series seem to treat the src pitch as - * a "drawing limit", but still (as 300 series) - * does not use it for incrementing the - * address pointer for the next scanline. ARGH! - */ - -#ifdef pitchdw - SiSSetupSRCPitch(pScrn->displayWidth/8) -#endif -#ifdef nopitch - SiSSetupSRCPitch(pScrn->displayWidth/8) - /* SiSSetupSRCPitch(1024/8) */ /* For test */ -#endif -#ifdef npitch - SiSSetupSRCPitch(pScrn->displayWidth/8) - /* SiSSetupSRCPitch(pSiS->scrnOffset) */ -#endif - - SiSSetupRect(w,h) - -#if 0 /* How do I implement the offset? Not this way, that's for sure.. */ - if (skipleft > 0) { - _x0 = x+skipleft; - _y0 = y; - _x1 = x+w; - _y1 = y+h; - SiSSetupClipLT(_x0, _y0); - SiSSetupClipRB(_x1, _y1); - SiSSetupCMDFlag(CLIPENABLE); - } -#endif -#ifdef pitchdw - SiSSetupSRCXY(newsrcx, newsrcy) -#endif -#ifdef nopitch - SiSSetupSRCXY(0,0) -#endif -#ifdef npitch - SiSSetupSRCXY(srcx, srcy) -#endif - - SiSSetupDSTXY(x,y) - - SiSDoCMD - /* We MUST sync here, there must not be 2 or more color expansion commands in the queue */ - SiSIdle -} -#endif - -#ifdef SISDUALHEAD -static void -SiSRestoreAccelState(ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - - pSiS->ColorExpandBusy = FALSE; - pSiS->alphaBlitBusy = FALSE; - SiSIdle -} -#endif - -/* ---- RENDER ---- */ - -#ifdef INCL_RENDER -#ifdef RENDER -static void -SiSRenderCallback(ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - - if((currentTime.milliseconds > pSiS->RenderTime) && pSiS->AccelLinearScratch) { - xf86FreeOffscreenLinear(pSiS->AccelLinearScratch); - pSiS->AccelLinearScratch = NULL; - } - - if(!pSiS->AccelLinearScratch) { - pSiS->RenderCallback = NULL; - } -} - -#define RENDER_DELAY 15000 - -static Bool -SiSAllocateLinear(ScrnInfoPtr pScrn, int sizeNeeded) -{ - SISPtr pSiS = SISPTR(pScrn); - - pSiS->RenderTime = currentTime.milliseconds + RENDER_DELAY; - pSiS->RenderCallback = SiSRenderCallback; - - if(pSiS->AccelLinearScratch) { - if(pSiS->AccelLinearScratch->size >= sizeNeeded) { - return TRUE; - } else { - if(pSiS->alphaBlitBusy) { - pSiS->alphaBlitBusy = FALSE; - SiSIdle - } - if(xf86ResizeOffscreenLinear(pSiS->AccelLinearScratch, sizeNeeded)) { - return TRUE; - } - xf86FreeOffscreenLinear(pSiS->AccelLinearScratch); - pSiS->AccelLinearScratch = NULL; - } - } - - pSiS->AccelLinearScratch = xf86AllocateOffscreenLinear( - pScrn->pScreen, sizeNeeded, 32, - NULL, NULL, NULL); - - return(pSiS->AccelLinearScratch != NULL); -} - -static Bool -SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, - int op, CARD16 red, CARD16 green, - CARD16 blue, CARD16 alpha, -#ifdef SISNEWRENDER - CARD32 alphaType, CARD32 dstType, -#else - int alphaType, -#endif - CARD8 *alphaPtr, - int alphaPitch, int width, - int height, int flags) -{ - SISPtr pSiS = SISPTR(pScrn); - unsigned char *renderaccelarray; - CARD32 *dstPtr; - int x, pitch, sizeNeeded; - int sbpp = pSiS->CurrentLayout.bitsPerPixel >> 3; - int sbppshift = sbpp >> 1; /* 8->0, 16->1, 32->2 */ - CARD8 myalpha; - Bool docopy = TRUE; - -#ifdef ACCELDEBUG - xf86DrvMsg(0, X_INFO, "AT(1): op %d t %x ARGB %x %x %x %x, w %d h %d pch %d\n", - op, alphaType, /*dstType, */alpha, red, green, blue, width, height, alphaPitch); -#endif - - if((width > 2048) || (height > 2048)) return FALSE; - - if(op > SiSRenderOpsMAX) return FALSE; - if(!SiSRenderOps[op]) return FALSE; - - if(!((renderaccelarray = pSiS->RenderAccelArray))) - return FALSE; - -#ifdef ACCELDEBUG - xf86DrvMsg(0, X_INFO, "AT(2): op %d t %x ARGB %x %x %x %x, w %d h %d pch %d\n", - op, alphaType, alpha, red, green, blue, width, height, alphaPitch); -#endif - - pitch = (width + 31) & ~31; - sizeNeeded = (pitch << 2) * height; /* Source a8 (=8bit), expand to A8R8G8B8 (=32bit) */ - - if(!SiSAllocateLinear(pScrn, (sizeNeeded + sbpp - 1) >> sbppshift)) - return FALSE; - - red &= 0xff00; - green &= 0xff00; - blue &= 0xff00; - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - switch(op) { - case PictOpClear: - case PictOpDisjointClear: - case PictOpConjointClear: - SiSSetupPATFGDSTRect(0, pSiS->scrnOffset, DEV_HEIGHT) - /* SiSSetupROP(0x00) - is already 0 */ - SiSSetupCMDFlag(PATFG) - docopy = FALSE; - break; - case PictOpSrc: - case PictOpDisjointSrc: - case PictOpConjointSrc: - SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, DEV_HEIGHT); - SiSSetupAlpha(0xff) - SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_NODESTALPHA) - break; - case PictOpDst: - case PictOpDisjointDst: - case PictOpConjointDst: - SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, DEV_HEIGHT); - SiSSetupAlpha(0x00) - SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_CONSTANTALPHA) - docopy = FALSE; - break; - case PictOpOver: - SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, DEV_HEIGHT); - SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA) - break; - } - SiSSyncWP - - /* Don't need source for clear and dest */ - if(!docopy) return TRUE; - - dstPtr = (CARD32*)(pSiS->FbBase + (pSiS->AccelLinearScratch->offset << sbppshift)); - - if(pSiS->alphaBlitBusy) { - pSiS->alphaBlitBusy = FALSE; - SiSIdle - } - - if(alpha == 0xffff) { - - while(height--) { - for(x = 0; x < width; x++) { - myalpha = alphaPtr[x]; - dstPtr[x] = (renderaccelarray[red + myalpha] << 16) | - (renderaccelarray[green + myalpha] << 8) | - renderaccelarray[blue + myalpha] | - myalpha << 24; - } - dstPtr += pitch; - alphaPtr += alphaPitch; - } - - } else { - - alpha &= 0xff00; - - while(height--) { - for(x = 0; x < width; x++) { - myalpha = alphaPtr[x]; - dstPtr[x] = (renderaccelarray[alpha + myalpha] << 24) | - (renderaccelarray[red + myalpha] << 16) | - (renderaccelarray[green + myalpha] << 8) | - renderaccelarray[blue + myalpha]; - } - dstPtr += pitch; - alphaPtr += alphaPitch; - } - - } - - return TRUE; -} - -static Bool -SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn, - int op, -#ifdef SISNEWRENDER - CARD32 texType, CARD32 dstType, -#else - int texType, -#endif - CARD8 *texPtr, - int texPitch, int width, - int height, int flags) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD8 *dst; - int pitch, sizeNeeded; - int sbpp = pSiS->CurrentLayout.bitsPerPixel >> 3; - int sbppshift = sbpp >> 1; /* 8->0, 16->1, 32->2 */ - int bppshift = PICT_FORMAT_BPP(texType) >> 4; /* 8->0, 16->1, 32->2 */ - Bool docopy = TRUE; - -#ifdef ACCELDEBUG - xf86DrvMsg(0, X_INFO, "T: type %x op %d w %d h %d T-pitch %d\n", - texType, op, width, height, texPitch); -#endif - - if(op > SiSRenderOpsMAX) return FALSE; - if(!SiSRenderOps[op]) return FALSE; - - if((width > 2048) || (height > 2048)) return FALSE; - - pitch = (width + 31) & ~31; - sizeNeeded = (pitch << bppshift) * height; - -#ifdef ACCELDEBUG - xf86DrvMsg(0, X_INFO, "T: %x op %x w %d h %d T-pitch %d size %d (%d %d %d)\n", - texType, op, width, height, texPitch, sizeNeeded, sbpp, sbppshift, bppshift); -#endif - - if(!SiSAllocateLinear(pScrn, (sizeNeeded + sbpp - 1) >> sbppshift)) - return FALSE; - - width <<= bppshift; /* -> bytes (for engine and memcpy) */ - pitch <<= bppshift; /* -> bytes */ - - SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - switch(op) { - case PictOpClear: - case PictOpDisjointClear: - case PictOpConjointClear: - SiSSetupPATFGDSTRect(0, pSiS->scrnOffset, DEV_HEIGHT) - /* SiSSetupROP(0x00) - is already zero */ - SiSSetupCMDFlag(PATFG) - docopy = FALSE; - break; - case PictOpSrc: - case PictOpDisjointSrc: - case PictOpConjointSrc: - SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, DEV_HEIGHT); - SiSSetupAlpha(0xff) - SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_NODESTALPHA) - break; - case PictOpDst: - case PictOpDisjointDst: - case PictOpConjointDst: - SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, DEV_HEIGHT); - SiSSetupAlpha(0x00) - SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_CONSTANTALPHA) - docopy = FALSE; - break; - case PictOpOver: - SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, DEV_HEIGHT); - SiSSetupAlpha(0x00) - SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA) - break; - default: - return FALSE; - } - SiSSyncWP - - /* Don't need source for clear and dest */ - if(!docopy) return TRUE; - - dst = (CARD8*)(pSiS->FbBase + (pSiS->AccelLinearScratch->offset << sbppshift)); - - if(pSiS->alphaBlitBusy) { - pSiS->alphaBlitBusy = FALSE; - SiSIdle - } - - while(height--) { - memcpy(dst, texPtr, width); - texPtr += texPitch; - dst += pitch; - } - - return TRUE; -} - -static void -SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn, - int dst_x, int dst_y, - int src_x, int src_y, - int width, int height) -{ - SISPtr pSiS = SISPTR(pScrn); - CARD32 srcbase, dstbase; - - srcbase = pSiS->AccelLinearScratch->offset << 1; - if(pScrn->bitsPerPixel == 32) srcbase <<= 1; - -#ifdef ACCELDEBUG - xf86DrvMsg(0, X_INFO, "FIRE: scrbase %x dx %d dy %d w %d h %d\n", - srcbase, dst_x, dst_y, width, height); -#endif - - dstbase = 0; - if((dst_y >= pScrn->virtualY) || (dst_y >= 2048)) { - dstbase = pSiS->scrnOffset * dst_y; - dst_y = 0; - } - - srcbase += FBOFFSET; - dstbase += FBOFFSET; - - SiSCheckQueue(16 * 3) - SiSSetupSRCDSTBase(srcbase,dstbase); - SiSSetupSRCDSTXY(src_x, src_y, dst_x, dst_y) - SiSSetRectDoCMD(width,height) - pSiS->alphaBlitBusy = TRUE; -} -#endif -#endif - -#endif /* XAA */ - #ifdef SIS_USE_EXA /* ---------------------------- EXA -------------------------- */ static void @@ -1651,24 +567,10 @@ SiS315AccelInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); SISPtr pSiS = SISPTR(pScrn); -#ifdef SIS_USE_XAA - XAAInfoRecPtr infoPtr = NULL; - int topFB, reservedFbSize, usableFbSize; - BoxRec Avail; -#ifdef CTSCE - unsigned char *AvailBufBase; -#ifndef CTSCE_DIRECT - int i; -#endif -#endif -#endif /* XAA */ pSiS->ColorExpandBufferNumber = 0; pSiS->PerColorExpandBufferSize = 0; pSiS->RenderAccelArray = NULL; -#ifdef SIS_USE_XAA - pSiS->AccelInfoPtr = NULL; -#endif #ifdef SIS_USE_EXA pSiS->EXADriverPtr = NULL; pSiS->exa_scratch = NULL; @@ -1681,12 +583,6 @@ SiS315AccelInit(ScreenPtr pScreen) } if(!pSiS->NoAccel) { -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if(!infoPtr) pSiS->NoAccel = TRUE; - } -#endif #ifdef SIS_USE_EXA if(pSiS->useEXA) { if(!(pSiS->EXADriverPtr = exaDriverAlloc())) { @@ -1706,160 +602,6 @@ SiS315AccelInit(ScreenPtr pScreen) pSiS->FillRect = SiSDGAFillRect; pSiS->BlitRect = SiSDGABlitRect; -#ifdef SIS_USE_XAA /* ----------------------- XAA ----------------------- */ - if(!pSiS->useEXA) { - - infoPtr->Flags = LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS | - PIXMAP_CACHE; - - /* sync */ - infoPtr->Sync = SiSSync; - - /* BitBlt */ - infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | TRANSPARENCY_GXCOPY_ONLY; - - /* solid fills */ - infoPtr->SetupForSolidFill = SiSSetupForSolidFill; - infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; -#ifdef TRAP - if((pSiS->Chipset != PCI_CHIP_SIS660) && - (pSiS->Chipset != PCI_CHIP_SIS330) && - (pSiS->Chipset != PCI_CHIP_SIS340) && - (pSiS->Chipset != PCI_CHIP_XGIXG20) && - (pSiS->Chipset != PCI_CHIP_XGIXG40)) { - infoPtr->SubsequentSolidFillTrap = SiSSubsequentSolidFillTrap; - } -#endif - infoPtr->SolidFillFlags = NO_PLANEMASK; - - /* solid line */ - infoPtr->SetupForSolidLine = SiSSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; - infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; - infoPtr->SolidLineFlags = NO_PLANEMASK; - - /* dashed line */ - infoPtr->SetupForDashedLine = SiSSetupForDashedLine; - infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; - infoPtr->DashPatternMaxLength = 64; - infoPtr->DashedLineFlags = NO_PLANEMASK | - LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; - - /* 8x8 mono pattern fill */ - infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMonoPatternFill; -#ifdef TRAP - if((pSiS->Chipset != PCI_CHIP_SIS660) && - (pSiS->Chipset != PCI_CHIP_SIS330) && - (pSiS->Chipset != PCI_CHIP_SIS340) && - (pSiS->Chipset != PCI_CHIP_XGIXG20) && - (pSiS->Chipset != PCI_CHIP_XGIXG40)) { - infoPtr->SubsequentMono8x8PatternFillTrap = SiSSubsequentMonoPatternFillTrap; - } -#endif - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - BIT_ORDER_IN_BYTE_MSBFIRST; - - /* 8x8 color pattern fill (MMIO support not implemented) */ - infoPtr->SetupForColor8x8PatternFill = SiSSetupForColor8x8PatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = SiSSubsequentColor8x8PatternFillRect; - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - NO_TRANSPARENCY; - -#ifdef STSCE - /* Screen To Screen Color Expand */ - /* The hardware does not support this the way we need it, because - * the mono-bitmap is not provided with a pitch of (width), but - * with a pitch of scrnOffset (= width * bpp / 8). - */ - infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpand; - infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpand; - infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST ; -#endif - -#ifdef CTSCE -#ifdef CTSCE_DIRECT - /* CPU color expansion - direct method - * - * We somewhat fake this function here in the following way: - * XAA copies its mono-bitmap data not into an aperture, but - * into our video RAM buffer. We then do a ScreenToScreen - * color expand. - * Unfortunately, XAA sends the data to the aperture AFTER - * the call to Subsequent(), therefore we do not execute the - * command in Subsequent, but in the following call to Sync(). - * (Hence, the SYNC_AFTER_COLOR_EXPAND flag MUST BE SET) - * - * This is slower than doing it by the CPU. - */ - - pSiS->ColorExpandBufferNumber = 48; - pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; - infoPtr->SetupForCPUToScreenColorExpandFill = SiSSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = SiSSubsequentCPUToScreenColorExpandFill; - infoPtr->ColorExpandRange = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize; - infoPtr->CPUToScreenColorExpandFillFlags = - NO_PLANEMASK | - CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST | - LEFT_EDGE_CLIPPING | - SYNC_AFTER_COLOR_EXPAND; -#endif -#endif - -#ifdef INCL_RENDER -#ifdef RENDER - /* Render */ - SiSCalcRenderAccelArray(pScrn); - - if(pSiS->RenderAccelArray) { - pSiS->AccelLinearScratch = NULL; - -#ifdef SISNEWRENDER - infoPtr->SetupForCPUToScreenAlphaTexture2 = SiSSetupForCPUToScreenAlphaTexture; - infoPtr->CPUToScreenAlphaTextureDstFormats = (pScrn->bitsPerPixel == 16) ? - SiSDstTextureFormats16 : SiSDstTextureFormats32; -#else - infoPtr->SetupForCPUToScreenAlphaTexture = SiSSetupForCPUToScreenAlphaTexture; -#endif - infoPtr->SubsequentCPUToScreenAlphaTexture = SiSSubsequentCPUToScreenTexture; - infoPtr->CPUToScreenAlphaTextureFormats = SiSAlphaTextureFormats; - infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE; - -#ifdef SISNEWRENDER - infoPtr->SetupForCPUToScreenTexture2 = SiSSetupForCPUToScreenTexture; - infoPtr->CPUToScreenTextureDstFormats = (pScrn->bitsPerPixel == 16) ? - SiSDstTextureFormats16 : SiSDstTextureFormats32; -#else - infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture; -#endif - infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture; - infoPtr->CPUToScreenTextureFormats = SiSTextureFormats; - infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RENDER acceleration enabled\n"); - } -#endif -#endif - -#ifdef SISDUALHEAD - if(pSiS->DualHeadMode) { - infoPtr->RestoreAccelState = SiSRestoreAccelState; - } -#endif - } /* !EXA */ -#endif /* XAA */ - #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */ if(pSiS->useEXA) { pSiS->EXADriverPtr->exa_major = 2; @@ -1928,65 +670,6 @@ SiS315AccelInit(ScreenPtr pScreen) * LFB) */ -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - - topFB = pSiS->maxxfbmem; /* relative to FbBase */ - - reservedFbSize = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize; - - usableFbSize = topFB - reservedFbSize; - -#ifdef CTSCE - AvailBufBase = pSiS->FbBase + usableFbSize; - if(pSiS->ColorExpandBufferNumber) { -#ifdef CTSCE_DIRECT - infoPtr->ColorExpandBase = (unsigned char *)AvailBufBase; - pSiS->ColorExpandBase = usableFbSize; -#else - for(i = 0; i < pSiS->ColorExpandBufferNumber; i++) { - pSiS->ColorExpandBufferAddr[i] = AvailBufBase + - i * pSiS->PerColorExpandBufferSize; - pSiS->ColorExpandBufferScreenOffset[i] = usableFbSize + - i * pSiS->PerColorExpandBufferSize; - } -#endif - } -#endif - - Avail.x1 = 0; - Avail.y1 = 0; - Avail.x2 = pScrn->displayWidth; - Avail.y2 = (usableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8)) - 1; - - if(Avail.y2 < 0) Avail.y2 = 32767; - - if(Avail.y2 < pScrn->currentMode->VDisplay) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Not enough video RAM for accelerator. At least " - "%dKB needed, %dKB available\n", - ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* +8 for make it sure */ - * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8, - pSiS->maxxfbmem/1024); - pSiS->NoAccel = TRUE; - pSiS->NoXvideo = TRUE; - XAADestroyInfoRec(pSiS->AccelInfoPtr); - pSiS->AccelInfoPtr = NULL; - return FALSE; /* Don't even init fb manager */ - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Framebuffer from (%d,%d) to (%d,%d)\n", - Avail.x1, Avail.y1, Avail.x2 - 1, Avail.y2 - 1); - - xf86InitFBManager(pScreen, &Avail); - - if(!pSiS->NoAccel) { - return XAAInit(pScreen, infoPtr); - } - } /* !EXA */ -#endif /* XAA */ - #ifdef SIS_USE_EXA if(pSiS->useEXA) { diff --git a/src/sis6326_video.c b/src/sis6326_video.c index 10e0806..7308d4c 100644 --- a/src/sis6326_video.c +++ b/src/sis6326_video.c @@ -35,9 +35,6 @@ #include "sis.h" -#ifdef SIS_USE_XAA -#include "xf86fbman.h" -#endif #include "xf86xv.h" #include "regionstr.h" #include diff --git a/src/sis_accel.c b/src/sis_accel.c index dc45f2b..26340c5 100644 --- a/src/sis_accel.c +++ b/src/sis_accel.c @@ -38,19 +38,8 @@ #include "sis.h" #include "sis_regs.h" -#ifdef SIS_USE_XAA -#include "xaarop.h" -#endif #include "sis_accel.h" -#ifdef SIS_USE_XAA - -#if 0 -#define CTSCE /* Include enhanced color expansion code */ -#endif /* This produces drawing errors sometimes */ - -#endif /* XAA */ - #ifdef SIS_USE_EXA extern void SiSScratchSave(ScreenPtr pScreen, ExaOffscreenArea *area); extern Bool SiSUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst); @@ -178,287 +167,6 @@ SiSSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) sisSETCMD(op); } -#ifdef SIS_USE_XAA /* ---------------------------- XAA -------------------------- */ - -/* Clipping */ -static void -SiSSetClippingRectangle(ScrnInfoPtr pScrn, - int left, int top, int right, int bottom) -{ - SISPtr pSiS = SISPTR(pScrn); - - sisBLTSync; - sisSETCLIPTOP(left,top); - sisSETCLIPBOTTOM(right,bottom); - pSiS->ClipEnabled = TRUE; -} - -static void -SiSDisableClipping(ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - pSiS->ClipEnabled = FALSE; -} - -/* 8x8 mono */ -static void -SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, - int fg, int bg, int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - unsigned int *patternRegPtr; - int i; - - (void)XAAHelpPatternROP(pScrn, &fg, &bg, planemask, &rop); - - sisBLTSync; - if(bg != -1) { - sisSETBGROPCOL(0xcc, bg); /* copy */ - } else { - sisSETBGROPCOL(0xAA, bg); /* noop */ - } - sisSETFGROPCOL(rop, fg); - sisSETPITCH(0, pSiS->scrnOffset); - sisSETSRCADDR(0); - patternRegPtr = (unsigned int *)sisSETPATREG(); - pSiS->sisPatternReg[0] = pSiS->sisPatternReg[2] = patternx ; - pSiS->sisPatternReg[1] = pSiS->sisPatternReg[3] = patterny ; - for(i = 0 ; i < 16 /* sisPatternHeight */ ; ) { - patternRegPtr[i++] = patternx ; - patternRegPtr[i++] = patterny ; - } -} - -static void -SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, - int patterny, int x, int y, int w, int h) -{ - SISPtr pSiS = SISPTR(pScrn); - register UChar *patternRegPtr; - register UChar *srcPatternRegPtr; - register unsigned int *patternRegPtrL; - UShort tmp; - int dstaddr, i, k, shift; - int op = sisCMDCOLEXP | - sisTOP2BOTTOM | - sisLEFT2RIGHT | - sisPATFG | - sisSRCBG; - - if(pSiS->ClipEnabled) - op |= sisCLIPINTRN | sisCLIPENABL; - - dstaddr = ( y * pSiS->CurrentLayout.displayWidth + x ) * - pSiS->CurrentLayout.bitsPerPixel / 8; - - sisBLTSync; - - patternRegPtr = sisSETPATREG(); - srcPatternRegPtr = (UChar *)pSiS->sisPatternReg ; - shift = 8 - patternx ; - for(i = 0, k = patterny ; i < 8 ; i++, k++ ) { - tmp = srcPatternRegPtr[k]<<8 | srcPatternRegPtr[k] ; - tmp >>= shift ; - patternRegPtr[i] = tmp & 0xff; - } - patternRegPtrL = (unsigned int *)sisSETPATREG(); - for(i = 2 ; i < 16 /* sisPatternHeight */; ) { - patternRegPtrL[i++] = patternRegPtrL[0]; - patternRegPtrL[i++] = patternRegPtrL[1]; - } - - sisSETDSTADDR(dstaddr); - sisSETHEIGHTWIDTH(h-1, w*(pSiS->CurrentLayout.bitsPerPixel/8)-1); - sisSETCMD(op); -} - -/* Line */ -static void -SiSSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) -{ - SISPtr pSiS = SISPTR(pScrn); - - sisBLTSync; - sisSETBGROPCOL(SiSGetCopyROP(rop), 0); - sisSETFGROPCOL(SiSGetCopyROP(rop), color); -} - -static void -SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) - -{ - SISPtr pSiS = SISPTR(pScrn); - int op, major, minor, err, K1, K2, tmp; - - op = sisCMDLINE | sisSRCFG; - - if((flags & OMIT_LAST)) - op |= sisLASTPIX; - - if(pSiS->ClipEnabled) - op |= sisCLIPINTRN | sisCLIPENABL; - - if((major = x2 - x1) <= 0) - major = -major; - else - op |= sisXINCREASE; - - if((minor = y2 - y1) <= 0) - minor = -minor; - else - op |= sisYINCREASE; - - if(minor >= major) { - tmp = minor; - minor = major; - major = tmp; - } else - op |= sisXMAJOR; - - K1 = (minor - major) << 1; - K2 = minor << 1; - err = (minor << 1) - major; - - sisBLTSync; - sisSETXStart(x1); - sisSETYStart(y1); - sisSETLineSteps((short)K1,(short)K2); - sisSETLineErrorTerm((short)err); - sisSETLineMajorCount((short)major); - sisSETCMD(op); -} - -static void -SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir) -{ - SISPtr pSiS = SISPTR(pScrn); - int destaddr, op; - - destaddr = y * pSiS->CurrentLayout.displayWidth + x; - - op = sisCMDBLT | sisSRCFG | sisTOP2BOTTOM | sisLEFT2RIGHT; - - if(pSiS->ClipEnabled) - op |= sisCLIPINTRN | sisCLIPENABL; - - destaddr *= (pSiS->CurrentLayout.bitsPerPixel / 8); - - sisBLTSync; - - sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset); - - if(dir == DEGREES_0) { - sisSETHEIGHTWIDTH(0, len * (pSiS->CurrentLayout.bitsPerPixel >> 3) - 1); - } else { - sisSETHEIGHTWIDTH(len - 1, (pSiS->CurrentLayout.bitsPerPixel >> 3) - 1); - } - - sisSETDSTADDR(destaddr); - sisSETCMD(op); -} - -#ifdef CTSCE -/* ----- CPU To Screen Color Expand (scanline-wise) ------ */ -static void -SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask) -{ - SISPtr pSiS=SISPTR(pScrn); - - pSiS->CommandReg = 0; - - pSiS->CommandReg |= (sisCMDECOLEXP | - sisLEFT2RIGHT | - sisTOP2BOTTOM); - - sisBLTSync; - - /* The combination of flags in the following - * is not understandable. However, this is the - * only combination that seems to work. - */ - if(bg == -1) { - sisSETROPBG(0xAA); /* dst = dst (=noop) */ - pSiS->CommandReg |= sisSRCFG; - } else { - sisSETBGROPCOL(SiSGetPatternROP(rop), bg); - pSiS->CommandReg |= sisSRCFG | sisPATBG; - } - - sisSETFGROPCOL(SiSGetCopyROP(rop), fg); - - sisSETDSTPITCH(pSiS->scrnOffset); -} - - -static void -SiSSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, int x, int y, int w, - int h, int skipleft) -{ - SISPtr pSiS = SISPTR(pScrn); - int _x0, _y0, _x1, _y1; - int op = pSiS->CommandReg; - - if(skipleft > 0) { - _x0 = x + skipleft; - _y0 = y; - _x1 = x + w; - _y1 = y + h; - sisSETCLIPTOP(_x0, _y0); - sisSETCLIPBOTTOM(_x1, _y1); - op |= sisCLIPENABL; - } else { - op &= (~(sisCLIPINTRN | sisCLIPENABL)); - } - - sisSETSRCPITCH(((((w + 7) / 8) + 3) >> 2) * 4); - - sisSETHEIGHTWIDTH(1-1, (w * (pSiS->CurrentLayout.bitsPerPixel/8)) - 1); - - pSiS->xcurrent = x; - pSiS->ycurrent = y; - - pSiS->CommandReg = op; -} - -static void -SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - SISPtr pSiS = SISPTR(pScrn); - unsigned long cbo = pSiS->ColorExpandBufferScreenOffset[bufno]; - int op = pSiS->CommandReg; - int destaddr; - - destaddr = (pSiS->ycurrent * pSiS->CurrentLayout.displayWidth) + pSiS->xcurrent; - destaddr *= (pSiS->CurrentLayout.bitsPerPixel / 8); - - /* Wait until there is no color expansion command in queue */ - /* sisBLTSync; */ - - sisSETSRCADDR(cbo); - - sisSETDSTADDR(destaddr); - - sisSETCMD(op); - - pSiS->ycurrent++; - - /* Wait for eventual color expand commands to finish */ - /* (needs to be done, otherwise the data in the buffer may - * be overwritten while accessed by the hardware) - */ - while((SIS_MMIO_IN32(pSiS->IOBase, 0x8284) & 0x80000000)) {} - - sisBLTSync; -} -#endif /* CTSCE */ - -#endif /* XAA */ - #ifdef SIS_USE_EXA /* ---------------------------- EXA -------------------------- */ static void @@ -644,31 +352,16 @@ SiSAccelInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); SISPtr pSiS = SISPTR(pScrn); -#ifdef SIS_USE_XAA - XAAInfoRecPtr infoPtr = NULL; - int topFB, reservedFbSize, usableFbSize, i; - UChar *AvailBufBase; - BoxRec Avail; -#endif pSiS->ColorExpandBufferNumber = 0; pSiS->PerColorExpandBufferSize = 0; pSiS->RenderAccelArray = NULL; -#ifdef SIS_USE_XAA - pSiS->AccelInfoPtr = NULL; -#endif #ifdef SIS_USE_EXA pSiS->EXADriverPtr = NULL; pSiS->exa_scratch = NULL; #endif if(!pSiS->NoAccel) { -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if(!infoPtr) pSiS->NoAccel = TRUE; - } -#endif #ifdef SIS_USE_EXA if(pSiS->useEXA) { if(!(pSiS->EXADriverPtr = exaDriverAlloc())) { @@ -688,80 +381,6 @@ SiSAccelInit(ScreenPtr pScreen) pSiS->FillRect = SiSDGAFillRect; pSiS->BlitRect = SiSDGABlitRect; -#ifdef SIS_USE_XAA /* ----------------------- XAA ----------------------- */ - if(!pSiS->useEXA) { - - infoPtr->Flags = LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS | - PIXMAP_CACHE; - - /* Sync */ - infoPtr->Sync = SiSSync; - - /* Screen To Screen copy */ - infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; - - /* Solid fill */ - infoPtr->SetupForSolidFill = SiSSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = SiSSubsequentFillRectSolid; - infoPtr->SolidFillFlags = NO_PLANEMASK; - - /* On 5597/5598 and 6326, clipping and lines only work - for 1024, 2048, 4096 logical width */ - if(pSiS->ValidWidth) { - /* Clipping */ - infoPtr->SetClippingRectangle = SiSSetClippingRectangle; - infoPtr->DisableClipping = SiSDisableClipping; - infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE | - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | - HARDWARE_CLIP_MONO_8x8_FILL | - HARDWARE_CLIP_SOLID_FILL ; - - /* Solid Lines */ - infoPtr->SetupForSolidLine = SiSSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; - infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorVertLine; - infoPtr->SolidLineFlags = NO_PLANEMASK; - } - - if(pScrn->bitsPerPixel != 24) { - /* 8x8 mono pattern */ - infoPtr->SetupForMono8x8PatternFill = SiSSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMono8x8PatternFillRect; - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - } - -#ifdef CTSCE - if(pScrn->bitsPerPixel != 24) { - /* per-scanline color expansion (using indirect method) */ - pSiS->ColorExpandBufferNumber = 4; - pSiS->ColorExpandBufferCountMask = 0x03; - pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31) / 32) * 4; - - infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; - infoPtr->ScanlineColorExpandBuffers = (UChar **)&pSiS->ColorExpandBufferAddr[0]; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - SiSSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - SiSSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - SiSSubsequentColorExpandScanline; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | - CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST | - LEFT_EDGE_CLIPPING; - } -#endif - } /* !exa */ -#endif /* XAA */ - #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */ if(pSiS->useEXA) { pSiS->EXADriverPtr->exa_major = 2; @@ -812,57 +431,6 @@ SiSAccelInit(ScreenPtr pScreen) * topFB */ -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - - topFB = pSiS->maxxfbmem; - - reservedFbSize = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize; - - usableFbSize = topFB - reservedFbSize; - - if(pSiS->ColorExpandBufferNumber) { - AvailBufBase = pSiS->FbBase + usableFbSize; - for(i = 0; i < pSiS->ColorExpandBufferNumber; i++) { - pSiS->ColorExpandBufferAddr[i] = AvailBufBase + - i * pSiS->PerColorExpandBufferSize; - pSiS->ColorExpandBufferScreenOffset[i] = usableFbSize + - i * pSiS->PerColorExpandBufferSize; - } - } - - Avail.x1 = 0; - Avail.y1 = 0; - Avail.x2 = pScrn->displayWidth; - Avail.y2 = usableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel / 8) - 1; - - if(Avail.y2 < 0) Avail.y2 = 32767; - - if(Avail.y2 < pScrn->currentMode->VDisplay) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Not enough video RAM for accelerator: %dKB needed, %dKB available\n", - ((((pScrn->displayWidth * pScrn->bitsPerPixel/8) /* +8 for make it sure */ - * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8, - pSiS->maxxfbmem/1024); - pSiS->NoAccel = TRUE; - pSiS->NoXvideo = TRUE; - XAADestroyInfoRec(pSiS->AccelInfoPtr); - pSiS->AccelInfoPtr = NULL; - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Framebuffer from (%d,%d) to (%d,%d)\n", - Avail.x1, Avail.y1, Avail.x2 - 1, Avail.y2 - 1); - - xf86InitFBManager(pScreen, &Avail); - - if(!pSiS->NoAccel) { - return XAAInit(pScreen, infoPtr); - } - } /* !exa */ -#endif - #ifdef SIS_USE_EXA if(pSiS->useEXA) { @@ -893,10 +461,3 @@ SiSAccelInit(ScreenPtr pScreen) return TRUE; } - - - - - - - diff --git a/src/sis_dga.c b/src/sis_dga.c index ad37d66..8ddf777 100644 --- a/src/sis_dga.c +++ b/src/sis_dga.c @@ -439,11 +439,6 @@ SIS_FillRect( if(pSiS->FillRect) { (*pSiS->FillRect)(pScrn, x, y, w, h, (int)color); -#ifdef SIS_USE_XAA - if(!pSiS->useEXA && pSiS->AccelInfoPtr) { - SET_SYNC_FLAG(pSiS->AccelInfoPtr); - } -#endif } } @@ -458,11 +453,6 @@ SIS_BlitRect( if(pSiS->BlitRect) { (*pSiS->BlitRect)(pScrn, srcx, srcy, dstx, dsty, w, h, -1); -#ifdef SIS_USE_XAA - if(!pSiS->useEXA && pSiS->AccelInfoPtr) { - SET_SYNC_FLAG(pSiS->AccelInfoPtr); - } -#endif } } @@ -478,11 +468,6 @@ SIS_BlitTransRect( if(pSiS->BlitRect) { (*pSiS->BlitRect)(pScrn, srcx, srcy, dstx, dsty, w, h, (int)color); -#ifdef SIS_USE_XAA - if(!pSiS->useEXA && pSiS->AccelInfoPtr) { - SET_SYNC_FLAG(pSiS->AccelInfoPtr); - } -#endif } } diff --git a/src/sis_driver.c b/src/sis_driver.c index de71e55..002e481 100644 --- a/src/sis_driver.c +++ b/src/sis_driver.c @@ -3494,9 +3494,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->SiSFastVidCopyFrom = SiSVidCopyGetDefault(); pSiS->SiSFastMemCopyFrom = SiSVidCopyGetDefault(); pSiS->SiSFastVidCopyDone = FALSE; -#ifdef SIS_USE_XAA - pSiS->RenderCallback = NULL; -#endif #ifdef SIS_USE_EXA pSiS->ExaRenderCallback = NULL; #endif @@ -6688,16 +6685,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Load XAA/EXA (if needed) */ if(!pSiS->NoAccel) { -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - if (!xf86LoadSubModule(pScrn, "xaa")) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Falling back to shadowfb\n"); - pSiS->NoAccel = 1; - pSiS->ShadowFB = 1; - } - } -#endif #ifdef SIS_USE_EXA if(pSiS->useEXA) { XF86ModReqInfo req; @@ -7969,11 +7956,6 @@ SISBlockHandler(BLOCKHANDLER_ARGS_DECL) (*pSiS->VideoTimerCallback)(pScrn, currentTime.milliseconds); } -#ifdef SIS_USE_XAA - if(pSiS->RenderCallback) { - (*pSiS->RenderCallback)(pScrn); - } -#endif #ifdef SIS_USE_EXA if(pSiS->ExaRenderCallback) { (*pSiS->ExaRenderCallback)(pScrn); @@ -9658,19 +9640,6 @@ SISCloseScreen(CLOSE_SCREEN_ARGS_DECL) pSiS->pInt = NULL; } -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - if(pSiS->AccelLinearScratch) { - xf86FreeOffscreenLinear(pSiS->AccelLinearScratch); - pSiS->AccelLinearScratch = NULL; - } - if(pSiS->AccelInfoPtr) { - XAADestroyInfoRec(pSiS->AccelInfoPtr); - pSiS->AccelInfoPtr = NULL; - } - } -#endif - #ifdef SIS_USE_EXA if(pSiS->useEXA) { if(pSiS->EXADriverPtr) { diff --git a/src/sis_opt.c b/src/sis_opt.c index b4f04a5..f3997fc 100644 --- a/src/sis_opt.c +++ b/src/sis_opt.c @@ -157,9 +157,6 @@ typedef enum { static const OptionInfoRec SISOptions[] = { { OPTION_ACCEL, "Accel", OPTV_BOOLEAN, {0}, FALSE }, -#if defined(SIS_USE_XAA) && defined(SIS_USE_EXA) - { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE }, -#endif { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HOSTBUS, "HostBus", OPTV_BOOLEAN, {0}, FALSE }, @@ -465,11 +462,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->Rotate = 0; pSiS->Reflect = 0; pSiS->NoAccel = FALSE; -#if (defined(SIS_USE_EXA) && defined(SIS_USE_XAA)) || !defined(SIS_USE_EXA) - pSiS->useEXA = FALSE; -#else pSiS->useEXA = TRUE; -#endif pSiS->ShadowFB = FALSE; pSiS->loadDRI = FALSE; #ifdef SISDRI @@ -702,40 +695,10 @@ SiSOptions(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration disabled\n"); } -#if defined(SIS_USE_XAA) && defined(SIS_USE_EXA) - if(!pSiS->NoAccel) { - from = X_DEFAULT; - if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ACCELMETHOD))) { - if(!xf86NameCmp(strptr,"XAA")) { - from = X_CONFIG; - pSiS->useEXA = FALSE; - } else if(!xf86NameCmp(strptr,"EXA")) { - from = X_CONFIG; - pSiS->useEXA = TRUE; - } - } - xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration architecture\n", - pSiS->useEXA ? "EXA" : "XAA"); - } -#endif - /* RenderAcceleration * En/Disables RENDER acceleration (315/330/340 series only, not 550, not XGI Z7) */ -#ifdef SIS_USE_XAA - if((pSiS->VGAEngine == SIS_315_VGA) && - (pSiS->Chipset != PCI_CHIP_SIS550) && - (pSiS->Chipset != PCI_CHIP_XGIXG20) && - (!pSiS->NoAccel)) { - if(xf86GetOptValBool(pSiS->Options, OPTION_RENDER, &pSiS->doRender)) { - if(!pSiS->doRender) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "RENDER Acceleration disabled\n"); - } - } - } -#else pSiS->doRender = FALSE; -#endif /* SWCursor, HWCursor * Chooses whether to use the hardware or software cursor @@ -987,9 +950,6 @@ SiSOptions(ScrnInfoPtr pScrn) OPTION_SISTVCOLCALIBFINE, OPTION_TVXPOSOFFSET, OPTION_TVYPOSOFFSET, OPTION_TVXSCALE, OPTION_TVYSCALE, OPTION_TVBLUE, OPTION_CRT2GAMMA, OPTION_XVONCRT2, OPTION_XVDEFAULTADAPTOR, OPTION_XVMEMCPY, OPTION_XVBENCHCPY, OPTION_FORCE2ASPECT, -#if defined(SIS_USE_XAA) && defined(SIS_USE_EXA) - OPTION_ACCELMETHOD, -#endif #ifndef SISCHECKOSSSE OPTION_XVSSECOPY, #endif diff --git a/src/sis_video.c b/src/sis_video.c index ce16d8e..726119b 100644 --- a/src/sis_video.c +++ b/src/sis_video.c @@ -97,9 +97,6 @@ #endif #include "sis.h" -#ifdef SIS_USE_XAA -#include "xf86fbman.h" -#endif #include "regionstr.h" #include "xf86xv.h" @@ -3193,49 +3190,6 @@ SISAllocateFBMemory( SISPtr pSiS = SISPTR(pScrn); ScreenPtr pScreen = xf86ScrnToScreen(pScrn); -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - FBLinearPtr linear = (FBLinearPtr)(*handle); - FBLinearPtr new_linear; - int depth = pSiS->CurrentLayout.bitsPerPixel >> 3; - int size = ((bytesize + depth - 1) / depth); - - if(linear) { - if(linear->size >= size) { - return (unsigned int)(linear->offset * depth); - } - - if(xf86ResizeOffscreenLinear(linear, size)) { - return (unsigned int)(linear->offset * depth); - } - - xf86FreeOffscreenLinear(linear); - *handle = NULL; - } - - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8, NULL, NULL, NULL); - - if(!new_linear) { - int max_size; - - xf86QueryLargestOffscreenLinear(pScreen, &max_size, 8, PRIORITY_EXTREME); - - if(max_size < size) - return 0; - - xf86PurgeUnlockedOffscreenAreas(pScreen); - new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8, NULL, NULL, NULL); - } - if(!new_linear) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Xv: Failed to allocate %d pixels of linear video memory\n", size); - return 0; - } else { - *handle = (void *)new_linear; - return (unsigned int)(new_linear->offset * depth); - } - } -#endif #ifdef SIS_USE_EXA if(pSiS->useEXA && !pSiS->NoAccel) { ExaOffscreenArea *area = (ExaOffscreenArea *)(*handle); @@ -3269,13 +3223,6 @@ SISFreeFBMemory(ScrnInfoPtr pScrn, void **handle) ScreenPtr pScreen = xf86ScrnToScreen(pScrn); #endif -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - if(*handle) { - xf86FreeOffscreenLinear((FBLinearPtr)(*handle)); - } - } -#endif #ifdef SIS_USE_EXA if(pSiS->useEXA && !pSiS->NoAccel) { if(*handle) { @@ -3336,11 +3283,6 @@ SISPutImage( ){ SISPtr pSiS = SISPTR(pScrn); SISPortPrivPtr pPriv = (SISPortPrivPtr)data; -#ifdef SIS_USE_XAA - XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr; - int depth = pSiS->CurrentLayout.bitsPerPixel >> 3; - int myreds[] = { 0x000000ff, 0x0000f800, 0, 0x00ff0000 }; -#endif int totalSize = 0; #if 0 @@ -3453,22 +3395,9 @@ SISPutImage( } /* draw these */ pPriv->PrevOverlay = pPriv->NoOverlay; -#ifdef SIS_USE_XAA - if((pPriv->NoOverlay) && pXAA && pXAA->FillMono8x8PatternRects) { - (*pXAA->FillMono8x8PatternRects)(pScrn, myreds[depth-1], - 0x000000, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes), - 0x00422418, 0x18244200, 0, 0); - } else { -#endif if(!pSiS->disablecolorkeycurrent) { xf86XVFillKeyHelper(pScrn->pScreen, (pPriv->NoOverlay) ? 0x00ff0000 : pPriv->colorKey, clipBoxes); } -#ifdef SIS_USE_XAA - } -#endif - } pPriv->currentBuf ^= 1; @@ -3667,10 +3596,6 @@ SISDisplaySurface ( { ScrnInfoPtr pScrn = surface->pScrn; SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr); -#ifdef SIS_USE_XAA - SISPtr pSiS = SISPTR(pScrn); - int myreds[] = { 0x000000ff, 0x0000f800, 0, 0x00ff0000 }; -#endif if(!pPriv->grabbedByV4L) return Success; @@ -3691,23 +3616,7 @@ SISDisplaySurface ( SISDisplayVideo(pScrn, pPriv); if(pPriv->autopaintColorKey) { -#ifdef SIS_USE_XAA - XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr; - - if((pPriv->NoOverlay) && pXAA && pXAA->FillMono8x8PatternRects) { - (*pXAA->FillMono8x8PatternRects)(pScrn, - myreds[(pSiS->CurrentLayout.bitsPerPixel >> 3) - 1], - 0x000000, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes), - 0x00422418, 0x18244200, 0, 0); - - } else { -#endif xf86XVFillKeyHelper(pScrn->pScreen, (pPriv->NoOverlay) ? 0x00ff0000 : pPriv->colorKey, clipBoxes); -#ifdef SIS_USE_XAA - } -#endif } pPriv->videoStatus = CLIENT_VIDEO_ON; @@ -3839,12 +3748,6 @@ SISSetupBlitVideo(ScreenPtr pScreen) SISBPortPrivPtr pPriv; int i; -#ifdef SIS_USE_XAA - if(!pSiS->useEXA) { - if(!pSiS->AccelInfoPtr) return NULL; - } -#endif - if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + (sizeof(DevUnion) * NUM_BLIT_PORTS) + sizeof(SISBPortPrivRec)))) {