From 30fe3074c5d40e1ddf47962ab6f681bab2e1133b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 12 May 2024 16:31:32 -0700 Subject: [PATCH] Raise minimum supported Xserver version to 1.18 (ABI_VIDEODRV_VERSION 20.0) Already effectively required by use of XNFcallocarray() introduced in xorg/xserver@b96dc999 - xserver-1.18.0, released in Nov. 2015. Allows dropping remnants of code for XAA, ISA, and pre-pciaccess X servers. Signed-off-by: Alan Coopersmith Part-of: --- configure.ac | 27 +- src/ct_accel.c | 1666 ----------------------------------------------- src/ct_cursor.c | 13 - src/ct_dga.c | 97 --- src/ct_driver.c | 179 ----- src/ct_driver.h | 7 - src/ct_video.c | 24 - 7 files changed, 1 insertion(+), 2012 deletions(-) diff --git a/configure.ac b/configure.ac index 1c87bce..a0f2ab4 100644 --- a/configure.ac +++ b/configure.ac @@ -58,7 +58,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto) XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Obtain compiler/linker options for the driver dependencies -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES]) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18 xproto fontsproto $REQUIRED_MODULES]) # Checks for libraries. SAVE_CPPFLAGS="$CPPFLAGS" @@ -75,31 +75,6 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" fi AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) -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]) - -save_CFLAGS="$CFLAGS" -CFLAGS="$XORG_CFLAGS" -AC_CHECK_DECL(xf86ConfigIsaEntity, - [AC_DEFINE(HAVE_ISA, 1, [Have ISA support])], - [], - [#include "xf86.h"]) -CFLAGS="$save_CFLAGS" # Checks for functions (often defined as inlines in compiler.h) diff --git a/src/ct_accel.c b/src/ct_accel.c index d891e26..19eaa08 100644 --- a/src/ct_accel.c +++ b/src/ct_accel.c @@ -67,1680 +67,14 @@ #define CTNAME(subname) CATNAME(CHIPS,subname) #endif -#ifdef HAVE_XAA_H - -#ifdef DEBUG -# define DEBUG_P(x) ErrorF(x"\n"); -#elif defined X_DEBUG -# define DEBUG_P(x) snprintf(CTNAME(accel_debug),1024,x"\n"); -#else -# define DEBUG_P(x) /**/ -#endif - -#ifdef X_DEBUG -static char CTNAME(accel_debug)[1024]; -#endif - -#ifdef CHIPS_HIQV -static void CTNAME(DepthChange)(ScrnInfoPtr pScrn, int depth); -#endif -static void CTNAME(8SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); -static void CTNAME(16SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); -static void CTNAME(24SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); -static void CTNAME(SubsequentSolidFillRect)(ScrnInfoPtr pScrn, - int x, int y, int w, int h); -#ifndef CHIPS_HIQV -static void CTNAME(24SubsequentSolidFillRect)(ScrnInfoPtr pScrn, - int x, int y, int w, int h); -#else -static void CTNAME(32SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); -static void CTNAME(32SubsequentSolidFillRect)(ScrnInfoPtr pScrn, - int x, int y, int w, int h); -#endif -static void CTNAME(SetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, int xdir, - int ydir, int rop, unsigned int planemask, - int trans); -static void CTNAME(SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, - int srcX, int srcY, int dstX, int dstY, - int w, int h); -static void CTNAME(SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void CTNAME(SubsequentCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -#ifndef CHIPS_HIQV -static XAACacheInfoPtr CTNAME(CacheMonoStipple)(ScrnInfoPtr pScrn, - PixmapPtr pPix); -#endif -#if !defined(CHIPS_HIQV) || defined(UNDOCUMENTED_FEATURE) -static void CTNAME(SetupForScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask); -static void CTNAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft); -#endif -static void CTNAME(SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask); -static void CTNAME(SubsequentMono8x8PatternFillRect)(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h ); -static void CTNAME(SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, - int patx, int paty, int rop, - unsigned int planemask, int trans); -static void CTNAME(SubsequentColor8x8PatternFillRect)(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h ); -#ifndef CHIPS_HIQV -static void CTNAME(SetupForImageWrite)(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, - int transparency_color, int bpp, int depth); -static void CTNAME(SubsequentImageWriteRect)(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -#else -static void CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int rop, - unsigned int planemask, int trans, int bpp, int depth); -#if 0 -static void CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *dst, int dstwidth, int bpp, int depth); -#endif -#endif -#if X_BYTE_ORDER == X_BIG_ENDIAN -# define BE_SWAP(pScrn,cPtr,x) \ - if (!BE_SWAP_APRETURE(pScrn,cPtr)) { \ - CARD8 XR0A = cPtr->readXR(cPtr,0x0A); \ - cPtr->writeXR(cPtr, 0x0A, (XR0A & 0xcf) | x); \ - } - -/* 16 bit Byte Swap */ -# define BE_SWAPON(pScrn,cPtr) BE_SWAP(pScrn,cPtr,0x10) -# define BE_SWAPOFF(pScrn,cPtr) BE_SWAP(pScrn,cPtr,0x0) -#else -# define BE_SWAPON(pScrn,cPtr) -# define BE_SWAPOFF(pScrn,cPtr) -#endif -#endif Bool CTNAME(AccelInit)(ScreenPtr pScreen) { -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("AccelInit"); - cPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if(!infoPtr) return FALSE; - - /* - * Setup some global variables - */ - cAcl->BytesPerPixel = pScrn->bitsPerPixel >> 3; - cAcl->BitsPerPixel = pScrn->bitsPerPixel; - cAcl->PitchInBytes = pScrn->displayWidth * cAcl->BytesPerPixel; - cAcl->planemask = -1; - cAcl->bgColor = -1; - cAcl->fgColor = -1; - cAcl->FbOffset = 0; - - /* - * Set up the main acceleration flags. - */ - if (cAcl->CacheEnd > cAcl->CacheStart) infoPtr->Flags = PIXMAP_CACHE; - - if (cPtr->Flags & ChipsLinearSupport) - infoPtr->Flags |= OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER; - - infoPtr->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES; - - /* - * The following line installs a "Sync" function, that waits for - * all coprocessor operations to complete. - */ - infoPtr->Sync = CTNAME(Sync); - - /* - * Setup a Screen to Screen copy (BitBLT) primitive - */ -#ifndef CHIPS_HIQV - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; - if (cAcl->BitsPerPixel == 24) - infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK; -#else - infoPtr->ScreenToScreenCopyFlags = 0; - if ((cAcl->BitsPerPixel == 24) || (cAcl->BitsPerPixel == 32)) - infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK; - - /* A Chips and Technologies application notes says that some - * 65550 have a bug that prevents 16bpp transparency. It probably - * applies to 24 bpp as well (Someone with a 65550 care to check?). - * Selection of this controlled in Probe. - */ - if (!(cPtr->Flags & ChipsColorTransparency)) - infoPtr->ScreenToScreenCopyFlags |= NO_TRANSPARENCY; -#endif - - infoPtr->SetupForScreenToScreenCopy = CTNAME(SetupForScreenToScreenCopy); - infoPtr->SubsequentScreenToScreenCopy = - CTNAME(SubsequentScreenToScreenCopy); - - /* - * Install the low-level functions for drawing solid filled rectangles. - */ - infoPtr->SolidFillFlags |= NO_PLANEMASK; - switch (cAcl->BitsPerPixel) { - case 8 : - infoPtr->SetupForSolidFill = CTNAME(8SetupForSolidFill); - infoPtr->SubsequentSolidFillRect = CTNAME(SubsequentSolidFillRect); - break; - case 16 : - infoPtr->SetupForSolidFill = CTNAME(16SetupForSolidFill); - infoPtr->SubsequentSolidFillRect = CTNAME(SubsequentSolidFillRect); - break; - case 24 : - infoPtr->SetupForSolidFill = CTNAME(24SetupForSolidFill); -#ifdef CHIPS_HIQV - infoPtr->SubsequentSolidFillRect = CTNAME(SubsequentSolidFillRect); -#else - /* - * The version of this function here uses three different - * algorithms in an attempt to maximise performance. One - * for RGB_EQUAL, another for !RGB_EQUAL && GXCOPY_ONLY - * and yet another for !RGB_EQUAL && !GXCOPY_ONLY. The - * first two versions use the 8bpp engine for the fill, - * whilst the second uses a framebuffer routine to create - * one scanline of the fill in off screen memory which is - * then used by a CopyArea function with a complex ROP. - */ - infoPtr->SubsequentSolidFillRect = CTNAME(24SubsequentSolidFillRect); -#if 0 - /* How can an unsigned quantity be less than zero? */ - if (cAcl->ScratchAddress < 0) - infoPtr->ScreenToScreenCopyFlags |= GXCOPY_ONLY; -#endif -#endif - break; -#ifdef CHIPS_HIQV - case 32: - if (cAcl->ScratchAddress > 0) { - infoPtr->SetupForSolidFill = CTNAME(32SetupForSolidFill); - infoPtr->SubsequentSolidFillRect = - CTNAME(32SubsequentSolidFillRect); - } - break; -#endif - } - -#ifdef CHIPS_HIQV - /* At 32bpp we can't use the other acceleration */ - if (cAcl->BitsPerPixel == 32) goto chips_imagewrite; -#endif - - /* - * Setup the functions that perform monochrome colour expansion - */ - -#ifdef CHIPS_HIQV - infoPtr->CPUToScreenColorExpandFillFlags = -# if X_BYTE_ORDER != X_BIG_ENDIAN - BIT_ORDER_IN_BYTE_MSBFIRST | -# endif - CPU_TRANSFER_PAD_QWORD | - LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | - ROP_NEEDS_SOURCE; -# ifdef UNDOCUMENTED_FEATURE - infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST - | LEFT_EDGE_CLIPPING; -# endif - if (cAcl->BitsPerPixel == 24) { - infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK; -# ifdef UNDOCUMENTED_FEATURE - infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK; -# endif -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (!BE_SWAP_APRETURE(pScrn,cPtr)) - infoPtr->CPUToScreenColorExpandFillFlags |= SYNC_AFTER_COLOR_EXPAND; -#endif - } - /* The ct65550 has problems with transparency which leads to video - * corruption unless disabled. - */ - if (!(cPtr->Flags & ChipsColorTransparency)) { - infoPtr->CPUToScreenColorExpandFillFlags |= NO_TRANSPARENCY; -# ifdef UNDOCUMENTED_FEATURE - infoPtr->ScreenToScreenColorExpandFillFlags |= NO_TRANSPARENCY; -# endif - } -#else /* CHIPS_HIQV */ - infoPtr->CPUToScreenColorExpandFillFlags = - BIT_ORDER_IN_BYTE_MSBFIRST | CPU_TRANSFER_PAD_DWORD | - ROP_NEEDS_SOURCE; - infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST; - infoPtr->CacheColorExpandDensity = 8; - - if (cAcl->BitsPerPixel == 24) - infoPtr->CPUToScreenColorExpandFillFlags |= TRIPLE_BITS_24BPP | - RGB_EQUAL | NO_PLANEMASK; -#endif /* CHIPS_HIQV */ - - infoPtr->SetupForCPUToScreenColorExpandFill = - CTNAME(SetupForCPUToScreenColorExpandFill); - infoPtr->SubsequentCPUToScreenColorExpandFill = - CTNAME(SubsequentCPUToScreenColorExpandFill); - -#ifndef CHIPS_HIQV - if (cAcl->BitsPerPixel != 24) { -#endif -#if !defined(CHIPS_HIQV) || defined(UNDOCUMENTED_FEATURE) - infoPtr->SetupForScreenToScreenColorExpandFill = - CTNAME(SetupForScreenToScreenColorExpandFill); - infoPtr->SubsequentScreenToScreenColorExpandFill = - CTNAME(SubsequentScreenToScreenColorExpandFill); -#endif -#ifndef CHIPS_HIQV - infoPtr->CacheMonoStipple = CTNAME(CacheMonoStipple); - } -#endif - - infoPtr->ColorExpandBase = (unsigned char *)cAcl->BltDataWindow; - infoPtr->ColorExpandRange = 64 * 1024; - - /* Mono 8x8 pattern fills */ - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST | HARDWARE_PATTERN_SCREEN_ORIGIN; - -#ifdef CHIPS_HIQV - infoPtr->SetupForMono8x8PatternFill = - CTNAME(SetupForMono8x8PatternFill); - infoPtr->SubsequentMono8x8PatternFillRect = - CTNAME(SubsequentMono8x8PatternFillRect); - if (cAcl->BitsPerPixel == 24) - infoPtr->MonoPatternPitch = 8; /* Need 8 byte alignment */ -#else - if (cAcl->BitsPerPixel != 24) { - infoPtr->SetupForMono8x8PatternFill = - CTNAME(SetupForMono8x8PatternFill); - infoPtr->SubsequentMono8x8PatternFillRect = - CTNAME(SubsequentMono8x8PatternFillRect); - } -#endif - - /* Color 8x8 pattern fills, must have a displayWidth divisible by 64 */ - if (!(pScrn->displayWidth % 64)) { -#ifdef CHIPS_HIQV - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN; - if (!(cPtr->Flags & ChipsColorTransparency)) - infoPtr->Color8x8PatternFillFlags |= NO_TRANSPARENCY; -#else - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | NO_TRANSPARENCY; -#endif - - if (cAcl->BitsPerPixel != 24) { - infoPtr->SetupForColor8x8PatternFill = - CTNAME(SetupForColor8x8PatternFill); - infoPtr->SubsequentColor8x8PatternFillRect = - CTNAME(SubsequentColor8x8PatternFillRect); - } - } - -#ifdef CHIPS_HIQV -chips_imagewrite: -#endif - - /* Setup for the Image Write functions */ -#ifdef CHIPS_HIQV - infoPtr->WritePixmapFlags = CPU_TRANSFER_PAD_QWORD | LEFT_EDGE_CLIPPING - | LEFT_EDGE_CLIPPING_NEGATIVE_X | ROP_NEEDS_SOURCE; - - if (!(cPtr->Flags & ChipsColorTransparency)) - infoPtr->WritePixmapFlags |= NO_TRANSPARENCY; - if ((cAcl->BitsPerPixel == 24) || (cAcl->BitsPerPixel == 32)) - infoPtr->WritePixmapFlags |= NO_PLANEMASK; - - infoPtr->WritePixmap = CTNAME(WritePixmap); -#if 0 /* Not used by XAA as yet, but coming soon */ - if (cPtr->Flags & ChipsImageReadSupport) { - infoPtr->ReadPixmapFlags = CPU_TRANSFER_PAD_QWORD | ROP_NEEDS_SOURCE; - infoPtr->ReadPixmap = CTNAME(ReadPixmap); - } -#endif - -#else - infoPtr->SetupForImageWrite = CTNAME(SetupForImageWrite); - infoPtr->SubsequentImageWriteRect = CTNAME(SubsequentImageWriteRect); - infoPtr->ImageWriteBase = (unsigned char *)cAcl->BltDataWindow; - infoPtr->ImageWriteRange = 64 * 1024; - infoPtr->ImageWriteFlags = NO_TRANSPARENCY | CPU_TRANSFER_PAD_DWORD - | ROP_NEEDS_SOURCE; - if ((cAcl->BitsPerPixel == 24) || (cAcl->BitsPerPixel == 32)) - infoPtr->ImageWriteFlags |= NO_PLANEMASK; -#endif - - return(XAAInit(pScreen, infoPtr)); -#else return FALSE; -#endif } -#ifdef HAVE_XAA_H -#ifdef CHIPS_HIQV -void -CTNAME(DepthChange)(ScrnInfoPtr pScrn, int depth) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - unsigned char mode; - - DEBUG_P("DepthChange"); - switch (depth) { - case 8 : - cPtr->AccelInfoRec->SetupForSolidFill = CTNAME(8SetupForSolidFill); - mode = 0x00; /* BitBLT engine to 8bpp */ - cAcl->BytesPerPixel = 1; - cAcl->FbOffset = 0; - cAcl->BitsPerPixel = 8; - break; - default : - cPtr->AccelInfoRec->SetupForSolidFill = CTNAME(16SetupForSolidFill); - mode = 0x10; /* BitBLT engine to 16bpp */ - cAcl->BytesPerPixel = 2; - cAcl->FbOffset = cPtr->FbOffset16; - cAcl->BitsPerPixel = 16; - break; - } - cAcl->PitchInBytes = pScrn->displayWidth * cAcl->BytesPerPixel; - ctBLTWAIT; - cPtr->writeXR(cPtr, 0x20, mode); /* Change BitBLT engine mode */ -} -#endif - -#endif void CTNAME(Sync)(ScrnInfoPtr pScrn) { -#ifdef HAVE_XAA_H - CHIPSPtr cPtr = CHIPSPTR(pScrn); - DEBUG_P("sync"); - ctBLTWAIT; - BE_SWAPON(pScrn,cPtr); -#endif } -#ifdef HAVE_XAA_H -static void -CTNAME(8SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("8SetupForSolidFill"); - ctBLTWAIT; - ctSETBGCOLOR8(color); - ctSETFGCOLOR8(color); - ctSETROP(ChipsAluConv2[rop & 0xF] | ctTOP2BOTTOM | ctLEFT2RIGHT | - ctPATSOLID | ctPATMONO); - ctSETPITCH(0, cAcl->PitchInBytes); -} - -static void -CTNAME(16SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("16SetupForSolidFill"); - ctBLTWAIT; - ctSETBGCOLOR16(color); - ctSETFGCOLOR16(color); - ctSETROP(ChipsAluConv2[rop & 0xF] | ctTOP2BOTTOM | ctLEFT2RIGHT | - ctPATSOLID | ctPATMONO); - ctSETPITCH(0, cAcl->PitchInBytes); -} - -#ifdef CHIPS_HIQV -static void -CTNAME(24SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("24SetupForSolidFill"); - ctBLTWAIT; - ctSETBGCOLOR24(color); - ctSETFGCOLOR24(color); - ctSETROP(ChipsAluConv2[rop & 0xF] | ctTOP2BOTTOM | ctLEFT2RIGHT | - ctPATSOLID | ctPATMONO); - ctSETPITCH(0, cAcl->PitchInBytes); -} - -static void -CTNAME(32SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("32SetupForSolidFill"); - ctBLTWAIT; - memset((unsigned char *)cPtr->FbBase + cAcl->ScratchAddress, 0xAA, 8); - ctSETFGCOLOR16((color & 0xFFFF)); - ctSETBGCOLOR16(((color >> 16) & 0xFFFF)); - ctSETROP(ChipsAluConv2[rop & 0xF] | ctTOP2BOTTOM | ctLEFT2RIGHT | - ctPATMONO); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctSETPITCH(1, cAcl->PitchInBytes); -} - -static void -CTNAME(32SubsequentSolidFillRect)(ScrnInfoPtr pScrn, int x, int y, int w, - int h) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - - unsigned int destaddr; - destaddr = (y * pScrn->displayWidth + x) << 2; - w <<= 2; - DEBUG_P("32SubsequentSolidFillRect"); - ctBLTWAIT; - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(h, w); -} -#else - -static void -CTNAME(24SetupForSolidFill)(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask) -{ - unsigned char pixel1, pixel2, pixel3; - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("24SetupForSolidFill"); - cAcl->rgb24equal = (((((color & 0xFF) == ((color & 0xFF00) >> 8)) && - ((color & 0xFF) == ((color & 0xFF0000) >> 16)))) || - /* Check the rop for paranoid reasons */ - (rop == GXclear) || (rop == GXnoop) || - (rop == GXinvert) || (rop == GXset)); - if (cAcl->rgb24equal) { - cAcl->CommandFlags = ChipsAluConv2[rop & 0xF] | ctTOP2BOTTOM | - ctLEFT2RIGHT | ctPATSOLID | ctPATMONO; - ctBLTWAIT; - ctSETFGCOLOR8(color&0xFF); - ctSETBGCOLOR8(color&0xFF); - ctSETPITCH(0, cAcl->PitchInBytes); - } else { - cAcl->rop24bpp = rop; - if (rop == GXcopy) { - pixel3 = color & 0xFF; - pixel2 = (color >> 8) & 0xFF; - pixel1 = (color >> 16) & 0xFF; - cAcl->fgpixel = pixel1; - cAcl->bgpixel = pixel2; - cAcl->fillindex = 0; - cAcl->fastfill = FALSE; - - /* Test for the special case where two of the byte of the - * 24bpp colour are the same. This can double the speed - */ - if (pixel1 == pixel2) { - cAcl->fgpixel = pixel3; - cAcl->bgpixel = pixel1; - cAcl->fastfill = TRUE; - cAcl->fillindex = 1; - } else if (pixel1 == pixel3) { - cAcl->fgpixel = pixel2; - cAcl->bgpixel = pixel1; - cAcl->fastfill = TRUE; - cAcl->fillindex = 2; - } else if (pixel2 == pixel3) { - cAcl->fastfill = TRUE; - } else { - cAcl->xorpixel = pixel2 ^ pixel3; - } - - cAcl->CommandFlags = ctSRCMONO | ctSRCSYSTEM | ctTOP2BOTTOM | - ctLEFT2RIGHT; - ctBLTWAIT; - if (cAcl->fastfill) { - ctSETFGCOLOR8(cAcl->fgpixel); - } - ctSETBGCOLOR8(cAcl->bgpixel); - ctSETSRCADDR(0); - ctSETPITCH(0, cAcl->PitchInBytes); - } else { - if (cAcl->color24bpp != color) { - cAcl->color24bpp = color; - cAcl->width24bpp = 0; - } - cAcl->rop24bpp = rop; - ctBLTWAIT; - ctSETROP(ctTOP2BOTTOM | ctLEFT2RIGHT | ChipsAluConv[rop & 0xF]); - ctSETPITCH(cAcl->PitchInBytes, cAcl->PitchInBytes); - } - } -} - -static void -CTNAME(24SubsequentSolidFillRect)(ScrnInfoPtr pScrn, int x, int y, int w, - int h) -{ - static unsigned int dwords[3] = { 0x24499224, 0x92244992, 0x49922449}; - int srcaddr, destaddr, line, i; - register int width; - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("24SubsequentSolidFillRect"); - if (cAcl->rgb24equal) { - destaddr = y * pScrn->displayWidth + x; - destaddr += destaddr << 1; - ctBLTWAIT; - ctSETROP(cAcl->CommandFlags); - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(h, (w + (w << 1))); - } else { - if (cAcl->rop24bpp == GXcopy ) { - unsigned int *base = (unsigned int *)cAcl->BltDataWindow; - destaddr = y * cAcl->PitchInBytes + x * 3; - w *= 3; - width = ((w + 31) & ~31) >> 5; - - ctBLTWAIT; - ctSETDSTADDR(destaddr); - - if (!cAcl->fastfill) ctSETFGCOLOR8(cAcl->fgpixel); - ctSETROP(cAcl->CommandFlags | ChipsAluConv[GXcopy & 0xF]); - ctSETDSTADDR(destaddr); - if (cAcl->fastfill) { - ctSETHEIGHTWIDTHGO(h, w); - line = 0; - while (line < h) { - base = (unsigned int *)cAcl->BltDataWindow; - for (i = 0; i < width; i++) { - *base++ = dwords[((cAcl->fillindex + i) % 3)]; - } - line++; - } - } else { - ctSETHEIGHTWIDTHGO(1, w); - i = 0; - while(i < width){ - *base++ = dwords[(i++ % 3)]; - } - for(line = 0; (h >> line ) > 1; line++){;} - i = 0; - ctBLTWAIT; - ctSETFGCOLOR8(cAcl->xorpixel); - ctSETROP(cAcl->CommandFlags | ChipsAluConv[GXxor & 0xF] | - ctBGTRANSPARENT); - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(1, w); - base = (unsigned int *)cAcl->BltDataWindow; - while(i < width) { - *base++ = dwords[((++i) % 3)]; - } - srcaddr = destaddr; - if(line){ - i = 0; - ctBLTWAIT; - ctSETROP(ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv[GXcopy & 0xF]); - ctSETPITCH(cAcl->PitchInBytes, cAcl->PitchInBytes); - ctSETSRCADDR(srcaddr); - - while(i < line){ - destaddr = srcaddr + (cAcl->PitchInBytes << i); - ctBLTWAIT; - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO((1 << i), w); - i++; - } - - if((1 << line) < h){ - destaddr = srcaddr + (cAcl->PitchInBytes << line); - ctBLTWAIT; - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(h-(1 << line), w); - } - - ctBLTWAIT; - ctSETROP(ctSRCMONO | ctSRCSYSTEM | ctTOP2BOTTOM | - ctLEFT2RIGHT | ChipsAluConv[GXcopy & 0xF]); - ctSETSRCADDR(0); - ctSETPITCH(0, cAcl->PitchInBytes); - } - } - } else { - register unsigned char *base; - if (cAcl->width24bpp < w) { - base = (unsigned char *)cPtr->FbBase + cAcl->ScratchAddress + - ((3 * cAcl->width24bpp + 3) & ~0x3); - width = w - cAcl->width24bpp; - ctBLTWAIT; - /* Load of a single scanline into framebuffer */ - while (width > 0) { - *(unsigned int *)base = cAcl->color24bpp | - (cAcl->color24bpp << 24); - *(unsigned int *)(base + 4) = (cAcl->color24bpp >> 8) | - (cAcl->color24bpp << 16); - *(unsigned int *)(base + 8) = (cAcl->color24bpp >> 16) | - (cAcl->color24bpp << 8); - base += 12; - width -= 4; - } - cAcl->width24bpp = w - width; - } - line = 0; - destaddr = 3 * (y * pScrn->displayWidth + x); - w *= cAcl->BytesPerPixel; - while (line < h) { - ctBLTWAIT; - ctSETSRCADDR(cAcl->ScratchAddress); - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(1, w); - destaddr += (3 * pScrn->displayWidth); - line++; - } - } - } -} -#endif - -static void -CTNAME(SubsequentSolidFillRect)(ScrnInfoPtr pScrn, int x, int y, int w, - int h) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - int destaddr; - - DEBUG_P("SubsequentSolidFillRect"); - destaddr = (y * pScrn->displayWidth + x) * cAcl->BytesPerPixel; -#ifdef CHIPS_HIQV - destaddr += cAcl->FbOffset; -#endif - w *= cAcl->BytesPerPixel; - ctBLTWAIT; - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(h, w); -} - -/* - * Screen-to-screen BitBLT. - * - */ - -static void -CTNAME(SetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, int trans) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("SetupForScreenToScreenCopy"); - cAcl->CommandFlags = 0; - - /* Set up the blit direction. */ - if (ydir < 0) - cAcl->CommandFlags |= ctBOTTOM2TOP; - else - cAcl->CommandFlags |= ctTOP2BOTTOM; - if (xdir < 0) - cAcl->CommandFlags |= ctRIGHT2LEFT; - else - cAcl->CommandFlags |= ctLEFT2RIGHT; -#ifdef CHIPS_HIQV - if (trans != -1) { - cAcl->CommandFlags |= ctCOLORTRANSENABLE | ctCOLORTRANSROP | - ctCOLORTRANSNEQUAL; - ctBLTWAIT; - /* BR03[0x27] sometimes set after reset, so must ensure it is zero */ - ctSETMONOCTL(ctDWORDALIGN); - switch (cAcl->BitsPerPixel) { - case 8: - ctSETBGCOLOR8(trans); - break; - case 16: - ctSETBGCOLOR16(trans); - break; - case 24: - ctSETBGCOLOR24(trans); - break; - } - } else -#endif - ctBLTWAIT; - switch (cAcl->BitsPerPixel) { -#if 0 - case 8: - if ((planemask & 0xFF) == 0xFF) { - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - } else { - ctSETROP(cAcl->CommandFlags | ChipsAluConv3[rop & 0xF]); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK8(planemask, cAcl->ScratchAddress); - } - break; - case 16: - if ((planemask & 0xFFFF) == 0xFFFF) { - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - } else { - ctSETROP(cAcl->CommandFlags | ChipsAluConv3[rop & 0xF]); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK16(planemask, cAcl->ScratchAddress); - } - break; -#endif - default: - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - break; - } - ctSETPITCH(cAcl->PitchInBytes, cAcl->PitchInBytes); -} - -static void -CTNAME(SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, int srcX, int srcY, - int dstX, int dstY, int w, int h) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - unsigned int srcaddr, destaddr; - - DEBUG_P("SubsequentScreenToScreenCopy"); -#ifdef CHIPS_HIQV - if (cAcl->CommandFlags & ctBOTTOM2TOP) { - srcaddr = (srcY + h - 1) * pScrn->displayWidth; - destaddr = (dstY + h - 1) * pScrn->displayWidth; - } else { - srcaddr = srcY * pScrn->displayWidth; - destaddr = dstY * pScrn->displayWidth; - } - if (cAcl->CommandFlags & ctRIGHT2LEFT) { - srcaddr = ( srcaddr + srcX + w ) * cAcl->BytesPerPixel - 1 ; - destaddr = ( destaddr + dstX + w ) * cAcl->BytesPerPixel - 1; - } else { - srcaddr = (srcaddr + srcX) * cAcl->BytesPerPixel; - destaddr = (destaddr + dstX) * cAcl->BytesPerPixel; - } - srcaddr += cAcl->FbOffset; - destaddr += cAcl->FbOffset; -#else - if (cAcl->CommandFlags & ctTOP2BOTTOM) { - srcaddr = srcY * pScrn->displayWidth; - destaddr = dstY * pScrn->displayWidth; - } else { - srcaddr = (srcY + h - 1) * pScrn->displayWidth; - destaddr = (dstY + h - 1) * pScrn->displayWidth; - } - if (cAcl->CommandFlags & ctLEFT2RIGHT) { - srcaddr = (srcaddr + srcX) * cAcl->BytesPerPixel; - destaddr = (destaddr + dstX) * cAcl->BytesPerPixel; - } else { - srcaddr = ( srcaddr + srcX + w ) * cAcl->BytesPerPixel - 1 ; - destaddr = ( destaddr + dstX + w ) * cAcl->BytesPerPixel - 1; - } -#endif - w *= cAcl->BytesPerPixel; - ctBLTWAIT; - ctSETSRCADDR(srcaddr); - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(h, w); -} - - -static void -CTNAME(SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("SetupForCPUToScreenColorExpandFill"); - - BE_SWAPOFF(pScrn,cPtr); - - ctBLTWAIT; - cAcl->CommandFlags = 0; - if (bg == -1) { - cAcl->CommandFlags |= ctBGTRANSPARENT; /* Background = Destination */ - switch (cAcl->BitsPerPixel) { - case 8: - ctSETFGCOLOR8(fg); - break; - case 16: - ctSETFGCOLOR16(fg); - break; - case 24: -#ifdef CHIPS_HIQV - ctSETFGCOLOR24(fg); -#else - ctSETFGCOLOR8(fg); -#endif - break; - } - } - else { - switch (cAcl->BitsPerPixel) { - case 8: - ctSETBGCOLOR8(bg); - ctSETFGCOLOR8(fg); - break; - case 16: - ctSETBGCOLOR16(bg); - ctSETFGCOLOR16(fg); - break; - case 24: -#ifdef CHIPS_HIQV - ctSETBGCOLOR24(bg); - ctSETFGCOLOR24(fg); -#else - ctSETBGCOLOR8(bg); - ctSETFGCOLOR8(fg); -#endif - break; - } - } - -#ifdef CHIPS_HIQV - ctSETMONOCTL(ctDWORDALIGN); -#endif - - ctSETSRCADDR(0); - - switch (cAcl->BitsPerPixel) { - case 8: - if ((planemask & 0xFF) == 0xFF) { - ctSETROP(ctSRCSYSTEM | ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv[rop & 0xF] | cAcl->CommandFlags); - } else { - ctSETROP(ctSRCSYSTEM | ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv3[rop & 0xF] | cAcl->CommandFlags); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK8(planemask, cAcl->ScratchAddress); - } - break; - case 16: - if ((planemask & 0xFFFF) == 0xFFFF) { - ctSETROP(ctSRCSYSTEM | ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv[rop & 0xF] | cAcl->CommandFlags); - } else { - ctSETROP(ctSRCSYSTEM | ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv3[rop & 0xF] | cAcl->CommandFlags); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK16(planemask, cAcl->ScratchAddress); - } - break; - default: - ctSETROP(ctSRCSYSTEM | ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv[rop & 0xF] | cAcl->CommandFlags); - break; - } - ctSETPITCH(0, cAcl->PitchInBytes); -} - -static void -CTNAME(SubsequentCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - int destaddr; - - DEBUG_P("SubsequentCPUToScreenColorExpandFill"); - destaddr = (y * pScrn->displayWidth + x + skipleft) * - cAcl->BytesPerPixel; -#ifdef CHIPS_HIQV - destaddr += cAcl->FbOffset; -#endif - w = (w - skipleft) * cAcl->BytesPerPixel; - ctBLTWAIT; - ctSETDSTADDR(destaddr); -#ifdef CHIPS_HIQV - ctSETMONOCTL(ctDWORDALIGN | ctCLIPLEFT(skipleft)); -#endif - ctSETHEIGHTWIDTHGO(h, w); -} - -#if !defined(CHIPS_HIQV) || defined(UNDOCUMENTED_FEATURE) -static void -CTNAME(SetupForScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("SetupForScreenToScreenColorExpandFill"); - cAcl->CommandFlags = 0; - ctBLTWAIT; - if (bg == -1) { - cAcl->CommandFlags |= ctBGTRANSPARENT; /* Background = Destination */ - switch (cAcl->BitsPerPixel) { - case 8: - ctSETFGCOLOR8(fg); - break; - case 16: - ctSETFGCOLOR16(fg); - break; - case 24: -#ifdef CHIPS_HIQV - ctSETFGCOLOR24(fg); -#else - ctSETFGCOLOR8(fg); -#endif - break; - } - } - else { - switch (cAcl->BitsPerPixel) { - case 8: - ctSETBGCOLOR8(bg); - ctSETFGCOLOR8(fg); - break; - case 16: - ctSETBGCOLOR16(bg); - ctSETFGCOLOR16(fg); - break; - case 24: -#ifdef CHIPS_HIQV - ctSETBGCOLOR24(bg); - ctSETFGCOLOR24(fg); -#else - ctSETBGCOLOR8(bg); - ctSETFGCOLOR8(fg); -#endif - break; - } - } - - switch (cAcl->BitsPerPixel) { - case 8: - if ((planemask & 0xFF) == 0xFF) { - ctSETROP(ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv[rop & 0xF] | cAcl->CommandFlags); - } else { - ctSETROP(ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv3[rop & 0xF] | cAcl->CommandFlags); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK8(planemask, cAcl->ScratchAddress); - } - break; - case 16: - if ((planemask & 0xFFFF) == 0xFFFF) { - ctSETROP(ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv[rop & 0xF] | cAcl->CommandFlags); - } else { - ctSETROP(ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv3[rop & 0xF] | cAcl->CommandFlags); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK16(planemask, cAcl->ScratchAddress); - } - break; - default: - ctSETROP(ctSRCMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv[rop & 0xF] | cAcl->CommandFlags); - break; - } - ctSETPITCH(cAcl->PitchInBytes, cAcl->PitchInBytes); -} -#endif -#ifndef CHIPS_HIQV -/* - * The non-HiQV chips don't have left-edge clippling of monochrome sources. - * However you can have the monochrome source starting on a byte boundary. - * Hence have 8 rotated copies of the monochrome source to simulate left - * edge clipping with these chips. This requires the XAACacheMonoStipple - * function to be replaced, if we are to use ScreenToScreenColorExpand. - */ - -static XAACacheInfoPtr -CTNAME(CacheMonoStipple)(ScrnInfoPtr pScrn, PixmapPtr pPix) -{ - int w = pPix->drawable.width; - int h = pPix->drawable.height; - XAAInfoRecPtr infoRec = (CHIPSPTR(pScrn))->AccelInfoRec; - XAAPixmapCachePrivatePtr pCachePriv = - (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate; - XAACacheInfoPtr pCache, cacheRoot = NULL; - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - int i, j, max = 0, funcNo, pad, dwords, bpp = cAcl->BitsPerPixel; - int *current; - StippleScanlineProcPtr StippleFunc; - static StippleScanlineProcPtr *StippleTab = NULL; - unsigned char *data, *srcPtr, *dstPtr; - - if (!StippleTab) - StippleTab = XAAGetStippleScanlineFuncMSBFirst(); - - DEBUG_P("CacheMonoStipple"); - if((h <= 128) && (w <= 128 * bpp / 8)) { - if(pCachePriv->Info128) { - cacheRoot = pCachePriv->Info128; - max = pCachePriv->Num128x128; - current = &pCachePriv->Current128; - } else { - cacheRoot = pCachePriv->InfoPartial; - max = pCachePriv->NumPartial; - current = &pCachePriv->CurrentPartial; - } - } else if((h <= 256) && (w <= 256 * bpp / 8)){ - cacheRoot = pCachePriv->Info256; - max = pCachePriv->Num256x256; - current = &pCachePriv->Current256; - } else if((h <= 512) && (w <= 512 * bpp / 8)){ - cacheRoot = pCachePriv->Info512; - max = pCachePriv->Num512x512; - current = &pCachePriv->Current512; - } else { /* something's wrong */ - ErrorF("Something's wrong in XAACacheMonoStipple()\n"); - return pCachePriv->Info128; - } - - pCache = cacheRoot; - - /* lets look for it */ - for(i = 0; i < max; i++, pCache++) { - if((pCache->serialNumber == pPix->drawable.serialNumber) && - (pCache->fg == -1) && (pCache->bg == -1)) { - pCache->trans_color = -1; - dwords = - cAcl->SlotWidth = ((pCache->w * bpp) >> 5) >> 1; - return pCache; - } - } - - pCache = &cacheRoot[(*current)++]; - if(*current >= max) *current = 0; - - pCache->serialNumber = pPix->drawable.serialNumber; - pCache->trans_color = pCache->bg = pCache->fg = -1; - pCache->orig_w = w; pCache->orig_h = h; - - if(w <= 32) { - if(w & (w - 1)) funcNo = 1; - else funcNo = 0; - } else funcNo = 2; - - pad = (((pCache->w * bpp) + 31) >> 5) << 2; - dstPtr = data = malloc(pad * pCache->h); - srcPtr = (unsigned char*)pPix->devPrivate.ptr; - StippleFunc = StippleTab[funcNo]; - - dwords = ((pCache->w * bpp) >> 5) >> 3; - cAcl->SlotWidth = dwords << 2; - - for(i = 0; i < h; i++) { - for(j = 0; j < 8; j++) { - (*StippleFunc)((CARD32*)dstPtr + j * dwords, - (CARD32*)srcPtr, j, w, dwords); - } - srcPtr += pPix->devKind; - dstPtr += pad; - } - - while((h<<1) <= pCache->h) { - memcpy(data + (pad * h), data, pad * h); - h <<= 1; - } - - if(h < pCache->h) - memcpy(data + (pad * h), data, pad * (pCache->h - h)); - - (*infoRec->WritePixmapToCache)( - pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data, - pad, bpp, pScrn->depth); - - free(data); - - return pCache; -} -#endif -#if !defined(CHIPS_HIQV) || defined(UNDOCUMENTED_FEATURE) -static void -CTNAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - int srcaddr, destaddr; - - DEBUG_P("SubsequentScreenToScreenColorExpandFill"); -#ifdef CHIPS_HIQV - srcaddr = (srcy * pScrn->displayWidth + srcx) * cAcl->BytesPerPixel - + ((skipleft & ~0x3F) >> 3); - if ( y < pScrn->virtualY) - srcaddr += cAcl->FbOffset; - else - srcaddr += cPtr->FbOffset16; -#else - srcaddr = (srcy * pScrn->displayWidth + srcx) * cAcl->BytesPerPixel - + ((skipleft & 0x07) * cAcl->SlotWidth) - + ((skipleft & ~0x07) >> 3); -#endif - destaddr = (y * pScrn->displayWidth + x) * cAcl->BytesPerPixel; -#ifdef CHIPS_HIQV - destaddr += cAcl->FbOffset; -#endif - w *= cAcl->BytesPerPixel; - ctBLTWAIT; - ctSETSRCADDR(srcaddr); - ctSETDSTADDR(destaddr); -#ifdef CHIPS_HIQV - ctSETMONOCTL(ctCLIPLEFT(skipleft & 0x3F)); -#endif - ctSETHEIGHTWIDTHGO(h, w); -} -#endif -static void -CTNAME(SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty, - int rop, unsigned int planemask, - int trans) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - unsigned int patternaddr; - - DEBUG_P("SetupForColor8x8PatternFill"); - cAcl->CommandFlags = ChipsAluConv2[rop & 0xF] | ctTOP2BOTTOM | - ctLEFT2RIGHT; - patternaddr = (paty * pScrn->displayWidth + - (patx & ~0x3F)) * cAcl->BytesPerPixel; - cAcl->patternyrot = (patx & 0x3F) >> 3; - - ctBLTWAIT; - ctSETPATSRCADDR(patternaddr); -#ifdef CHIPS_HIQV - if (trans != -1) { - cAcl->CommandFlags |= ctCOLORTRANSENABLE | ctCOLORTRANSROP | - ctCOLORTRANSNEQUAL; - ctSETMONOCTL(ctDWORDALIGN); - switch (cAcl->BitsPerPixel) { - case 8: - ctSETBGCOLOR8(trans); - break; - case 16: - ctSETBGCOLOR16(trans); - break; - case 24: - ctSETBGCOLOR24(trans); - break; - } - } else -#endif - ctSETPITCH(8 * cAcl->BytesPerPixel, cAcl->PitchInBytes); -} - -static void -CTNAME(SubsequentColor8x8PatternFillRect)(ScrnInfoPtr pScrn, int patx, int paty, - int x, int y, int w, int h) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - unsigned int destaddr; - - DEBUG_P("SubsequentColor8x8PatternFillRect"); - destaddr = (y * pScrn->displayWidth + x) * cAcl->BytesPerPixel; -#ifdef CHIPS_HIQV - destaddr += cAcl->FbOffset; -#endif - w *= cAcl->BytesPerPixel; - ctBLTWAIT; - ctSETDSTADDR(destaddr); -#ifdef CHIPS_HIQV - ctSETROP(cAcl->CommandFlags | (((y + cAcl->patternyrot) & 0x7) << 20)); -#else - ctSETROP(cAcl->CommandFlags | (((y + cAcl->patternyrot) & 0x7) << 16)); -#endif - ctSETHEIGHTWIDTHGO(h, w); -} - -static void -CTNAME(SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty, - int fg, int bg, int rop, - unsigned int planemask) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - unsigned int patternaddr; - - DEBUG_P("SetupForMono8x8PatternFill"); - cAcl->CommandFlags = ctPATMONO | ctTOP2BOTTOM | ctLEFT2RIGHT | - ChipsAluConv2[rop & 0xF]; - -#ifdef CHIPS_HIQV - patternaddr = paty * pScrn->displayWidth + patx; - patternaddr *= cAcl->BytesPerPixel; -#else - patternaddr = (paty * pScrn->displayWidth + patx) * cAcl->BytesPerPixel; -#endif - ctBLTWAIT; - ctSETPATSRCADDR(patternaddr); - if (bg == -1) { - cAcl->CommandFlags |= ctBGTRANSPARENT; /* Background = Destination */ - switch (cAcl->BitsPerPixel) { - case 8: - ctSETFGCOLOR8(fg); - break; - case 16: - ctSETFGCOLOR16(fg); - break; - case 24: - ctSETFGCOLOR24(fg); - break; - } - } - else { - switch (cAcl->BitsPerPixel) { - case 8: - ctSETBGCOLOR8(bg); - ctSETFGCOLOR8(fg); - break; - case 16: - ctSETBGCOLOR16(bg); - ctSETFGCOLOR16(fg); - break; - case 24: - ctSETBGCOLOR24(bg); - ctSETFGCOLOR24(fg); - break; - } - } -#ifdef CHIPS_HIQV - ctSETMONOCTL(ctDWORDALIGN); -#endif - ctSETPITCH(1,cAcl->PitchInBytes); -} - -static void -CTNAME(SubsequentMono8x8PatternFillRect)(ScrnInfoPtr pScrn, int patx, - int paty, int x, int y, int w, int h ) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - int destaddr; - DEBUG_P("SubsequentMono8x8PatternFillRect"); - destaddr = (y * pScrn->displayWidth + x) * cAcl->BytesPerPixel; -#ifdef CHIPS_HIQV - destaddr += cAcl->FbOffset; -#endif - w *= cAcl->BytesPerPixel; - - ctBLTWAIT; - ctSETDSTADDR(destaddr); -#ifdef CHIPS_HIQV - ctSETROP(cAcl->CommandFlags | ((y & 0x7) << 20)); -#else - ctSETROP(cAcl->CommandFlags | ((y & 0x7) << 16)); -#endif - ctSETHEIGHTWIDTHGO(h, w); -} - -#ifndef CHIPS_HIQV -static void -CTNAME(SetupForImageWrite)(ScrnInfoPtr pScrn, int rop, unsigned int planemask, - int transparency_color, int bpp, int depth) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - - DEBUG_P("SetupForImageWrite"); - cAcl->CommandFlags = ctSRCSYSTEM | ctTOP2BOTTOM | ctLEFT2RIGHT; - ctBLTWAIT; - - switch (cAcl->BitsPerPixel) { - case 8: - if ((planemask & 0xFF) == 0xFF) { - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - } else { - ctSETROP(cAcl->CommandFlags | ChipsAluConv3[rop & 0xF]); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK8(planemask, cAcl->ScratchAddress); - } - break; - case 16: - if ((planemask & 0xFFFF) == 0xFFFF) { - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - } else { - ctSETROP(cAcl->CommandFlags | ChipsAluConv3[rop & 0xF]); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK16(planemask, cAcl->ScratchAddress); - } - break; - default: - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - break; - } - ctSETSRCADDR(0); -} - -static void -CTNAME(SubsequentImageWriteRect)(ScrnInfoPtr pScrn, int x, int y, int w, int h, - int skipleft) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - int destaddr = (y * pScrn->displayWidth + x) * cAcl->BytesPerPixel; - DEBUG_P("SubsequentImageWriteRect"); - w *= cAcl->BytesPerPixel; - ctBLTWAIT; - ctSETPITCH(((w + 3) & ~0x3), cAcl->PitchInBytes); - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(h, w); -} - -#else -/* - * Copyright 1997 - * Digital Equipment Corporation. All rights reserved. - * This software is furnished under license and may be used and copied only in - * accordance with the following terms and conditions. Subject to these - * conditions, you may download, copy, install, use, modify and distribute - * this software in source and/or binary form. No title or ownership is - * transferred hereby. - * 1) Any source code used, modified or distributed must reproduce and retain - * this copyright notice and list of conditions as they appear in the - * source file. - * - * 2) No right is granted to use any trade name, trademark, or logo of Digital - * Equipment Corporation. Neither the "Digital Equipment Corporation" name - * nor any trademark or logo of Digital Equipment Corporation may be used - * to endorse or promote products derived from this software without the - * prior written permission of Digital Equipment Corporation. - * - * 3) This software is provided "AS-IS" and any express or implied warranties, - * including but not limited to, any implied warranties of merchantability, - * fitness for a particular purpose, or non-infringement are disclaimed. In - * no event shall DIGITAL be liable for any damages whatsoever, and in - * particular, DIGITAL shall not be liable for special, indirect, - * consequential, or incidental damages or damages for lost profits, loss - * of revenue or loss of use, whether such damages arise in contract, - * negligence, tort, under statute, in equity, at law or otherwise, even if - * advised of the possibility of such damage. - */ - -/* The code below comes from the idea supplied by the people at DEC, like - * the copyright above says. But its had to go through a large evolution - * to fit it into the new design for XFree86 4.0 - */ - -static void -MoveDWORDS(register CARD32* dest, register CARD32* src, register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - switch(dwords){ - case 1: - *dest = *src; - break; - case 2: - *dest = *src; - *(dest + 1) = *(src + 1); - break; - case 3: - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - break; - } -} - -static __inline__ void -MoveDataFromCPU(unsigned char *src, unsigned char *dest, int srcwidth, - int window, int h, int dwords) -{ - if(srcwidth == (dwords << 2)) { - int decrement = window / dwords; - while(h > decrement) { - MoveDWORDS((CARD32*)dest, (CARD32*)src, dwords * decrement); - src += (srcwidth * decrement); - h -= decrement; - } - if(h) { - MoveDWORDS((CARD32*)dest, (CARD32*)src, dwords * h); - } - } else { - while(h--) { - MoveDWORDS((CARD32*)dest, (CARD32*)src, dwords); - src += srcwidth; - } - } -} - -static __inline__ void -MoveDataToCPU(unsigned char *src, unsigned char *dest, int dstwidth, - int window, int h, int dwords) -{ - if(dstwidth == (dwords << 2)) { - int decrement = window / dwords; - while(h > decrement) { - MoveDWORDS((CARD32*)dest, (CARD32*)src, dwords * decrement); - dest += (dstwidth * decrement); - h -= decrement; - } - if(h) { - MoveDWORDS((CARD32*)dest, (CARD32*)src, dwords * h); - } - } else { - while(h--) { - MoveDWORDS((CARD32*)dest, (CARD32*)src, dwords); - dest += dstwidth; - } - } -} - -static void -CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int rop, - unsigned int planemask, int trans, int bpp, int depth) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - unsigned int bytesPerLine; - unsigned int byteWidthSrc; - unsigned int destpitch; - int dwords; - int skipleft; - int destaddr; - - DEBUG_P("WritePixmap"); -#ifdef DEBUG - ErrorF("WritePixmap x %d, y %d, w %d, h %d, src 0x%X, srcwidth %d, rop 0x%X, planemask 0x%X, trans 0x%X, bpp %d, depth %d\n", x, y, w, h, src, srcwidth, rop, planemask, trans, bpp, depth); -#endif - bytesPerLine = w * (bpp >> 3); - byteWidthSrc = ((srcwidth * (bpp >> 3) + 3L) & ~0x3L); - cAcl->CommandFlags = ctSRCSYSTEM | ctLEFT2RIGHT | ctTOP2BOTTOM; - skipleft = (unsigned long)src & 0x7; - src = (unsigned char *)((unsigned long)src & ~0x7L); - dwords = (((skipleft + bytesPerLine + 0x7) & ~0x7)) >> 2; - destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3); - destpitch = pScrn->displayWidth * (bpp >> 3); - destaddr += cAcl->FbOffset; - - ctBLTWAIT; - - if (trans != -1) { - cAcl->CommandFlags |= ctCOLORTRANSENABLE | ctCOLORTRANSROP | - ctCOLORTRANSNEQUAL; - ctSETMONOCTL(ctDWORDALIGN); - switch (cAcl->BitsPerPixel) { - case 8: - ctSETBGCOLOR8(trans); - break; - case 16: - ctSETBGCOLOR16(trans); - break; - case 24: - ctSETBGCOLOR24(trans); - break; - } - } - - switch (cAcl->BitsPerPixel) { - case 8: - if ((planemask & 0xFF) == 0xFF) { - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - } else { - ctSETROP(cAcl->CommandFlags | ChipsAluConv3[rop & 0xF]); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK8(planemask, cAcl->ScratchAddress); - } - break; - case 16: - if ((planemask & 0xFFFF) == 0xFFFF) { - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - } else { - ctSETROP(cAcl->CommandFlags | ChipsAluConv3[rop & 0xF]); - ctSETPATSRCADDR(cAcl->ScratchAddress); - ctWRITEPLANEMASK16(planemask, cAcl->ScratchAddress); - } - break; - default: - ctSETROP(cAcl->CommandFlags | ChipsAluConv[rop & 0xF]); - break; - } - - /* - * - * CT6555X requires quad-word padding, but XAA provides double-word - * padding. If the width of a region to be transferred happens to be - * quad-word aligned, the transfer is straightforward. If the - * region is double-word aligned, a pair of contiguous scanlines - * is quad-word aligned. In latter case, we can use interleaved - * transfer twice. It is faster than transfer line by line. - * - */ - - ctSETSRCADDR(skipleft); - ctSETDSTADDR(destaddr); - - if ((byteWidthSrc & 0x7) == 0) { /* quad-word aligned */ - - ctSETPITCH(byteWidthSrc, destpitch); - ctSETHEIGHTWIDTHGO(h, bytesPerLine); - - MoveDataFromCPU((unsigned char *)src, - (unsigned char *)cAcl->BltDataWindow, - srcwidth, 16384, h, dwords); - - } else { - unsigned int vert = h; - - h = (vert + 1) >> 1; - - ctSETPITCH(byteWidthSrc << 1, destpitch << 1); - ctSETHEIGHTWIDTHGO(h, bytesPerLine); - - MoveDataFromCPU((unsigned char *)src, - (unsigned char *)cAcl->BltDataWindow, - srcwidth<<1, 16384, h, dwords); - - h = vert >> 1; - src += srcwidth; - y++; - - destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3); - destaddr += cAcl->FbOffset; - - ctBLTWAIT; - ctSETDSTADDR(destaddr); - ctSETHEIGHTWIDTHGO(h, bytesPerLine); - - MoveDataFromCPU((unsigned char *)src, - (unsigned char *)cAcl->BltDataWindow, - srcwidth<<1, 16384, h, dwords); - } - - cPtr->AccelInfoRec->NeedToSync = TRUE; -} - -#if 0 -static void -CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *dst, int dstwidth, int bpp, int depth) -{ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); - unsigned int bytesPerLine; - unsigned int byteWidthDst; - unsigned int srcpitch; - int dwords; - int srcaddr; - - DEBUG_P("ReadPixmap"); - bytesPerLine = w * (bpp >> 3); - byteWidthDst = ((dstwidth * (bpp >> 3) + 3L) & ~0x3L); - dwords = (((bytesPerLine + 0x7) & ~0x7)) >> 2; - srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3); - srcpitch = pScrn->displayWidth * (bpp >> 3); - srcaddr += cAcl->FbOffset; - - ctBLTWAIT; - ctSETROP( ctDSTSYSTEM | ctLEFT2RIGHT | ctTOP2BOTTOM | - ChipsAluConv[GXcopy & 0xF]); - ctSETDSTADDR(0); - ctSETSRCADDR(srcaddr); - - if ((byteWidthDst & 0x7) == 0) { /* quad-word aligned */ - - ctSETPITCH(srcpitch, byteWidthDst); - ctSETHEIGHTWIDTHGO(h, bytesPerLine); - - BE_SWAPOFF(pScrn,cPtr); - MoveDataToCPU((unsigned char *)cAcl->BltDataWindow, - (unsigned char *)dst, dstwidth, 16384, h, dwords); - BE_SWAPON(pScrn,cPtr); - - } else { - unsigned int vert = h; - - h = (vert + 1) >> 1; - - ctSETPITCH(srcpitch << 1, byteWidthDst << 1); - ctSETHEIGHTWIDTHGO(h, bytesPerLine); - - BE_SWAPOFF(pScrn,cPtr); - MoveDataToCPU((unsigned char *)cAcl->BltDataWindow, - (unsigned char *)dst, dstwidth<<1, 16384, h, dwords); - BE_SWAPON(pScrn,cPtr); - - h = vert >> 1; - dst += dstwidth; - y++; - srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3); - srcaddr += cAcl->FbOffset; - ctBLTWAIT; - ctSETSRCADDR(srcaddr); - ctSETHEIGHTWIDTHGO(h, bytesPerLine); - - BE_SWAPFF(pScrn,cPtr); - MoveDataToCPU((unsigned char *)cAcl->BltDataWindow, - (unsigned char *)dst, dstwidth<<1, 16384, h, dwords); - BE_SWAPON(pScrn,cPtr); - } - - cPtr->AccelInfoRec->NeedToSync = TRUE; -} -#endif /* ReadPixmap */ - -#endif - -#endif diff --git a/src/ct_cursor.c b/src/ct_cursor.c index 03dfb69..3598bd2 100644 --- a/src/ct_cursor.c +++ b/src/ct_cursor.c @@ -45,20 +45,7 @@ #include "ct_driver.h" /* Sync function, maybe this should check infoRec->NeedToSync before syncing */ -#ifdef HAVE_XAA_H -#define CURSOR_SYNC(pScrn) \ - if (IS_HiQV(cPtr)) { \ - CHIPSHiQVSync(pScrn); \ - } else { \ - if(!cPtr->UseMMIO) { \ - CHIPSSync(pScrn); \ - } else { \ - CHIPSMMIOSync(pScrn); \ - } \ - } -#else #define CURSOR_SYNC(pScrn) -#endif /* Swing your cursor bytes round and round... yeehaw! */ #if X_BYTE_ORDER == X_BIG_ENDIAN diff --git a/src/ct_dga.c b/src/ct_dga.c index 1e1d7b8..af0c1c2 100644 --- a/src/ct_dga.c +++ b/src/ct_dga.c @@ -15,14 +15,6 @@ static Bool CHIPS_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, static Bool CHIPS_SetMode(ScrnInfoPtr, DGAModePtr); static int CHIPS_GetViewport(ScrnInfoPtr); static void CHIPS_SetViewport(ScrnInfoPtr, int, int, int); -#ifdef HAVE_XAA_H -static void CHIPS_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); -static void CHIPS_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 -static void CHIPS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -#endif -#endif static DGAFunctionRec CHIPS_DGAFuncs = { @@ -31,18 +23,7 @@ DGAFunctionRec CHIPS_DGAFuncs = { CHIPS_SetMode, CHIPS_SetViewport, CHIPS_GetViewport, -#ifdef HAVE_XAA_H - CHIPSSync, - CHIPS_FillRect, - CHIPS_BlitRect, -#if 0 - CHIPS_BlitTransRect -#else - NULL -#endif -#else NULL, NULL, NULL, NULL -#endif }; static @@ -52,18 +33,7 @@ DGAFunctionRec CHIPS_MMIODGAFuncs = { CHIPS_SetMode, CHIPS_SetViewport, CHIPS_GetViewport, -#ifdef HAVE_XAA_H - CHIPSMMIOSync, - CHIPS_FillRect, - CHIPS_BlitRect, -#if 0 - CHIPS_BlitTransRect -#else - NULL -#endif -#else NULL, NULL, NULL, NULL -#endif }; static @@ -73,18 +43,7 @@ DGAFunctionRec CHIPS_HiQVDGAFuncs = { CHIPS_SetMode, CHIPS_SetViewport, CHIPS_GetViewport, -#ifdef HAVE_XAA_H - CHIPSHiQVSync, - CHIPS_FillRect, - CHIPS_BlitRect, -#if 0 - CHIPS_BlitTransRect -#else - NULL -#endif -#else NULL, NULL, NULL, NULL -#endif }; @@ -126,11 +85,6 @@ SECOND_PASS: currentMode->mode = pMode; currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; -#ifdef HAVE_XAA_H - if(cPtr->Flags & ChipsAccelSupport) - currentMode->flags |= (cPtr->Flags & ChipsAccelSupport) - ? (DGA_FILL_RECT | DGA_BLIT_RECT) : 0; -#endif if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) @@ -260,57 +214,6 @@ CHIPS_SetViewport( cPtr->DGAViewportStatus = 0; /* CHIPSAdjustFrame loops until finished */ } -#ifdef HAVE_XAA_H -static void -CHIPS_FillRect ( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned long color -){ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - - if(cPtr->AccelInfoRec) { - (*cPtr->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*cPtr->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(cPtr->AccelInfoRec); - } -} - -static void -CHIPS_BlitRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty -){ - CHIPSPtr cPtr = CHIPSPTR(pScrn); - - if(cPtr->AccelInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*cPtr->AccelInfoRec->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, ~0, -1); - (*cPtr->AccelInfoRec->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(cPtr->AccelInfoRec); - } -} - -#if 0 -static void -CHIPS_BlitTransRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty, - unsigned long color -){ - /* this one should be separate since the XAA function would - prohibit usage of ~0 as the key */ -} -#endif -#endif static Bool CHIPS_OpenFramebuffer( ScrnInfoPtr pScrn, diff --git a/src/ct_driver.c b/src/ct_driver.c index 0ea8128..8421950 100644 --- a/src/ct_driver.c +++ b/src/ct_driver.c @@ -168,9 +168,6 @@ static ModeStatus CHIPSValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, static Bool CHIPSSaveScreen(ScreenPtr pScreen, int mode); /* Internally used functions */ -#ifdef HAVE_ISA -static int chipsFindIsaDevice(GDevPtr dev); -#endif static Bool chipsClockSelect(ScrnInfoPtr pScrn, int no); Bool chipsModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void chipsSave(ScrnInfoPtr pScrn, vgaRegPtr VgaSave, @@ -583,27 +580,6 @@ static PciChipsets CHIPSPCIchipsets[] = { { -1, -1, RES_UNDEFINED} }; -#ifdef HAVE_ISA -static IsaChipsets CHIPSISAchipsets[] = { - { CHIPS_CT65520, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65525, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65530, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65535, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65540, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65545, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65546, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65548, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65550, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65554, RES_EXCLUSIVE_VGA }, - { CHIPS_CT65555, RES_EXCLUSIVE_VGA }, - { CHIPS_CT68554, RES_EXCLUSIVE_VGA }, - { CHIPS_CT69000, RES_EXCLUSIVE_VGA }, - { CHIPS_CT69030, RES_EXCLUSIVE_VGA }, - { CHIPS_CT64200, RES_EXCLUSIVE_VGA }, - { CHIPS_CT64300, RES_EXCLUSIVE_VGA }, - { -1, RES_UNDEFINED } -}; -#endif /* The options supported by the Chips and Technologies Driver */ typedef enum { @@ -812,12 +788,6 @@ CHIPSAvailableOptions(int chipid, int busid) { int chip = chipid & 0x0000ffff; -#ifdef HAVE_ISA - if (busid == BUS_ISA) { - if ((chip == CHIPS_CT64200) || (chip == CHIPS_CT64300)) - return ChipsWingineOptions; - } -#endif if (busid == BUS_PCI) { if ((chip >= CHIPS_CT65550) && (chip <= CHIPS_CT69030)) return ChipsHiQVOptions; @@ -977,129 +947,12 @@ CHIPSProbe(DriverPtr drv, int flags) } } -#ifdef HAVE_ISA - /* Isa Bus */ - numUsed = xf86MatchIsaInstances(CHIPS_NAME,CHIPSChipsets,CHIPSISAchipsets, - drv,chipsFindIsaDevice,devSections, - numDevSections,&usedChips); - if (numUsed > 0) { - if (flags & PROBE_DETECT) - foundScreen = TRUE; - else for (i = 0; i < numUsed; i++) { - ScrnInfoPtr pScrn = NULL; - if ((pScrn = xf86ConfigIsaEntity(pScrn,0, - usedChips[i], - CHIPSISAchipsets,NULL, - NULL,NULL,NULL,NULL))) { - pScrn->driverVersion = CHIPS_VERSION; - pScrn->driverName = CHIPS_DRIVER_NAME; - pScrn->name = CHIPS_NAME; - pScrn->Probe = CHIPSProbe; - pScrn->PreInit = CHIPSPreInit; - pScrn->ScreenInit = CHIPSScreenInit; - pScrn->SwitchMode = CHIPSSwitchMode; - pScrn->AdjustFrame = CHIPSAdjustFrame; - pScrn->EnterVT = CHIPSEnterVT; - pScrn->LeaveVT = CHIPSLeaveVT; - pScrn->FreeScreen = CHIPSFreeScreen; - pScrn->ValidMode = CHIPSValidMode; - foundScreen = TRUE; - } - free(usedChips); - } - } -#endif free(devSections); return foundScreen; } #endif -#ifdef HAVE_ISA -static int -chipsFindIsaDevice(GDevPtr dev) -{ - int found = -1; - unsigned char tmp; - - /* - * This function has the only direct register access in the C&T driver. - * All other register access through functions to allow for full MMIO. - */ - outb(0x3D6, 0x00); - tmp = inb(0x3D7); - - switch (tmp & 0xF0) { - case 0x70: /* CT65520 */ - found = CHIPS_CT65520; break; - case 0x80: /* CT65525 or CT65530 */ - found = CHIPS_CT65530; break; - case 0xA0: /* CT64200 */ - found = CHIPS_CT64200; break; - case 0xB0: /* CT64300 */ - found = CHIPS_CT64300; break; - case 0xC0: /* CT65535 */ - found = CHIPS_CT65535; break; - default: - switch (tmp & 0xF8) { - case 0xD0: /* CT65540 */ - found = CHIPS_CT65540; break; - case 0xD8: /* CT65545 or CT65546 or CT65548 */ - switch (tmp & 7) { - case 3: - found = CHIPS_CT65546; break; - case 4: - found = CHIPS_CT65548; break; - default: - found = CHIPS_CT65545; break; - - } - break; - default: - if (tmp == 0x2C) { - outb(0x3D6, 0x01); - tmp = inb(0x3D7); - if (tmp != 0x10) break; - outb(0x3D6, 0x02); - tmp = inb(0x3D7); - switch (tmp) { - case 0xE0: /* CT65550 */ - found = CHIPS_CT65550; break; - case 0xE4: /* CT65554 */ - found = CHIPS_CT65554; break; - case 0xE5: /* CT65555 */ - found = CHIPS_CT65555; break; - case 0xF4: /* CT68554 */ - found = CHIPS_CT68554; break; - case 0xC0: /* CT69000 */ - found = CHIPS_CT69000; break; - case 0x30: /* CT69030 */ - outb(0x3D6, 0x03); - tmp = inb(0x3D7); - if (tmp == 0xC) - found = CHIPS_CT69030; - break; - default: - break; - } - } - break; - } - break; - } - /* We only want ISA/VL Bus - so check for PCI Bus */ - if(found > CHIPS_CT65548) { - outb(0x3D6, 0x08); - tmp = inb(0x3D7); - if(tmp & 0x01) found = -1; - } else if(found > CHIPS_CT65535) { - outb(0x3D6, 0x01); - tmp = inb(0x3D7); - if ((tmp & 0x07) == 0x06) found = -1; - } - return found; -} -#endif /* Mandatory */ Bool @@ -1367,21 +1220,11 @@ CHIPSPreInit(ScrnInfoPtr pScrn, int flags) break; } -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) { - if (!xf86LoadSubModule(pScrn, "xaa")) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Falling back to shadowfb\n"); - cPtr->Flags &= ~(ChipsAccelSupport); - cPtr->Flags |= ChipsShadowFB; - } - } -#else if (!xf86LoadSubModule(pScrn, "exa")) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Falling back to shadowfb\n"); cPtr->Flags &= ~(ChipsAccelSupport); cPtr->Flags |= ChipsShadowFB; } -#endif if (cPtr->Flags & ChipsShadowFB) { if (!xf86LoadSubModule(pScrn, "shadowfb")) { @@ -1584,12 +1427,10 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) from = X_CONFIG; } -#ifndef HAVE_ISA if (!(cPtr->Flags & ChipsLinearSupport)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Linear framebuffer required\n"); return FALSE; } -#endif /* linear base */ if (cPtr->Flags & ChipsLinearSupport) { @@ -2639,12 +2480,10 @@ chipsPreInitWingine(ScrnInfoPtr pScrn, int flags) from = X_CONFIG; } -#ifndef HAVE_ISA if (!(cPtr->Flags & ChipsLinearSupport)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Linear framebuffer required\n"); return FALSE; } -#endif /* linear base */ if (useLinear) { @@ -3104,12 +2943,10 @@ chipsPreInit655xx(ScrnInfoPtr pScrn, int flags) from = X_CONFIG; } -#ifndef HAVE_ISA if (!(cPtr->Flags & ChipsLinearSupport)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Linear framebuffer required\n"); return FALSE; } -#endif /* linear base */ if (useLinear) { @@ -4305,23 +4142,11 @@ CHIPSScreenInit(SCREEN_INIT_ARGS_DECL) xf86InitFBManager(pScreen, &AvailFBArea); } -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) { - if (IS_HiQV(cPtr)) { - CHIPSHiQVAccelInit(pScreen); - } else if (cPtr->UseMMIO) { - CHIPSMMIOAccelInit(pScreen); - } else { - CHIPSAccelInit(pScreen); - } - } -#else if (cPtr->Flags & ChipsAccelSupport) { if (IS_HiQV(cPtr)) { CHIPSInitEXA(pScreen); } } -#endif xf86SetBackingStore(pScreen); #ifdef ENABLE_SILKEN_MOUSE @@ -4542,10 +4367,6 @@ CHIPSCloseScreen(CLOSE_SCREEN_ARGS_DECL) cPtrEnt = pPriv->ptr; cPtrEnt->refCount--; } -#ifdef HAVE_XAA_H - if (cPtr->AccelInfoRec) - XAADestroyInfoRec(cPtr->AccelInfoRec); -#endif if (cPtr->CursorInfoRec) xf86DestroyCursorInfoRec(cPtr->CursorInfoRec); free(cPtr->ShadowPtr); diff --git a/src/ct_driver.h b/src/ct_driver.h index 2920de8..980c6f7 100644 --- a/src/ct_driver.h +++ b/src/ct_driver.h @@ -28,10 +28,6 @@ #include "config.h" #include "ct_pcirename.h" -#ifdef HAVE_XAA_H -#include "xaa.h" -#include "xaalocal.h" /* XAA internals as we replace some of XAA */ -#endif #include "exa.h" #include "vbe.h" #include "xf86Cursor.h" @@ -329,9 +325,6 @@ typedef struct _CHIPSRec { unsigned int * Regs32; unsigned int Flags; CARD32 Bus; -#ifdef HAVE_XAA_H - XAAInfoRecPtr AccelInfoRec; -#endif ExaDriverPtr pExa; xf86CursorInfoPtr CursorInfoRec; CHIPSACLRec Accel; diff --git a/src/ct_video.c b/src/ct_video.c index 7a25444..22c20fb 100644 --- a/src/ct_video.c +++ b/src/ct_video.c @@ -175,10 +175,6 @@ CHIPSResetVideo(ScrnInfoPtr pScrn) unsigned char mr3c; int red, green, blue; -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) - CHIPSHiQVSync(pScrn); -#endif mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c | 0x6)); @@ -290,10 +286,6 @@ CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shadow) unsigned char mr3c, tmp; REGION_EMPTY(pScrn->pScreen, &pPriv->clip); -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) - CHIPSHiQVSync(pScrn); -#endif if(shadow) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { mr3c = cPtr->readMR(cPtr, 0x3C); @@ -325,10 +317,6 @@ CHIPSSetPortAttribute( CHIPSPortPrivPtr pPriv = (CHIPSPortPrivPtr)data; CHIPSPtr cPtr = CHIPSPTR(pScrn); -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) - CHIPSHiQVSync(pScrn); -#endif if(attribute == xvColorKey) { int red, green, blue; pPriv->colorKey = value; @@ -538,10 +526,6 @@ CHIPSDisplayVideo( Bool dblscan = (pScrn->currentMode->Flags & V_DBLSCAN) == V_DBLSCAN; int val; -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) - CHIPSHiQVSync(pScrn); -#endif tmp = cPtr->readXR(cPtr, 0xD0); cPtr->writeXR(cPtr, 0xD0, (tmp | 0x10)); @@ -647,10 +631,6 @@ CHIPSDisplayVideo( tmp = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (tmp | 0x7)); -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) - CHIPSHiQVSync(pScrn); -#endif } static int @@ -830,10 +810,6 @@ CHIPSVideoTimerCallback(ScrnInfoPtr pScrn, Time time) if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { if(pPriv->offTime < time) { -#ifdef HAVE_XAA_H - if (cPtr->Flags & ChipsAccelSupport) - CHIPSHiQVSync(pScrn); -#endif mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); pPriv->videoStatus = FREE_TIMER;