diff options
-rw-r--r-- | configure.ac | 28 | ||||
-rw-r--r-- | man/trident.man | 9 | ||||
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/blade_xaa.c | 863 | ||||
-rw-r--r-- | src/image_xaa.c | 788 | ||||
-rw-r--r-- | src/tgui_xaa.c | 738 | ||||
-rw-r--r-- | src/trident.h | 23 | ||||
-rw-r--r-- | src/trident_dga.c | 87 | ||||
-rw-r--r-- | src/trident_driver.c | 564 | ||||
-rw-r--r-- | src/trident_video.c | 9 | ||||
-rw-r--r-- | src/xp4_xaa.c | 618 | ||||
-rw-r--r-- | src/xp_xaa.c | 653 |
12 files changed, 33 insertions, 4354 deletions
diff --git a/configure.ac b/configure.ac index ed49004..ed2faf9 100644 --- a/configure.ac +++ b/configure.ac @@ -59,20 +59,12 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) XORG_DRIVER_CHECK_EXT(XFreeXDGA, xf86dgaproto) # 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]) PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), HAVE_XEXTPROTO_71="no") AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ]) -save_CFLAGS="$CFLAGS" -CFLAGS="$XORG_CFLAGS" -AC_CHECK_DECL(xf86ConfigIsaEntity, - [AC_DEFINE(HAVE_ISA, 1, [Have ISA support])], - [], - [#include "xf86.h"]) -CFLAGS="$save_CFLAGS" - SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" AC_CHECK_DECL(XSERVER_LIBPCIACCESS, @@ -80,24 +72,6 @@ AC_CHECK_DECL(XSERVER_LIBPCIACCESS, [#include "xorg-server.h"]) CPPFLAGS="$SAVE_CPPFLAGS" -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]) - if test "x$XSERVER_LIBPCIACCESS" = xyes; then PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" diff --git a/man/trident.man b/man/trident.man index f461e10..d84150a 100644 --- a/man/trident.man +++ b/man/trident.man @@ -20,7 +20,7 @@ The XvImage extension is supported on TGUI96xx and greater cards. .SH SUPPORTED HARDWARE The .B trident -driver supports PCI,AGP and ISA video cards based on the following +driver supports PCI and AGP video cards based on the following Trident chips: .TP 12 .B Blade @@ -127,10 +127,11 @@ an integer value greater or equal to 0 and less than 128. Default: gamma and brightness control is turned off. Note: This is not supported on all chipsets. .BI "Option \*qAccelMethod\*q \*q" string \*q -Choose acceleration architecture, either "XAA" or "EXA". XAA is the old -(but stable) XFree86 based acceleration architecture. EXA is a newer and +Choose acceleration architecture, currently only "EXA". XAA was the old +(but stable) XFree86 based acceleration architecture, but is no longer available. +EXA is a newer and simpler acceleration architecture designed to better accelerate the X Render -extension. Default: "XAA". +extension. Default: "EXA". .SH "SEE ALSO" __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) .SH AUTHOR diff --git a/src/Makefile.am b/src/Makefile.am index 9828664..4abff9c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,11 +31,8 @@ trident_drv_ladir = @moduledir@/drivers trident_drv_la_SOURCES = \ blade_exa.c \ - blade_xaa.c \ compat-api.h \ - image_xaa.c \ pci_rename.h \ - tgui_xaa.c \ trident_bank.c \ trident_dac.c \ trident_dga.c \ @@ -48,6 +45,4 @@ trident_drv_la_SOURCES = \ trident_video.c \ trident.h \ tvga_dac.c \ - xp_xaa.c \ - xp4_exa.c \ - xp4_xaa.c + xp4_exa.c diff --git a/src/blade_xaa.c b/src/blade_xaa.c deleted file mode 100644 index 128913f..0000000 --- a/src/blade_xaa.c +++ /dev/null @@ -1,863 +0,0 @@ -/* - * Copyright 1997-2003 by Alan Hourihane, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Alan - * Hourihane not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Alan Hourihane makes no representations about the - * suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * Trident Blade3D accelerated options. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "xf86Pci.h" - -#include "miline.h" - -#include "trident.h" -#include "trident_regs.h" - -#ifdef HAVE_XAA_H -#include "xaarop.h" -#include "xaalocal.h" - -static void BladeSync(ScrnInfoPtr pScrn); -#if 0 -static void BladeSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void BladeSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant); -static void BladeSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int flags); -static void BladeSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern); -static void BladeSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int flags, int phase); -#endif -static void BladeSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void BladeSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h); -static void BladeSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h); -static void BladeSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color); -#if 0 -static void BladeSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void BladeSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int srcx, int srcy, - int offset); -#endif -static void BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void BladeSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void BladeSetClippingRectangle(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2); -static void BladeDisableClipping(ScrnInfoPtr pScrn); -static void BladeSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, - unsigned int planemask); -static void BladeSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#if 0 -static void BladeSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int rop, - unsigned int planemask, - int trans_col); -static void BladeSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#endif -static void BladeSetupForImageWrite(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth); -static void BladeSubsequentImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); - -static void -BladeInitializeAccelerator(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD32 stride; - - stride = (pScrn->displayWidth >> 3) << 20; - - BLADE_OUT(0x21C8, stride); - BLADE_OUT(0x21CC, stride); - BLADE_OUT(0x21D0, stride); - BLADE_OUT(0x21D4, stride); - switch (pScrn->depth) { - case 8: - stride |= (0 << 29); - break; - case 15: - stride |= (5 << 29); - break; - case 16: - stride |= (1 << 29); - break; - case 24: - stride |= (2 << 29); - break; - } - - BLADE_OUT(0x21B8, 0); - BLADE_OUT(0x21B8, stride); - BLADE_OUT(0x21BC, stride); - BLADE_OUT(0x21C0, stride); - BLADE_OUT(0x21C4, stride); -#if 0 - /* It appears that the driver sometimes misdetects the RAM type, so we - * don't force this for now */ - if (pTrident->HasSGRAM) - BLADE_OUT(0x2168, 1 << 26); /* Enables Block Write if available (SGRAM) */ - else - BLADE_OUT(0x2168, 0); -#endif - BLADE_OUT(0x216C, 0); -} -#endif - -Bool BladeXaaInit(ScreenPtr pScreen) { -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->NoAccel) - return FALSE; - - pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - pTrident->InitializeAccelerator = BladeInitializeAccelerator; - BladeInitializeAccelerator(pScrn); - - infoPtr->Flags = PIXMAP_CACHE | - LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS; - - infoPtr->Sync = BladeSync; - - infoPtr->SetClippingRectangle = BladeSetClippingRectangle; - infoPtr->DisableClipping = BladeDisableClipping; - -#if 0 - infoPtr->SolidLineFlags = 0; - infoPtr->SetupForSolidLine = BladeSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = - BladeSubsequentSolidTwoPointLine; - infoPtr->SetupForDashedLine = BladeSetupForDashedLine; - infoPtr->SubsequentDashedTwoPointLine = - BladeSubsequentDashedTwoPointLine; - infoPtr->DashPatternMaxLength = 16; - infoPtr->DashedLineFlags = LINE_PATTERN_LSBFIRST_LSBJUSTIFIED | - LINE_PATTERN_POWER_OF_2_ONLY; -#endif - - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = BladeSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = BladeSubsequentFillRectSolid; - - infoPtr->ScreenToScreenCopyFlags = ONLY_TWO_BITBLT_DIRECTIONS | - NO_PLANEMASK | - NO_TRANSPARENCY; - - infoPtr->SetupForScreenToScreenCopy = - BladeSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - BladeSubsequentScreenToScreenCopy; - - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - NO_TRANSPARENCY | - BIT_ORDER_IN_BYTE_MSBFIRST | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS; - - infoPtr->SetupForMono8x8PatternFill = - BladeSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - BladeSubsequentMono8x8PatternFillRect; - -#if 0 - infoPtr->Color8x8PatternFillFlags = - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForColor8x8PatternFill = - TridentSetupForColor8x8PatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = - TridentSubsequentColor8x8PatternFillRect; - - infoPtr->ScreenToScreenColorExpandFillFlags = 0; - - infoPtr->SetupForScreenToScreenColorExpandFill = - BladeSetupForScreenToScreenColorExpand; - infoPtr->SubsequentScreenToScreenColorExpandFill = - BladeSubsequentScreenToScreenColorExpand; -#endif - - infoPtr->CPUToScreenColorExpandFillFlags = - CPU_TRANSFER_PAD_DWORD | - LEFT_EDGE_CLIPPING | - SYNC_AFTER_COLOR_EXPAND | - NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD; - infoPtr->ColorExpandRange = 0x10000; - infoPtr->ColorExpandBase = pTrident->IOBase + 0x10000; - infoPtr->SetupForCPUToScreenColorExpandFill = - BladeSetupForCPUToScreenColorExpand; - infoPtr->SubsequentCPUToScreenColorExpandFill = - BladeSubsequentCPUToScreenColorExpand; - - infoPtr->SetupForImageWrite = BladeSetupForImageWrite; - infoPtr->SubsequentImageWriteRect = - BladeSubsequentImageWriteRect; - infoPtr->ImageWriteFlags = NO_PLANEMASK | - LEFT_EDGE_CLIPPING | - CPU_TRANSFER_PAD_DWORD | - SYNC_AFTER_IMAGE_WRITE; - infoPtr->ImageWriteBase = pTrident->IOBase + 0x10000; - infoPtr->ImageWriteRange = 0x10000; - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -BladeSync(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int busy; - int cnt = 10000000; - - if (pTrident->Clipping) BladeDisableClipping(pScrn); - BLADE_OUT(0x216C, 0); - - BLADEBUSY(busy); - while (busy != 0) { - if (--cnt < 0) { - ErrorF("GE timeout\n"); - BLADE_OUT(0x2124, 1 << 7); - BLADE_OUT(0x2124, 0); - break; - } - - BLADEBUSY(busy); - } -} - -static void -BladeSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->BltScanDirection = 0; - if ((xdir < 0) || (ydir < 0)) - pTrident->BltScanDirection |= (1 << 1); - -#if 0 - if (transparency_color != -1) { - BLADE_OUT(0x2168, transparency_color & 0xffffff); - pTrident->BltScanDirection |= (1 << 6); - } - - REPLICATE(planemask); - if (planemask != (unsigned int)-1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } - -#endif - BLADE_OUT(0x2148, XAAGetCopyROP(rop)); -} - -static void -BladeSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int clip = 0; - - if (pTrident->Clipping) clip = 1; - - BLADE_OUT(0x2144, 0xE0000000 | - (1 << 19) | (1 << 4) | (1 << 2) | - pTrident->BltScanDirection | clip); - - if (pTrident->BltScanDirection) { - BLADE_OUT(0x2100, ((y1 + h - 1) << 16) | (x1 + w - 1)); - BLADE_OUT(0x2104, (y1 << 16) | x1); - BLADE_OUT(0x2108, ((y2 + h - 1) << 16) | (x2 + w - 1)); - BLADE_OUT(0x210C, ((y2 & 0xfff) << 16) | (x2 & 0xfff)); - } else { - BLADE_OUT(0x2100, (y1 << 16) | x1); - BLADE_OUT(0x2104, ((y1 + h - 1) << 16) | (x1 + w - 1)); - BLADE_OUT(0x2108, (y2 << 16) | x2); - BLADE_OUT(0x210C, (((y2 + h - 1) & 0xfff) << 16) | - ((x2 + w - 1) & 0xfff)); - } -} - -static void -BladeSetClippingRectangle(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - BLADE_OUT(0x2154, ((y1 & 0x0fff) << 16) | (x1 & 0x0fff)); - BLADE_OUT(0x2158, ((y2 & 0x0fff) << 16) | (x2 & 0x0fff)); - pTrident->Clipping = TRUE; -} - -static void -BladeDisableClipping(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - pTrident->Clipping = FALSE; -} - -#if 0 -static void -BladeSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - REPLICATE(color); - BLADE_OUT(0x2160, color); - BLADE_OUT(0x2148, XAAGetCopyROP(rop)); - pTrident->BltScanDirection = 0; - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -} - -static void -BladeSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp; - int D = 0, E = 0, ymajor = 0; - - BLADE_OUT(0x2144, 0x20000000 | - (3 << 19) | (1 << 4) | (2 << 2) | - (pTrident->Clipping ? 1 : 0)); - - if (!(octant & YMAJOR)) { - if ((!(octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 1; D = 0; - } - - if ((!(octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 1; D = 1; - } - - if (( (octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 1; D = 2; - } - - if (( (octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 1; D = 3; - } - - ymajor = 0; - } else { - if ((!(octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 0; D = 0; - } - - if ((!(octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 0; D = 2; - } - - if (( (octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 0; D = 1; - } - - if (( (octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 0; D = 3; - } - - ymajor = 1 << 21; - } - - if (E) { - tmp = x; x = y; y = tmp; - } - - BLADE_OUT(0x2130, 0x00000001); - if (D & 0x02) { - BLADE_OUT(0x213C, 0x10000000 | - (1 << 25) | (1 << 19) | (1 << 17) | - ymajor | ((x + len - 1) << 4)); - } else { - BLADE_OUT(0x213C, 0x10000000 | - (1 << 25) | (1 << 19) | (1 << 17) | - ymajor | ((y + len - 1) << 4)); - } - - BLADE_OUT(0x2140, (E << 30) | - ((y & 0xfff) << 20) | ((x & 0xfff) << 4)); - BLADE_OUT(0x2144, (D << 30) | - (((dmaj - dmin) & 0xfff) << 16) | - (-dmin & 0xfff)); - BLADE_OUT(0x2148, ((-(dmin + e) & 0xfff) << 16)); -} - -static void -BladeSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int flags) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - -#if 0 - if (flags & OMIT_LAST) - BladeSetClippingRectangle(pScrn, x1, y1, x2 - 1, y2 - 1); -#endif - - BLADE_OUT(0x2144, 0x20000000 | - pTrident->BltScanDirection | - (1 << 19) | (1 << 4) | (2 << 2)); - BLADE_OUT(0x2130, 0x3); - BLADE_OUT(0x2108, (y1 << 16) | x1); - BLADE_OUT(0x210C, ((y2 & 0xfff) << 16) | (x2 & 0xfff)); - -#if 0 - if (flags & OMIT_LAST) - BladeDisableClipping(pScrn); -#endif -} - -static void -BladeSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->LinePattern = *((CARD16 *)pattern) & ((1 << length) - 1); - switch (length) { - case 2: - pTrident->LinePattern = pTrident->LinePattern | - (pTrident->LinePattern << 2); - case 4: - pTrident->LinePattern = pTrident->LinePattern | - (pTrident->LinePattern << 4); - case 8: - pTrident->LinePattern = pTrident->LinePattern | - (pTrident->LinePattern << 8); - } - - REPLICATE(fg); - REPLICATE(bg); - BLADE_OUT(0x2160, fg); - BLADE_OUT(0x2164, bg); - BLADE_OUT(0x2148, XAAGetCopyROP(rop)); - pTrident->BltScanDirection = 0; - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -} - -static void -BladeSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int flags, int phase) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (flags & OMIT_LAST) - BladeSetClippingRectangle(pScrn, x1, y1, x2 - 1, y2 - 1); - - BLADE_OUT(0x216C, (pTrident->LinePattern >> phase) | - (pTrident->LinePattern << (16 - phase))); - BLADE_OUT(0x2144, 0x20000000 | - pTrident->BltScanDirection | - (1 << 27) | (1 << 19) | (1 << 4) | (2 << 2)); - BLADE_OUT(0x2108, (y1 << 16) | x1); - BLADE_OUT(0x210C, ((y2 & 0xfff) << 16) | (x2 & 0xfff)); - - if (flags & OMIT_LAST) - BladeDisableClipping(pScrn); -} -#endif - -static void -BladeSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - REPLICATE(color); - BLADE_OUT(0x2160, color); - BLADE_OUT(0x2148, XAAGetCopyROP(rop)); - pTrident->BltScanDirection = 0; -#if 0 - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -#endif -} - -static void -BladeSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - BLADE_OUT(0x2144, 0x20000000 | - pTrident->BltScanDirection | - (1 << 19) | (1 << 4) | (2 << 2) | - (pTrident->Clipping ? 1 : 0)); - BLADE_OUT(0x2108, (y << 16) | x); - BLADE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); -} - -#if 0 -static void -BladeSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->ROP = rop; - - REPLICATE(bg); - REPLICATE(fg); - IMAGE_OUT(0x44, fg); - IMAGE_OUT(0x48, bg); - IMAGE_OUT(0x20, 0x90000000 | XAAGetCopyROP(rop)); - pTrident->BltScanDirection = 0; - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -} - -static void -BladeSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int srcx, int srcy, - int offset) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - IMAGE_OUT(0x00, (srcy << 16) | srcx); - IMAGE_OUT(0x04, ((srcy + h - 1) << 16) | (srcx + w - 1)); - IMAGE_OUT(0x08, (y << 16) | x); - IMAGE_OUT(0x0C, ((y + h - 1) << 16) | (x + w - 1)); - - IMAGE_OUT(0x24, 0x80000000 | - (3 << 22) | (1 << 7) | - pTrident->BltScanDirection | - (pTrident->ROP == GXcopy ? 0 : (1 << 10)) | - (offset << 25)); -} -#endif - -static void -BladeSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->BltScanDirection = 0; - BLADE_OUT(0x2148, XAAGetCopyROP(rop)); - if (bg == -1) { - pTrident->BltScanDirection |= (2 << 19); - REPLICATE(fg); - BLADE_OUT(0x2160, fg); - BLADE_OUT(0x2164, ~fg); - } else { - pTrident->BltScanDirection |= (3 << 19); - REPLICATE(fg); - REPLICATE(bg); - BLADE_OUT(0x2160, fg); - BLADE_OUT(0x2164, bg); - } - -#if 0 - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -#endif -} - -static void -BladeSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (skipleft) - BladeSetClippingRectangle(pScrn, - x + skipleft, y, - (x + w - 1), (y + h - 1)); - BLADE_OUT(0x2144, 0xE0000000 | - pTrident->BltScanDirection | - (1 << 4) | - (skipleft ? 1 : 0)); - BLADE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff)); - BLADE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); -} - -static void -BladeSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - BladeSync(pScrn); - BLADE_OUT(0x2148, XAAGetPatternROP(rop)); - - if (bg == -1) { - REPLICATE(fg); - BLADE_OUT(0x216C, 0x80000000 | (1 << 30)); - BLADE_OUT(0x216C, 0x80000000 | (1 << 28) | (1 << 30)); - BLADE_OUT(0x2170, patternx); - BLADE_OUT(0x2170, patterny); - BLADE_OUT(0x2174, fg); -#if 0 - BLADE_OUT(0x2178, ~fg); -#endif - } else { - REPLICATE(fg); - REPLICATE(bg); - BLADE_OUT(0x216C, 0x80000000); - BLADE_OUT(0x216C, 0x80000000 | (1 << 28)); - BLADE_OUT(0x2170, patternx); - BLADE_OUT(0x2170, patterny); - BLADE_OUT(0x2174, fg); - BLADE_OUT(0x2178, bg); - } - - pTrident->BltScanDirection = 0; -#if 0 - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -#endif -} - -static void -BladeSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int clip = 0; - - if (pTrident->Clipping) clip = 1; - BLADE_OUT(0x2144, 0x20000000 | - pTrident->BltScanDirection | - (7 << 12) | (1 << 4) | - (1 << 19) | (2 << 2) | clip); - BLADE_OUT(0x2108, (y << 16) | x); - BLADE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); -} - -#if 0 -static void -BladeSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_PATLOC(((patterny * - pScrn->displayWidth * - (pScrn->bitsPerPixel / 8)) + - (patternx * - (pScrn->bitsPerPixel / 8))) >> 6); - pTrident->BltScanDirection = 0; - if (transparency_color != -1) { - BLADE_OUT(0x2168, transparency_color & 0xffffff); - pTrident->BltScanDirection |= (1 << 6); - } - TGUI_FMIX(XAAGetPatternROP(rop)); - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -} - -static void -BladeSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_DEST_XY(x, y); - TGUI_DIM_XY(w, h); - TGUI_COMMAND(GE_BLT); - CHECKCLIPPING; -} -#endif - -static void -BladeSetupForImageWrite(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - BLADE_OUT(0x2148, XAAGetCopyROP(rop)); - pTrident->BltScanDirection = 0; -#if 0 - REPLICATE(planemask); - if (planemask != -1) { - BLADE_OUT(0x2184, ~planemask); - pTrident->BltScanDirection |= (1 << 5); - } -#endif -} - -static void -BladeSubsequentImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (skipleft) - BladeSetClippingRectangle(pScrn, - x + skipleft, y, - (x + w - 1), (y + h - 1)); - BLADE_OUT(0x2144, 0xE0000000 | - (1 << 19) | (1 << 4) | - pTrident->BltScanDirection | - (skipleft ? 1 : 0)); - BLADE_OUT(0x2108, (y << 16) | (x & 0xfff)); - BLADE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); -} -#endif diff --git a/src/image_xaa.c b/src/image_xaa.c deleted file mode 100644 index 4ef65d1..0000000 --- a/src/image_xaa.c +++ /dev/null @@ -1,788 +0,0 @@ -/* - * Copyright 1997-2003 by Alan Hourihane, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Alan - * Hourihane not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Alan Hourihane makes no representations about the - * suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * Trident 3DImage' accelerated options. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "xf86Pci.h" - -#include "miline.h" - -#include "trident.h" -#include "trident_regs.h" - -#ifdef HAVE_XAA_H -#include "xaarop.h" -#include "xaalocal.h" - - -static void ImageSync(ScrnInfoPtr pScrn); -static void ImageSyncClip(ScrnInfoPtr pScrn); -#if 0 -static void ImageSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void ImageSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant); -#endif -static void ImageSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void ImageSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h); -static void ImageSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h); -static void ImageSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color); -static void ImageSetClippingRectangle(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2); -static void ImageDisableClipping(ScrnInfoPtr pScrn); -static void ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, - unsigned int planemask); -static void ImageSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#if 0 -static void ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int rop, - unsigned int planemask, - int trans_col); -static void ImageSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#endif -static void ImageSetupForScanlineImageWrite(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, - int depth); -static void ImageSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void ImageSubsequentImageWriteScanline(ScrnInfoPtr pScrn, - int bufno); -static void ImageSetupForScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void ImageSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void ImageSubsequentColorExpandScanline(ScrnInfoPtr pScrn, - int bufno); - - -static void -ImageInitializeAccelerator(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - switch (pScrn->depth) { - case 8: - pTrident->EngineOperation = 0; - break; - case 15: - pTrident->EngineOperation = 5; - break; - case 16: - pTrident->EngineOperation = 1; - break; - case 24: - pTrident->EngineOperation = 2; - break; - } - IMAGE_OUT(0x2120, 0xF0000000); - IMAGE_OUT(0x2120, 0x40000000 | pTrident->EngineOperation); - IMAGE_OUT(0x2120, 0x80000000); - IMAGE_OUT(0x2144, 0x00000000); - IMAGE_OUT(0x2148, 0x00000000); - IMAGE_OUT(0x2150, 0x00000000); - IMAGE_OUT(0x2154, 0x00000000); - IMAGE_OUT(0x2120, 0x60000000 | - (pScrn->displayWidth << 16) | - pScrn->displayWidth); - IMAGE_OUT(0x216C, 0x00000000); - IMAGE_OUT(0x2170, 0x00000000); - IMAGE_OUT(0x217C, 0x00000000); - IMAGE_OUT(0x2120, 0x10000000); - IMAGE_OUT(0x2130, (2047 << 16) | 2047); - pTrident->Clipping = FALSE; - pTrident->DstEnable = FALSE; -} -#endif - -Bool -ImageAccelInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->NoAccel) - return FALSE; - - pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - pTrident->InitializeAccelerator = ImageInitializeAccelerator; - ImageInitializeAccelerator(pScrn); - - infoPtr->Flags = PIXMAP_CACHE | - LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS; - - infoPtr->Sync = ImageSync; - -#if 0 - infoPtr->SetClippingRectangle = ImageSetClippingRectangle; - infoPtr->DisableClipping = ImageDisableClipping; - infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_FILL | - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | - HARDWARE_CLIP_MONO_8x8_FILL; -#endif - -#if 0 - infoPtr->SolidLineFlags = NO_PLANEMASK; - infoPtr->SetupForSolidLine = ImageSetupForSolidLine; - infoPtr->SolidBresenhamLineErrorTermBits = 13; - infoPtr->SubsequentSolidBresenhamLine = - ImageSubsequentSolidBresenhamLine; - infoPtr->ClippingFlags |= HARDWARE_CLIP_SOLID_LINE; -#endif - - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = ImageSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = ImageSubsequentFillRectSolid; - - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | - NO_TRANSPARENCY | - ONLY_TWO_BITBLT_DIRECTIONS; - - infoPtr->SetupForScreenToScreenCopy = - ImageSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - ImageSubsequentScreenToScreenCopy; - - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS; - - infoPtr->SetupForMono8x8PatternFill = - ImageSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - ImageSubsequentMono8x8PatternFillRect; - -#if 0 - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - NO_TRANSPARENCY | - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForColor8x8PatternFill = - ImageSetupForColor8x8PatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = - ImageSubsequentColor8x8PatternFillRect; - infoPtr->ClippingFlags |= HARDWARE_CLIP_COLOR_8x8_FILL; -#endif - - if (pTrident->Chipset != CYBER9397DVD) { - /* - * It seems as though the 9397DVD doesn't like the transfer - * window. But then, I've also tried at the two port - * addresses too, with no luck. Disable for this chipset for - * now. I'd guess there's some extra setup needed for this - * chipset. - */ - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - NO_PLANEMASK | - LEFT_EDGE_CLIPPING | - BIT_ORDER_IN_BYTE_MSBFIRST; - - pTrident->XAAScanlineColorExpandBuffers[0] = - XNFalloc(((pScrn->virtualX + 63)) * 4 * - (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers = - pTrident->XAAScanlineColorExpandBuffers; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - ImageSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - ImageSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - ImageSubsequentColorExpandScanline; - - infoPtr->ScanlineImageWriteFlags = NO_PLANEMASK | - LEFT_EDGE_CLIPPING; - - infoPtr->SetupForScanlineImageWrite = - ImageSetupForScanlineImageWrite; - infoPtr->SubsequentScanlineImageWriteRect = - ImageSubsequentScanlineImageWriteRect; - infoPtr->SubsequentImageWriteScanline = - ImageSubsequentImageWriteScanline; - - infoPtr->NumScanlineImageWriteBuffers = 1; - infoPtr->ScanlineImageWriteBuffers = - pTrident->XAAImageScanlineBuffer; - - pTrident->XAAImageScanlineBuffer[0] = - XNFalloc(pScrn->virtualX * pScrn->bitsPerPixel / 8); - - infoPtr->ImageWriteBase = pTrident->IOBase + 0x10000; - } - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -ImageSync(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int busy; - int cnt = 5000000; - - if (pTrident->Clipping) ImageDisableClipping(pScrn); - if (pTrident->DstEnable) { - IMAGE_OUT(0x2120, 0x70000000); - pTrident->DstEnable = FALSE; - } - - IMAGEBUSY(busy); - while (busy != 0) { - if (--cnt < 0) { - ErrorF("GE timeout\n"); - IMAGE_OUT(0x2164, 0x80000000); - } - - IMAGEBUSY(busy); - } -} - -static void -ImageSyncClip(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int busy; - int cnt = 5000000; - - IMAGEBUSY(busy); - while (busy != 0) { - if (--cnt < 0) { - ErrorF("GE timeout\n"); - IMAGE_OUT(0x2164, 0x80000000); - } - - IMAGEBUSY(busy); - } -} - -static void -ImageSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->BltScanDirection = 0; - if ((xdir < 0) || (ydir < 0)) - pTrident->BltScanDirection |= (1 << 2); - - IMAGE_OUT(0x2120, 0x80000000); - IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop)); - - if (transparency_color != -1) { - IMAGE_OUT(0x2120, 0x70000000 | - (1 << 26) | - (transparency_color & 0xffffff)); - pTrident->DstEnable = TRUE; - } -} - -static void -ImageSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->BltScanDirection) { - IMAGE_OUT(0x2100, ((y1 + h - 1) << 16) | (x1 + w - 1)); - IMAGE_OUT(0x2104, (y1 << 16) | x1); - IMAGE_OUT(0x2108, ((y2 + h - 1) << 16) | (x2 + w - 1)); - IMAGE_OUT(0x210C, y2<<16 | x2); - } else { - IMAGE_OUT(0x2100, (y1 << 16) | x1); - IMAGE_OUT(0x2104, ((y1 + h - 1) << 16) | (x1 + w - 1)); - IMAGE_OUT(0x2108, (y2 << 16) | x2); - IMAGE_OUT(0x210C, ((y2 + h - 1) << 16) | (x2 + w - 1)); - } - - IMAGE_OUT(0x2124, 0x80000000 | - (1 << 7) | (1 << 22) | (1 << 10) | - pTrident->BltScanDirection | - (pTrident->Clipping ? 1 : 0)); - - if (!pTrident->UsePCIRetry) - ImageSyncClip(pScrn); -} - -static void -ImageSetClippingRectangle(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - IMAGE_OUT(0x2120, 0x10000000 | - ((y1 & 0xfff) << 16) | (x1 & 0xfff)); - IMAGE_OUT(0x2130, ((y2 & 0xfff) << 16) | (x2 & 0xfff)); - pTrident->Clipping = TRUE; -} - -static void -ImageDisableClipping(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - pTrident->Clipping = FALSE; -} - -#if 0 -static void -ImageSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - REPLICATE(color); - IMAGE_OUT(0x2120, 0x84000000); - IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop)); - IMAGE_OUT(0x2144, color); -} - -static void -ImageSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, int octant) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp; - int D = 0, E = 0, ymajor = 0; - - IMAGE_OUT(0x2124, 0x20000000 | - (3 << 22) | (1 << 10) | (1 << 9) | - (pTrident->Clipping ? 1 : 0)); - if (!(octant & YMAJOR)) { - if ((!(octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 1; - D = 0; - } - - if ((!(octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 1; - D = 1; - } - - if (( (octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 1; - D = 2; - } - if (( (octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 1; - D = 3; - } - - ymajor = 0; - } else { - if ((!(octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 0; - D = 0; - } - - if ((!(octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 0; - D = 2; - } - - if (( (octant & XDECREASING)) && (!(octant & YDECREASING))) { - E = 0; - D = 1; - } - - if (( (octant & XDECREASING)) && ( (octant & YDECREASING))) { - E = 0; - D = 3; - } - - ymajor = (1 << 18); - } - - if (E) { - tmp = x; - x = y; - y = tmp; - } - if (D & 0x02) { - IMAGE_OUT(0x21FC, 0x20000000 | - (1 << 27) | (1 << 19) | (1 << 17) | - ymajor | (x + len - 1)); - } else { - IMAGE_OUT(0x21FC, 0x20000000 | - (1 << 27) | (1 << 19) | (1 << 17) | - ymajor | ( y + len - 1)); - } - IMAGE_OUT(0x2100, (E << 30) | ((y & 0xfff) << 16) | (x & 0xfff)); - IMAGE_OUT(0x2104, (D << 30) | - (((dmaj - dmin) & 0xfff) << 16) | - (-dmin & 0xfff)); - IMAGE_OUT(0x2108, ((-e & 0xfff) << 16)); - - if (!pTrident->UsePCIRetry) - ImageSyncClip(pScrn); -} -#endif - -static void -ImageSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - REPLICATE(color); - IMAGE_OUT(0x2120, 0x80000000); - IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop)); - IMAGE_OUT(0x2144, color); -} - -static void -ImageSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if ((w <= 0) || (h <= 0)) - return; - - IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff)); - IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); - IMAGE_OUT(0x2124, 0x80000000 | - (3 << 22) | (1 << 10) | (1 << 9) | - (pTrident->Clipping ? 1 : 0)); - if (!pTrident->UsePCIRetry) - ImageSyncClip(pScrn); -} - -static void -MoveDWORDS(register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - Bool extra = FALSE; - - if (dwords & 0x01) extra = TRUE; - - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - - if(!dwords) { - if (extra) *dest = 0x00000000; - return; - } - - *dest = *src; - if(dwords == 1) { - if (extra) *(dest + 1) = 0x00000000; - return; - } - - *(dest + 1) = *(src + 1); - if(dwords == 2) { - if (extra) *(dest + 2) = 0x00000000; - return; - } - - *(dest + 2) = *(src + 2); - if (extra) *(dest + 3) = 0x00000000; -} - -static void -ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - IMAGE_OUT(0x2120, 0x90000000 | XAAGetPatternROP(rop)); - if (bg == -1) { - REPLICATE(fg); - IMAGE_OUT(0x2120, 0x80000000 | (1 << 27)); - IMAGE_OUT(0x2130, patternx); - IMAGE_OUT(0x2134, patterny); - IMAGE_OUT(0x2150, fg); - IMAGE_OUT(0x2154, ~fg); - } else { - REPLICATE(bg); - REPLICATE(fg); - IMAGE_OUT(0x2120, 0x80000000 | (1 << 27) | (1 << 26)); - IMAGE_OUT(0x2130, patternx); - IMAGE_OUT(0x2134, patterny); - IMAGE_OUT(0x2150, fg); - IMAGE_OUT(0x2154, bg); - } -} - -static void -ImageSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff)); - IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); - IMAGE_OUT(0x2124, 0x80000000 | - (7 << 18) | (1 << 22) | (1 << 10) | (1 << 9) | - (pTrident->Clipping ? 1 : 0)); - if (!pTrident->UsePCIRetry) - ImageSyncClip(pScrn); -} - -#if 0 -static void -ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - IMAGE_OUT(0x2120, 0x90000000 | XAAGetPatternROP(rop)); - IMAGE_OUT(0x2120, 0x80000000 | (1 << 26)); - if (transparency_color != -1) { - IMAGE_OUT(0x2120, 0x70000000 | - (1 << 26) | - (transparency_color & 0xffffff)); - pTrident->DstEnable = TRUE; - } -} - -static void -ImageSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - IMAGE_OUT(0x2100, ((patterny & 0xfff) << 16) | - (patternx & 0xfff)); - IMAGE_OUT(0x2104, (((patterny + h - 1) & 0xfff) << 16) | - ((patternx + w - 1) & 0xfff)); - IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff)); - IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); - IMAGE_OUT(0x2124, 0x80000000 | - (1 << 22) | (1 << 10) | (1 << 7) | - (pTrident->Clipping ? 1 : 0)); - if (!pTrident->UsePCIRetry) - ImageSyncClip(pScrn); -} -#endif - -static void -ImageSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - IMAGE_OUT(0x2120, 0x80000000); - IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop)); - if (bg == -1) { - pTrident->ROP = (2 << 22); - REPLICATE(fg); - IMAGE_OUT(0x2144, fg); - IMAGE_OUT(0x2148, ~fg); - } else { - pTrident->ROP = (3 << 22); - REPLICATE(fg); - IMAGE_OUT(0x2144, fg); - REPLICATE(bg); - IMAGE_OUT(0x2148, bg); - } -} - -static void -ImageSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft -){ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - ImageSetClippingRectangle(pScrn,(x + skipleft), y, - (x + w - 1), (y + h - 1)); - IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff)); - IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); - IMAGE_OUT(0x2124, 0x80000000 | (pTrident->ROP) | (1 << 10) | 1); - pTrident->dwords = (w + 31) >> 5; - pTrident->h = h; -} - -static void -ImageSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - XAAInfoRecPtr infoRec; - infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - MoveDWORDS((CARD32*)infoRec->ImageWriteBase, - (CARD32*)pTrident->XAAScanlineColorExpandBuffers[bufno], - pTrident->dwords); - - pTrident->h--; - if (!pTrident->h) - ImageSync(pScrn); -} - -static void -ImageSetupForScanlineImageWrite(ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop)); - if (transparency_color != -1) { - IMAGE_OUT(0x2120, 0x70000000 | - (1 << 26) | - (transparency_color & 0xffffff)); - pTrident->DstEnable = TRUE; - } - - IMAGE_OUT(0x2120, 0x80000000); -} - -static void -ImageSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - ImageSetClippingRectangle(pScrn, - (x + skipleft), y, - (x + w - 1), (y + h - 1)); - IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff)); - IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) | - ((x + w - 1) & 0xfff)); - IMAGE_OUT(0x2124, 0x80000000 | - (1 << 22) | (1 << 10) | 1); - pTrident->dwords = ((w * (pScrn->bitsPerPixel / 8)) + 3) >> 2; - pTrident->h = h; -} - - -static void -ImageSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - XAAInfoRecPtr infoRec; - infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - MoveDWORDS((CARD32*)infoRec->ImageWriteBase, - (CARD32*)pTrident->XAAImageScanlineBuffer[bufno], - pTrident->dwords); - - pTrident->h--; - if (!pTrident->h) - ImageSync(pScrn); -} -#endif diff --git a/src/tgui_xaa.c b/src/tgui_xaa.c deleted file mode 100644 index 7f2002f..0000000 --- a/src/tgui_xaa.c +++ /dev/null @@ -1,738 +0,0 @@ -/* - * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Alan - * Hourihane not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Alan Hourihane makes no representations about the - * suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * Trident accelerated options. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "xf86Pci.h" - -#include "miline.h" - -#include "trident.h" -#include "trident_regs.h" - -#ifdef HAVE_XAA_H -#include "xaalocal.h" -#include "xaarop.h" - -static void TridentSync(ScrnInfoPtr pScrn); -static void TridentSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern); -static void TridentSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant, - int phase); -static void TridentSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void TridentSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant); -static void TridentSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, - int len, int dir); -static void TridentSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void TridentSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h); -static void TridentSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h); -static void TridentSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color); -static void TridentSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, - unsigned int planemask); -static void TridentSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#if 0 -static void TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int rop, - unsigned int planemask, - int trans_col); -static void TridentSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#endif -#if 0 -static void TridentSetupForScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void TridentSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void TridentSubsequentColorExpandScanline(ScrnInfoPtr pScrn, - int bufno); -#endif - - -static void -TridentInitializeAccelerator(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - /* This forces updating the clipper */ - pTrident->Clipping = TRUE; - - CHECKCLIPPING; - - if ((pTrident->Chipset == PROVIDIA9682) || - (pTrident->Chipset == CYBER9385) || - (pTrident->Chipset == CYBER9382)) - pTrident->EngineOperation |= 0x100; /* Disable Clipping */ - - TGUI_OPERMODE(pTrident->EngineOperation); - - pTrident->PatternLocation = pScrn->displayWidth * - pScrn->bitsPerPixel / 8; -} -#endif - -Bool -TridentAccelInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->NoAccel) - return FALSE; - - pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - if (!((pTrident->Chipset == TGUI9440AGi) && - (pScrn->bitsPerPixel > 8))) - infoPtr->Flags = PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; - - pTrident->InitializeAccelerator = TridentInitializeAccelerator; - TridentInitializeAccelerator(pScrn); - - infoPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES; - - infoPtr->Sync = TridentSync; - - infoPtr->SolidLineFlags = NO_PLANEMASK; - infoPtr->SetupForSolidLine = TridentSetupForSolidLine; - infoPtr->SolidBresenhamLineErrorTermBits = 12; - infoPtr->SubsequentSolidBresenhamLine = - TridentSubsequentSolidBresenhamLine; - infoPtr->SubsequentSolidHorVertLine = - TridentSubsequentSolidHorVertLine; - - infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED | - NO_PLANEMASK | - LINE_PATTERN_POWER_OF_2_ONLY; - infoPtr->SetupForDashedLine = TridentSetupForDashedLine; - infoPtr->DashedBresenhamLineErrorTermBits = 12; - infoPtr->SubsequentDashedBresenhamLine = - TridentSubsequentDashedBresenhamLine; - infoPtr->DashPatternMaxLength = 16; - - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = TridentSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = TridentSubsequentFillRectSolid; - - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK; - - if (!HAS_DST_TRANS) - infoPtr->ScreenToScreenCopyFlags |= NO_TRANSPARENCY; - - infoPtr->SetupForScreenToScreenCopy = - TridentSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - TridentSubsequentScreenToScreenCopy; - - if (!(((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) && - (pScrn->bitsPerPixel > 8))) { - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForMono8x8PatternFill = - TridentSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - TridentSubsequentMono8x8PatternFillRect; - } - -#if 0 - /* - * Not convinced this works 100% yet. - */ - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - - if (!HAS_DST_TRANS) - infoPtr->Color8x8PatternFillFlags |= NO_TRANSPARENCY; - - infoPtr->SetupForColor8x8PatternFill = - TridentSetupForColor8x8PatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = - TridentSubsequentColor8x8PatternFillRect; -#endif - -#if 0 - /* - * This is buggy, it only seems to work 95% of the time.... - */ - { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - NO_PLANEMASK | - NO_TRANSPARENCY | - BIT_ORDER_IN_BYTE_MSBFIRST; - - pTrident->XAAScanlineColorExpandBuffers[0] = - XNFalloc(((pScrn->virtualX + 63)) * 4 * - (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers = - pTrident->XAAScanlineColorExpandBuffers; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - TridentSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - TridentSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - TridentSubsequentColorExpandScanline; - } -#endif - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -TridentSync(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int count = 0, timeout = 0; - int busy; - - TGUI_OPERMODE(pTrident->EngineOperation); - - for (;;) { - BLTBUSY(busy); - if (busy != GE_BUSY) { - return; - } - - count++; - if (count == 10000000) { - ErrorF("Trident: BitBLT engine time-out.\n"); - count = 9990000; - timeout++; - if (timeout == 8) { - /* Reset BitBLT Engine */ - TGUI_STATUS(0x00); - return; - } - } - } -} - -static void -TridentClearSync(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int count = 0, timeout = 0; - int busy; - - for (;;) { - BLTBUSY(busy); - if (busy != GE_BUSY) { - return; - } - count++; - if (count == 10000000) { - ErrorF("Trident: BitBLT engine time-out.\n"); - count = 9990000; - timeout++; - if (timeout == 8) { - /* Reset BitBLT Engine */ - TGUI_STATUS(0x00); - return; - } - } - } -} - -static void -TridentSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int dst = 0; - - pTrident->BltScanDirection = 0; - if (xdir < 0) pTrident->BltScanDirection |= XNEG; - if (ydir < 0) pTrident->BltScanDirection |= YNEG; - - REPLICATE(transparency_color); - if (transparency_color != -1) { - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) { - dst |= (1 << 16); - } else { - TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); - } - TGUI_CKEY(transparency_color); - } - - TGUI_DRAWFLAG(pTrident->DrawFlag | pTrident->BltScanDirection | - SCR2SCR | dst); - TGUI_FMIX(XAAGetCopyROP(rop)); -} - -static void -TridentSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->BltScanDirection & YNEG) { - y1 = y1 + h - 1; - y2 = y2 + h - 1; - } - if (pTrident->BltScanDirection & XNEG) { - x1 = x1 + w - 1; - x2 = x2 + w - 1; - } - TGUI_SRC_XY(x1,y1); - TGUI_DEST_XY(x2, y2); - TGUI_DIM_XY(w, h); - TGUI_COMMAND(GE_BLT); - TridentClearSync(pScrn); -} - -static void -TridentSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->BltScanDirection = 0; - REPLICATE(color); - TGUI_FMIX(XAAGetPatternROP(rop)); - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) { - TGUI_FPATCOL(color); - } else { - TGUI_FCOLOUR(color); - } -} - -static void -TridentSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, int octant) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp = pTrident->BltScanDirection; - - if (octant & YMAJOR) tmp |= YMAJ; - if (octant & XDECREASING) tmp |= XNEG; - if (octant & YDECREASING) tmp |= YNEG; - TGUI_DRAWFLAG(pTrident->DrawFlag | SOLIDFILL | STENCIL | tmp); - TGUI_SRC_XY(dmin-dmaj,dmin); - TGUI_DEST_XY(x, y); - TGUI_DIM_XY(dmin + e, len); - TGUI_COMMAND(GE_BRESLINE); - TridentSync(pScrn); -} - -static void -TridentSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, - int len, int dir) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_DRAWFLAG(pTrident->DrawFlag | SOLIDFILL); - if (dir == DEGREES_0) { - TGUI_DIM_XY(len, 1); - TGUI_DEST_XY(x, y); - } else { - TGUI_DIM_XY(1, len); - TGUI_DEST_XY(x, y); - } - TGUI_COMMAND(GE_BLT); - TridentSync(pScrn); -} - -void -TridentSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD32 *DashPattern = (CARD32*)pattern; - CARD32 NiceDashPattern = DashPattern[0]; - - NiceDashPattern = *((CARD16 *)pattern) & ((1 << length) - 1); - switch(length) { - case 2: NiceDashPattern |= NiceDashPattern << 2; - case 4: NiceDashPattern |= NiceDashPattern << 4; - case 8: NiceDashPattern |= NiceDashPattern << 8; - } - pTrident->BltScanDirection = 0; - REPLICATE(fg); - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) { - TGUI_FPATCOL(fg); - if (bg == -1) { - pTrident->BltScanDirection |= (1 << 12); - TGUI_BPATCOL(~fg); - } else { - REPLICATE(bg); - TGUI_BPATCOL(bg); - } - } else { - TGUI_FCOLOUR(fg); - if (bg == -1) { - pTrident->BltScanDirection |= (1 << 12); - TGUI_BCOLOUR(~fg); - } else { - REPLICATE(bg); - TGUI_BCOLOUR(bg); - } - } - TGUI_FMIX(XAAGetPatternROP(rop)); - pTrident->LinePattern = NiceDashPattern; -} - - -void -TridentSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant, int phase) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp = pTrident->BltScanDirection; - - if (octant & YMAJOR) tmp |= YMAJ; - if (octant & XDECREASING) tmp |= XNEG; - if (octant & YDECREASING) tmp |= YNEG; - - TGUI_STYLE(((pTrident->LinePattern >> phase) | - (pTrident->LinePattern << (16-phase))) & 0x0000FFFF); - TGUI_DRAWFLAG(pTrident->DrawFlag | STENCIL | tmp); - TGUI_SRC_XY(dmin - dmaj, dmin); - TGUI_DEST_XY(x, y); - TGUI_DIM_XY(e + dmin, len); - TGUI_COMMAND(GE_BRESLINE); - TridentSync(pScrn); -} - -static void -TridentSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int drawflag = 0; - - REPLICATE(color); - TGUI_FMIX(XAAGetPatternROP(rop)); - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) { - TGUI_FPATCOL(color); - } else { - drawflag |= PATMONO; - TGUI_FCOLOUR(color); - } - - TGUI_DRAWFLAG(pTrident->DrawFlag | SOLIDFILL | drawflag); -} - -static void -TridentSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_DIM_XY(w, h); - TGUI_DEST_XY(x, y); - TGUI_COMMAND(GE_BLT); - TridentSync(pScrn); -} - -#if 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; - } - - if (!dwords) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 1) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 2) return; - *dest = *src; - dest += 1; - src += 1; -} -#endif - -static void -TridentSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int drawflag = 0; - - REPLICATE(fg); - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) - TGUI_FPATCOL(fg); - else - TGUI_FCOLOUR(fg); - - if (bg == -1) { - drawflag |= (1 << 12); - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) - TGUI_BPATCOL(~fg); - else - TGUI_BCOLOUR(~fg); - } else { - REPLICATE(bg); - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) - TGUI_BPATCOL(bg); - else - TGUI_BCOLOUR(bg); - } - - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) { - drawflag |= (7 << 18); - } - - TGUI_DRAWFLAG(pTrident->DrawFlag | PAT2SCR | PATMONO | drawflag); - TGUI_PATLOC(((patterny * pTrident->PatternLocation) + - (patternx * pScrn->bitsPerPixel / 8)) >> 6); - TGUI_FMIX(XAAGetPatternROP(rop)); -} - -static void -TridentSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_DEST_XY(x, y); - TGUI_DIM_XY(w, h); - TGUI_COMMAND(GE_BLT); - TridentSync(pScrn); -} - -#if 0 -static void -TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int drawflag = 0; - - REPLICATE(transparency_color); - if (transparency_color != -1) { - if ((pTrident->Chipset == PROVIDIA9685) || - (pTrident->Chipset == CYBER9388)) { - drawflag |= (1 << 16); - } else { - TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); - } - - TGUI_CKEY(transparency_color); - } - - TGUI_DRAWFLAG(pTrident->DrawFlag | PAT2SCR | drawflag); - TGUI_PATLOC(((patterny * pTrident->PatternLocation) + - (patternx * pScrn->bitsPerPixel / 8)) >> 6); - TGUI_FMIX(XAAGetPatternROP(rop)); -} - -static void -TridentSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_DEST_XY(x, y); - TGUI_DIM_XY(w, h); - TGUI_COMMAND(GE_BLT); - TridentClearSync(pScrn); -} -#endif - -#if 0 -static void -TridentSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int drawflag = SRCMONO; - - REPLICATE(fg); - TGUI_FCOLOUR(fg); - if (bg == -1) { - drawflag |= (1 << 12); - TGUI_BCOLOUR(~fg); - } else { - REPLICATE(bg); - TGUI_BCOLOUR(bg); - } - - TGUI_SRC_XY(0, 0); - TGUI_DRAWFLAG(drawflag); - TGUI_FMIX(XAAGetCopyROP(rop)); -} - -static void -TridentSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - pTrident->dwords = ((w + 31) >> 5); - pTrident->h = h; - pTrident->y = y; - pTrident->x = x; - pTrident->w = w; - - TGUI_DEST_XY(x, pTrident->y++); - TGUI_DIM_XY(w, 1); - TGUI_COMMAND(GE_BLT); -} - -static void -TridentSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - XAAInfoRecPtr infoRec; - infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - MoveDWORDS((CARD32 *)pTrident->FbBase, - (CARD32 *)pTrident->XAAScanlineColorExpandBuffers[0], - pTrident->dwords); - - pTrident->h--; - TridentSync(pScrn); - if (pTrident->h) { - TGUI_DEST_XY(pTrident->x, pTrident->y++); - TGUI_DIM_XY(pTrident->w, 1); - TGUI_COMMAND(GE_BLT); - } -} -#endif -#endif diff --git a/src/trident.h b/src/trident.h index f8fb3ed..3ae8980 100644 --- a/src/trident.h +++ b/src/trident.h @@ -34,9 +34,6 @@ #include "exa.h" #include "xf86Cursor.h" -#ifdef HAVE_XAA_H -#include "xaa.h" -#endif #include "xf86fbman.h" #include "compiler.h" #include "vgaHW.h" @@ -49,12 +46,7 @@ #include "vbe.h" #include "compat-api.h" -/* Banked framebuffer only supported on ISA */ -#ifdef HAVE_ISA -#define LINEAR() (pTrident->Linear) -#else #define LINEAR() (1) -#endif #define PCI_VENDOR_TRIDENT 0x1023 #define PCI_CHIP_2100 0x2100 @@ -174,17 +166,12 @@ typedef struct { #ifdef VBE_INFO vbeModeInfoPtr vbeModes; #endif -#ifdef HAVE_XAA_H - XAAInfoRecPtr AccelInfoRec; -#endif CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; CreateScreenResourcesProcPtr CreateScreenResources; int panelWidth; int panelHeight; unsigned int (*ddc1Read)(ScrnInfoPtr); - CARD8* XAAScanlineColorExpandBuffers[2]; - CARD8* XAAImageScanlineBuffer[1]; void (*InitializeAccelerator)(ScrnInfoPtr); void (*VideoTimerCallback)(ScrnInfoPtr, Time); XF86VideoAdaptorPtr adaptor; @@ -265,12 +252,7 @@ Bool TVGAInit(ScrnInfoPtr pScrn, DisplayModePtr mode); void TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg); void TridentSave(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg); Bool TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -Bool TridentAccelInit(ScreenPtr pScreen); -Bool XPAccelInit(ScreenPtr pScreen); -Bool XP4XaaInit(ScreenPtr pScreen); Bool XP4ExaInit(ScreenPtr pScreen); -Bool ImageAccelInit(ScreenPtr pScreen); -Bool BladeXaaInit(ScreenPtr pScreen); Bool BladeExaInit(ScreenPtr pScreen); Bool TridentHWCursorInit(ScreenPtr pScreen); int TridentFindMode(int xres, int yres, int depth); @@ -356,12 +338,7 @@ typedef enum { #define IsPciCard (pTrident->pEnt->location.type == BUS_PCI) -#ifdef HAVE_ISA -# define IsPrimaryCard ((xf86IsPrimaryPci(pTrident->PciInfo)) || \ - (xf86IsPrimaryIsa())) -#else # define IsPrimaryCard (xf86IsPrimaryPci(pTrident->PciInfo)) -#endif #define HAS_DST_TRANS ((pTrident->Chipset == PROVIDIA9682) || \ (pTrident->Chipset == PROVIDIA9685) || \ diff --git a/src/trident_dga.c b/src/trident_dga.c index c4b5b9a..005372e 100644 --- a/src/trident_dga.c +++ b/src/trident_dga.c @@ -39,15 +39,6 @@ static Bool TRIDENT_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, static Bool TRIDENT_SetMode(ScrnInfoPtr, DGAModePtr); static int TRIDENT_GetViewport(ScrnInfoPtr); static void TRIDENT_SetViewport(ScrnInfoPtr, int, int, int); -#ifdef HAVE_XAA_H -static void TRIDENT_Sync(ScrnInfoPtr); -static void TRIDENT_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); -static void TRIDENT_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 -static void TRIDENT_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -#endif -#endif static DGAFunctionRec TRIDENTDGAFuncs = { @@ -56,18 +47,7 @@ DGAFunctionRec TRIDENTDGAFuncs = { TRIDENT_SetMode, TRIDENT_SetViewport, TRIDENT_GetViewport, -#ifdef HAVE_XAA_H - TRIDENT_Sync, - TRIDENT_FillRect, - TRIDENT_BlitRect, -#if 0 - TRIDENT_BlitTransRect -#else - NULL -#endif -#else NULL, NULL, NULL -#endif }; Bool @@ -106,10 +86,6 @@ SECOND_PASS: currentMode->mode = pMode; currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; -#ifdef HAVE_XAA_H - if(!pTrident->NoAccel) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; -#endif if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) @@ -223,69 +199,6 @@ TRIDENT_SetViewport( pTrident->DGAViewportStatus = 0; /* TRIDENTAdjustFrame loops until finished */ } -#ifdef HAVE_XAA_H -static void -TRIDENT_FillRect ( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned long color -){ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if(pTrident->AccelInfoRec) { - (*pTrident->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*pTrident->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(pTrident->AccelInfoRec); - } -} - -static void -TRIDENT_Sync( - ScrnInfoPtr pScrn -){ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if(pTrident->AccelInfoRec) { - (*pTrident->AccelInfoRec->Sync)(pScrn); - } -} - -static void -TRIDENT_BlitRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty -){ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if(pTrident->AccelInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pTrident->AccelInfoRec->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, ~0, -1); - (*pTrident->AccelInfoRec->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pTrident->AccelInfoRec); - } -} - -#if 0 -static void -TRIDENT_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 TRIDENT_OpenFramebuffer( ScrnInfoPtr pScrn, diff --git a/src/trident_driver.c b/src/trident_driver.c index 19c1ebf..5475a40 100644 --- a/src/trident_driver.c +++ b/src/trident_driver.c @@ -35,16 +35,9 @@ #include "fb.h" -#ifdef HAVE_ISA -#include "mibank.h" -#endif #include "micmap.h" #include "xf86.h" #include "xf86_OSproc.h" -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 -#include "xf86Resources.h" -#include "xf86RAC.h" -#endif #include "xf86Pci.h" #include "xf86cmap.h" #include "vgaHW.h" @@ -149,20 +142,6 @@ static SymTabRec TRIDENTChipsets[] = { { -1, NULL } }; -#ifdef HAVE_ISA -static IsaChipsets TRIDENTISAchipsets[] = { - { TVGA9000, RES_EXCLUSIVE_VGA }, - { TVGA9000i, RES_EXCLUSIVE_VGA }, - { TVGA8900C, RES_EXCLUSIVE_VGA }, - { TVGA8900D, RES_EXCLUSIVE_VGA }, - { TVGA9200CXr, RES_EXCLUSIVE_VGA }, - { TGUI9400CXi, RES_EXCLUSIVE_VGA }, - { CYBER9320, RES_EXCLUSIVE_VGA }, - { TGUI9440AGi, RES_EXCLUSIVE_VGA }, - { -1, RES_UNDEFINED } -}; -#endif - static PciChipsets TRIDENTPciChipsets[] = { { CYBER9320, PCI_CHIP_9320, RES_SHARED_VGA }, { CYBER9388, PCI_CHIP_9388, RES_SHARED_VGA }, @@ -512,15 +491,6 @@ TRIDENTEnableMMIO(ScrnInfoPtr pScrn) unsigned long vgaIOBase = pTrident->PIOBase + VGAHWPTR(pScrn)->IOBase; CARD8 temp = 0, protect = 0; - /* - * Skip MMIO Enable in PC-9821 PCI Trident Card!! - * Because of lack of non PCI VGA port - */ -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (IsPciCard && xf86IsPc98()) - return; -#endif - /* Goto New Mode */ outb(pTrident->PIOBase + 0x3C4, 0x0B); inb(pTrident->PIOBase + 0x3C5); @@ -556,15 +526,6 @@ TRIDENTDisableMMIO(ScrnInfoPtr pScrn) CARD8 temp = 0, protect = 0; TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - /* - * Skip MMIO Disable in PC-9821 PCI Trident Card!! - * Because of lack of non PCI VGA port - */ -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (IsPciCard && xf86IsPc98()) - return; -#endif - /* Goto New Mode */ OUTB(0x3C4, 0x0B); temp = INB(0x3C5); @@ -591,251 +552,6 @@ TRIDENTDisableMMIO(ScrnInfoPtr pScrn) outb(pTrident->PIOBase + 0x3C5, temp); } -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 -/* Initialize VGA Block for Cyber9385 on PC-98x1 */ -static void -PC98TRIDENT9385Init(ScrnInfoPtr pScrn) -{ - /* Nothing to initialize */ -} - -static void -PC98TRIDENT9385Enable(ScrnInfoPtr pScrn) -{ - outb(0xFAC, 0x02); -} - -static void -PC98TRIDENT9385Disable(ScrnInfoPtr pScrn) -{ - outb(0xFAC, 0x00); -} - -/* Initialize VGA Block for Trident96xx on PC-98x1 */ -static void -PC98TRIDENT96xxInit(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); - CARD8 temp = 0; - - vgaHWProtect(pScrn, TRUE); - - /* Video SusSystem Enable */ - temp = INB(0x3CC); - OUTB(0x3C2, temp | 0xC3); - /* Switch Old */ - OUTB(0x3C4, 0x0B); temp = INB(0x3C5); - OUTW(0x3C4, 0x0B | (temp << 8)); - /* Select Configuration Port 1 */ - OUTB(0x3C4, 0x0E); temp = INB(0x3C5); - OUTW(0x3C4, 0x0E | ((temp | 0x20) << 8)); - - OUTB(0x3C4, 0x0c); - if((INB(0x3C5) & 0x10) == 0x10) - { - OUTB(0x3C4, 0x0E | (temp << 8)); - OUTB(0x94, 0x00); - OUTB(0x102, 0x01); - OUTB(0x94, 0x20); - temp = INB(0x3C3); - OUTB(0x3C3, temp | 0x01); - } else { - OUTB(0x3C4, 0x0E | (temp << 8)); - OUTB(0x46E8, 0x10); - OUTB(0x102, 0x01); - OUTB(0x46E8, 0x08); - } - - INB(0x3DA); - OUTB(0x3C0,0x10); - OUTB(0x3C0,0x41); - - /* Register Unlock */ - vgaHWUnlock(hwp); - OUTB(0x3C4, 0x0B); temp = INB(0x3C5); /* Switch New */ - OUTB(0x3C4, 0x0E); temp = INB(0x3C5); - OUTW(0x3C4, 0x0E | ((temp | 0x80) << 8)); - - /* For Speed Up [Facoor 2 at Xengine] */ - OUTW(0x3D4, 0x3820); /* Command FIFO Register */ - OUTW(0x3D4, 0x2020); /* Command FIFO Register */ - /* Latency Control Registers 0x30 - 0x32 */ - /* Parameter Range 0x00 - 0x0F */ - /* Tune these parameter to avoid GE Timeout */ - OUTW(0x3D4, 0x0E30); /* Display Queue Latency Control */ - /* 8bpp GE No Timeout Parameter 0x0D - 0x0F for PC-9821Xa7 TGUi9680 */ - OUTW(0x3D4, 0x0031); /* Frame Buffer Latency Control */ - OUTW(0x3D4, 0x0032); /* Display & Frame Buffer Latency Control */ - OUTW(0x3D4, 0x213B); /* Clock and Tuning */ - - /* MCLK Init */ - OUTB(0x43C6, 0xAF); OUTB(0x43C7, 0x00); /* 80.0MHz */ -#if 0 - /* Sample MCLKs */ - OUTB(0x43C6, 0xAF); OUTB(0x43C7, 0x00); /* 80.0MHz */ - OUTB(0x43C6, 0xA7); OUTB(0x43C7, 0x00); /* 77.0MHz */ - OUTB(0x43C6, 0x8E); OUTB(0x43C7, 0x00); /* 75.0MHz */ - OUTB(0x43C6, 0x86); OUTB(0x43C7, 0x00); /* 72.0MHz */ - OUTB(0x43C6, 0x8F); OUTB(0x43C7, 0x00); /* 67.2MHz */ - OUTB(0x43C6, 0xD5); OUTB(0x43C7, 0x02); /* 61.6MHz */ -#endif - - /* Register Lock */ - OUTB(0x3C4, 0x0B); temp = INB(0x3C5); /* Switch New */ - OUTB(0x3C4, 0x0E); temp = INB(0x3C5); - OUTW(0x3C4, 0x0E | ((temp & 0x7F) << 8)); - vgaHWLock(hwp); - - vgaHWProtect(pScrn, FALSE); -} - -static void -PC98TRIDENT96xxEnable(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD8 temp = 0; - - outb(0x68, 0x0E); - outb(0x6A, 0x07); - outb(0x6A, 0x8F); - outb(0x6A, 0x06); - - vgaHWProtect(pScrn, TRUE); - - OUTB(0x3D4, 0x23); temp = INB(0x3D5); - OUTW(0x3D4, 0x23 | ((temp & 0xDF) << 8)); - - OUTB(0x3D4, 0x29); temp = INB(0x3D5); - OUTW(0x3D4, 0x29 | ((temp | 0x04) << 8)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp | 0x06)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp | 0x08)); - - OUTB(0x3CE, 0x23); temp = INB(0x3CF); - OUTW(0x3CE, 0x23 | ((temp & 0xFC) << 8)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp | 0x01)); - - OUTB(0x3C4, 0x01); temp = INB(0x3C5); - OUTW(0x3C4, 0x01 | ((temp & 0xEF) << 8)); - - vgaHWProtect(pScrn, FALSE); - - outb(0xFAC, 0x02); -} - -static void -PC98TRIDENT96xxDisable(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD8 temp = 0; - - outb(0xFAC, 0x00); - - vgaHWProtect(pScrn, TRUE); - - OUTB(0x3C4, 0x01); temp = INB(0x3C5); - OUTW(0x3C4, 0x01 | ((temp | 0x10) << 8)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp & 0xFE)); - - OUTB(0x3CE, 0x23); temp = INB(0x3CF); - OUTW(0x3CE, 0x23 | (((temp & 0xFC) | 0x01) << 8)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp & 0xFD)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp & 0xCF)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp & 0xF7)); - - OUTB(0x83C8, 0x04); temp = INB(0x83c6); - OUTB(0x83C8, 0x04); OUTB(0x83c6, (temp & 0xFB)); - - OUTB(0x3D4, 0x29); temp = INB(0x3D5); - OUTW(0x3D4, 0x29 | ((temp & 0xFB) << 8)); - - OUTB(0x3D4, 0x23); temp = INB(0x3D5); - OUTW(0x3D4, 0x23 | ((temp | 0x20) << 8)); - - vgaHWProtect(pScrn, FALSE); - - outb(0x6A, 0x07); - outb(0x6A, 0x8E); - outb(0x6A, 0x06); - outb(0x68, 0x0F); -} - -/* Initialize VGA Block for Trident Chip on PC-98x1 */ -static void -PC98TRIDENTInit(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - switch (pTrident->Chipset) { - case TGUI9660: - case TGUI9680: - case PROVIDIA9682: - PC98TRIDENT96xxInit(pScrn); - break; - case CYBER9320: - case CYBER9385: - PC98TRIDENT9385Init(pScrn); - break; - default: /* Run 96xx code as default */ - PC98TRIDENT96xxInit(pScrn); - break; - } -} - -static void -PC98TRIDENTEnable(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - switch (pTrident->Chipset) { - case TGUI9660: - case TGUI9680: - case PROVIDIA9682: - PC98TRIDENT96xxEnable(pScrn); - break; - case CYBER9320: - case CYBER9385: - PC98TRIDENT9385Enable(pScrn); - break; - default: /* Run 96xx code as default */ - PC98TRIDENT96xxEnable(pScrn); - break; - } -} - -static void -PC98TRIDENTDisable(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - switch (pTrident->Chipset) { - case TGUI9660: - case TGUI9680: - case PROVIDIA9682: - PC98TRIDENT96xxDisable(pScrn); - break; - case CYBER9320: - case CYBER9385: - PC98TRIDENT9385Disable(pScrn); - break; - default: /* Run 96xx code as default */ - PC98TRIDENT96xxDisable(pScrn); - break; - } -} -#endif - /* * This is a terrible hack! If we are on a notebook in a stretched * mode and don't want full screen we use the BIOS to set an unstreched @@ -944,10 +660,7 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) TRIDENTPtr pTrident = TRIDENTPTR(pScrn); TRIDENTRegPtr tridentReg; -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (!xf86IsPc98()) -#endif - WAITFORVSYNC; + WAITFORVSYNC; TridentFindClock(pScrn,mode->Clock); @@ -1039,11 +752,6 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaHWProtect(pScrn, FALSE); -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (xf86IsPc98()) - PC98TRIDENTEnable(pScrn); -#endif - if (pTrident->TVChipset != 0) VIA_TVInit(pScrn); @@ -1231,22 +939,12 @@ TRIDENTLeaveVT(VT_FUNC_ARGS_DECL) TRIDENTPtr pTrident = TRIDENTPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); -#ifdef HAVE_XAA_H - if (!pTrident->NoAccel && !pTrident->useEXA) - pTrident->AccelInfoRec->Sync(pScrn); - else -#endif if (!pTrident->NoAccel && pTrident->useEXA) pTrident->EXADriverPtr->WaitMarker(pScrn->pScreen, 0); TRIDENTRestore(pScrn); vgaHWLock(hwp); -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (xf86IsPc98()) - PC98TRIDENTDisable(pScrn); -#endif - if (IsPciCard && UseMMIO) TRIDENTDisableMMIO(pScrn); } @@ -1463,99 +1161,6 @@ TRIDENTClockSelect(ScrnInfoPtr pScrn, int no) return(TRUE); } -#ifdef HAVE_ISA -static int -TridentFindIsaDevice(GDevPtr dev) -{ - int found = -1; - unsigned char temp, origVal, newVal; - - /* - * Check first that we have a Trident card. - */ - outb(0x3C4, 0x0B); - temp = inb(0x3C5); /* Save old value */ - outb(0x3C4, 0x0B); /* Switch to Old Mode */ - outb(0x3C5, 0x00); - inb(0x3C5); /* Now to New Mode */ - outb(0x3C4, 0x0E); - origVal = inb(0x3C5); - outb(0x3C5, 0x00); - newVal = inb(0x3C5) & 0x0F; - outb(0x3C5, (origVal ^ 0x02)); - - /* - * Is it a Trident card ?? - */ - if (newVal != 2) { - /* - * Nope, so quit - */ - outb(0x3C4, 0x0B); /* Restore value of 0x0B */ - outb(0x3C5, temp); - outb(0x3C4, 0x0E); - outb(0x3C5, origVal); - return found; - } - - outb(0x3C4, 0x0B); - temp = inb(0x3C5); - switch (temp) { - case 0x01: - found = TVGA8800BR; - break; - case 0x02: - found = TVGA8800CS; - break; - case 0x03: - found = TVGA8900B; - break; - case 0x04: - case 0x13: - found = TVGA8900C; - break; - case 0x23: - found = TVGA9000; - break; - case 0x33: - found = TVGA8900D; - break; - case 0x43: - found = TVGA9000i; - break; - case 0x53: - found = TVGA9200CXr; - break; - case 0x63: - found = TVGA9100B; - break; - case 0x73: - case 0xC3: - found = TGUI9420DGi; - break; - case 0x83: - found = TVGA8200LX; - break; - case 0x93: - found = TGUI9400CXi; - break; - case 0xA3: - found = CYBER9320; - break; - case 0xD3: - found = TGUI9660; - break; - case 0xE3: - found = TGUI9440AGi; - break; - case 0xF3: - found = TGUI9430DGi; - break; - } - return found; -} -#endif - /* * Map the framebuffer and MMIO memory. */ @@ -1700,13 +1305,13 @@ GetAccelPitchValues(ScrnInfoPtr pScrn) for (i = 0; i < 4; i++) { n++; - linePitches = xnfrealloc(linePitches, n * sizeof(int)); + linePitches = XNFrealloc(linePitches, n * sizeof(int)); linePitches[n - 1] = lines[i]; } /* Mark the end of the list */ if (n > 0) { - linePitches = xnfrealloc(linePitches, (n + 1) * sizeof(int)); + linePitches = XNFrealloc(linePitches, (n + 1) * sizeof(int)); linePitches[n] = 0; } return linePitches; @@ -1809,39 +1414,6 @@ TRIDENTProbe(DriverPtr drv, int flags) } } -#ifdef HAVE_ISA - /* Isa Bus */ - numUsed = xf86MatchIsaInstances(TRIDENT_NAME,TRIDENTChipsets, - TRIDENTISAchipsets, - drv,TridentFindIsaDevice,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], - TRIDENTISAchipsets,NULL, - NULL,NULL,NULL,NULL))) { - pScrn->driverVersion = TRIDENT_VERSION; - pScrn->driverName = TRIDENT_DRIVER_NAME; - pScrn->name = TRIDENT_NAME; - pScrn->Probe = TRIDENTProbe; - pScrn->PreInit = TRIDENTPreInit; - pScrn->ScreenInit = TRIDENTScreenInit; - pScrn->SwitchMode = TRIDENTSwitchMode; - pScrn->AdjustFrame = TRIDENTAdjustFrame; - pScrn->EnterVT = TRIDENTEnterVT; - pScrn->LeaveVT = TRIDENTLeaveVT; - pScrn->FreeScreen = TRIDENTFreeScreen; - pScrn->ValidMode = TRIDENTValidMode; - foundScreen = TRUE; - } - } - free(usedChips); - } -#endif - free(devSections); return foundScreen; } @@ -1970,11 +1542,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) vgaHWGetIOBase(hwp); vgaIOBase = hwp->IOBase; -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - pTrident->PIOBase = hwp->PIOOffset; -#else - pTrident->PIOBase = 0; -#endif + pTrident->PIOBase = 0; /* was hwp->PIOOffset */ #ifndef XSERVER_LIBPCIACCESS xf86SetOperatingState(resVga, pTrident->pEnt->index, ResUnusedOpr); @@ -2055,13 +1623,9 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) pTrident->useEXA = TRUE; from = X_CONFIG; } - else if (!xf86NameCmp(s, "XAA")) { - pTrident->useEXA = FALSE; - from = X_CONFIG; - } } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n", - pTrident->useEXA ? "EXA" : "XAA"); + pTrident->useEXA ? "EXA" : "none"); pTrident->HWCursor = TRUE; if (xf86ReturnOptValBool(pTrident->Options, OPTION_SW_CURSOR, FALSE)) { @@ -3229,15 +2793,13 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - /* Load XAA if needed */ + /* Load EXA if needed */ if (!pTrident->NoAccel) { if (!pTrident->useEXA) { - if (!xf86LoadSubModule(pScrn, "xaa")) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Falling back to shadowfb\n"); - pTrident->NoAccel = 1; - pTrident->ShadowFB = 1; - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Falling back to shadowfb\n"); + pTrident->NoAccel = 1; + pTrident->ShadowFB = 1; } if (pTrident->useEXA) { @@ -3331,29 +2893,15 @@ TRIDENTCloseScreen(CLOSE_SCREEN_ARGS_DECL) TRIDENTPtr pTrident = TRIDENTPTR(pScrn); if (pScrn->vtSema) { -#ifdef HAVE_XAA_H - if (!pTrident->NoAccel && !pTrident->useEXA) - pTrident->AccelInfoRec->Sync(pScrn); - else -#endif if (!pTrident->NoAccel && pTrident->useEXA) pTrident->EXADriverPtr->WaitMarker(pScreen, 0); -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (xf86IsPc98()) - PC98TRIDENTDisable(pScrn); -#endif - TRIDENTRestore(pScrn); vgaHWLock(hwp); if (IsPciCard && UseMMIO) TRIDENTDisableMMIO(pScrn); TRIDENTUnmapMem(pScrn); } -#ifdef HAVE_XAA_H - if (pTrident->AccelInfoRec) - XAADestroyInfoRec(pTrident->AccelInfoRec); -#endif if (pTrident->EXADriverPtr) { exaDriverFini(pScreen); free(pTrident->EXADriverPtr); @@ -3441,21 +2989,16 @@ TRIDENTScreenInit(SCREEN_INIT_ARGS_DECL) if (!TRIDENTMapMem(pScrn)) return FALSE; -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (!xf86IsPc98()) -#endif - { #ifdef VBE_INFO - if (pTrident->vbeModes) { - pTrident->pVbe = VBEInit(NULL,pTrident->pEnt->index); - pTrident->Int10 = pTrident->pVbe->pInt10; - } else + if (pTrident->vbeModes) { + pTrident->pVbe = VBEInit(NULL,pTrident->pEnt->index); + pTrident->Int10 = pTrident->pVbe->pInt10; + } else #endif - { - if (xf86LoadSubModule(pScrn, "int10")) { - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); - pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); - } + { + if (xf86LoadSubModule(pScrn, "int10")) { + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); + pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); } } @@ -3471,16 +3014,7 @@ TRIDENTScreenInit(SCREEN_INIT_ARGS_DECL) /* Save the current state */ TRIDENTSave(pScrn); - /* - * Some Trident chip on PC-9821 needs setup, - * because VGA chip is not initialized by VGA BIOS. - */ -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (IsPciCard && xf86IsPc98()) { - PC98TRIDENTInit(pScrn); - } else -#endif - tridentSetModeBIOS(pScrn,pScrn->currentMode); + tridentSetModeBIOS(pScrn,pScrn->currentMode); /* Initialise the first mode */ if (!TRIDENTModeInit(pScrn, pScrn->currentMode)) @@ -3597,43 +3131,6 @@ TRIDENTScreenInit(SCREEN_INIT_ARGS_DECL) if (!pTrident->ShadowFB) TRIDENTDGAInit(pScreen); -#ifdef HAVE_ISA - if (!LINEAR()) { - miBankInfoPtr pBankInfo; - - /* Setup the vga banking variables */ - pBankInfo = XNFcallocarray(sizeof(miBankInfoRec),1); - if (pBankInfo == NULL) { - if (pTrident->pVbe) - vbeFree(pTrident->pVbe); - else - xf86FreeInt10(pTrident->Int10); - return FALSE; - } - pBankInfo->pBankA = pTrident->FbBase; - pBankInfo->pBankB = pTrident->FbBase; - pBankInfo->BankSize = 0x10000; - pBankInfo->nBankDepth = (pScrn->depth == 4) ? 1 : pScrn->depth; - - pBankInfo->SetSourceBank = - (miBankProcPtr)TVGA8900SetRead; - pBankInfo->SetDestinationBank = - (miBankProcPtr)TVGA8900SetWrite; - pBankInfo->SetSourceAndDestinationBanks = - (miBankProcPtr)TVGA8900SetReadWrite; - if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY, - pScrn->displayWidth, pBankInfo)) { - free(pBankInfo); - pBankInfo = NULL; - if (pTrident->pVbe) - vbeFree(pTrident->pVbe); - else - xf86FreeInt10(pTrident->Int10); - return FALSE; - } - } -#endif - { BoxRec AvailFBArea; @@ -3672,24 +3169,11 @@ TRIDENTScreenInit(SCREEN_INIT_ARGS_DECL) (pTrident->Chipset == BLADE3D)) { if (pTrident->useEXA) BladeExaInit(pScreen); - else - BladeXaaInit(pScreen); - } else - if ((pTrident->Chipset == CYBERBLADEXP4) || - (pTrident->Chipset == XP5)) { - if (pTrident->useEXA) - XP4ExaInit(pScreen); - else - XP4XaaInit(pScreen); - } else - if ((pTrident->Chipset == BLADEXP) || - (pTrident->Chipset == CYBERBLADEXPAI1)) { - XPAccelInit(pScreen); - } else { - ImageAccelInit(pScreen); - } - } else { - TridentAccelInit(pScreen); + } else if ((pTrident->Chipset == CYBERBLADEXP4) || + (pTrident->Chipset == XP5)) { + if (pTrident->useEXA) + XP4ExaInit(pScreen); + } } xf86SetBackingStore(pScreen); diff --git a/src/trident_video.c b/src/trident_video.c index 7642c05..111bc79 100644 --- a/src/trident_video.c +++ b/src/trident_video.c @@ -1339,11 +1339,6 @@ WaitForVBlank(ScrnInfoPtr pScrn) * full vblank has passed. * - Alan. */ -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - if (!xf86IsPc98()) -#endif - { - WAITFORVSYNC; - WAITFORVSYNC; - } + WAITFORVSYNC; + WAITFORVSYNC; } diff --git a/src/xp4_xaa.c b/src/xp4_xaa.c deleted file mode 100644 index be393f4..0000000 --- a/src/xp4_xaa.c +++ /dev/null @@ -1,618 +0,0 @@ -/* - * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Alan - * Hourihane not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Alan Hourihane makes no representations about the - * suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * CyberBladeXP4 accelerated options. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "xf86Pci.h" - -#include "miline.h" - -#include "trident.h" -#include "trident_regs.h" - -#ifdef HAVE_XAA_H -#include "xaarop.h" - -static void XP4Sync(ScrnInfoPtr pScrn); -#if 0 -static void XP4SetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern); -static void XP4SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant, - int phase); -static void XP4SetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void XP4SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant); -static void XP4SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, - int len, int dir); -#endif -static void XP4SetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void XP4SubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h); -static void XP4SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h); -static void XP4SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color); -static void XP4SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, - unsigned int planemask); -static void XP4SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#if 0 -static void XP4SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void XP4SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -#endif - -static int bpp; -static int ropcode; - -static void -XP4InitializeAccelerator(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int shift; - - /* This forces updating the clipper */ - pTrident->Clipping = TRUE; - - CHECKCLIPPING; - - switch (pScrn->bitsPerPixel) { - case 8: - default: /* Muffle compiler */ - shift = 18; - break; - case 16: - shift = 19; - break; - case 32: - shift = 20; - break; - } - - switch (pScrn->bitsPerPixel) { - case 8: - bpp = 0x40; - break; - case 16: - bpp = 0x41; - break; - case 32: - bpp = 0x42; - break; - } - - MMIO_OUT32(pTrident->IOBase, 0x2154, - (pScrn->displayWidth) << shift); - MMIO_OUT32(pTrident->IOBase, 0x2150, - (pScrn->displayWidth) << shift); -} -#endif - -Bool XP4XaaInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->NoAccel) - return FALSE; - - pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - infoPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; - - pTrident->InitializeAccelerator = XP4InitializeAccelerator; - XP4InitializeAccelerator(pScrn); - - infoPtr->Sync = XP4Sync; - -#if 0 /* TO DO for the XP */ - infoPtr->SolidLineFlags = NO_PLANEMASK; - infoPtr->SetupForSolidLine = XP4SetupForSolidLine; - infoPtr->SolidBresenhamLineErrorTermBits = 12; - infoPtr->SubsequentSolidBresenhamLine = - XP4SubsequentSolidBresenhamLine; - - infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED | - NO_PLANEMASK | - LINE_PATTERN_POWER_OF_2_ONLY; - infoPtr->SetupForDashedLine = XP4SetupForDashedLine; - infoPtr->DashedBresenhamLineErrorTermBits = 12; - infoPtr->SubsequentDashedBresenhamLine = - XP4SubsequentDashedBresenhamLine; - infoPtr->DashPatternMaxLength = 16; -#endif - - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = XP4SetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = XP4SubsequentFillRectSolid; -#if 0 - infoPtr->SubsequentSolidHorVertLine = XP4SubsequentSolidHorVertLine; -#endif - - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; - - infoPtr->SetupForScreenToScreenCopy = - XP4SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - XP4SubsequentScreenToScreenCopy; - - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForMono8x8PatternFill = - XP4SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - XP4SubsequentMono8x8PatternFillRect; - -#if 0 - infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST; - infoPtr->ColorExpandBase = pTrident->D3Base; - infoPtr->ColorExpandRange = pScrn->displayWidth; - - infoPtr->SetupForCPUToScreenColorExpandFill = - XP4SetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - XP4SubsequentCPUToScreenColorExpandFill; -#endif - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -XP4Sync(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int count = 0, timeout = 0; - int busy; - - for (;;) { - BLTBUSY(busy); - if (busy != GE_BUSY) { - return; - } - - count++; - if (count == 10000000) { - ErrorF("XP: BitBLT engine time-out.\n"); - count = 9990000; - timeout++; - if (timeout == 4) { - /* Reset BitBLT Engine */ - TGUI_STATUS(0x00); - return; - } - } - } -} - -static void -XP4SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int dst = 0; - - pTrident->BltScanDirection = 0; - if (xdir < 0) pTrident->BltScanDirection |= XNEG; - if (ydir < 0) pTrident->BltScanDirection |= YNEG; - - REPLICATE(transparency_color); - if (transparency_color != -1) { - dst |= 3<<16; - MMIO_OUT32(pTrident->IOBase, 0x2134, transparency_color); - } - - ropcode = rop; - - MMIO_OUT32(pTrident->IOBase, 0x2128, - pTrident->BltScanDirection | SCR2SCR); -} - -static void -XP4SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->BltScanDirection & YNEG) { - y1 = y1 + h - 1; - y2 = y2 + h - 1; - } - if (pTrident->BltScanDirection & XNEG) { - x1 = x1 + w - 1; - x2 = x2 + w - 1; - } - MMIO_OUT32(pTrident->IOBase, 0x2138, (x2 << 16) | y2); - MMIO_OUT32(pTrident->IOBase, 0x213C, (x1 << 16) | y1); - MMIO_OUT32(pTrident->IOBase, 0x2140, (w << 16) | h); - XP4Sync(pScrn); - MMIO_OUT32(pTrident->IOBase, 0x2124, - (XAAGetCopyROP(ropcode) << 24) | - (bpp << 8) | - 1); -} - -#if 0 -static void -XP4SetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->BltScanDirection = 0; - REPLICATE(color); - TGUI_FMIX(XAAPatternROP[rop]); - if (pTrident->Chipset >= PROVIDIA9685) { - TGUI_FPATCOL(color); - } else { - TGUI_FCOLOUR(color); - } -} - -static void -XP4SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, int octant) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp = pTrident->BltScanDirection; - - if (octant & YMAJOR) tmp |= YMAJ; - if (octant & XDECREASING) tmp |= XNEG; - if (octant & YDECREASING) tmp |= YNEG; - TGUI_DRAWFLAG(SOLIDFILL | STENCIL | tmp); - XP_SRC_XY(dmin - dmaj, dmin); - XP_DEST_XY(x, y); - XP_DIM_XY(dmin + e, len); - TGUI_COMMAND(GE_BRESLINE); - XP4Sync(pScrn); -} - -static void -XP4SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, - int len, int dir) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_DRAWFLAG(SOLIDFILL); - if (dir == DEGREES_0) { - XP_DIM_XY(len, 1); - XP_DEST_XY(x, y); - } else { - XP_DIM_XY(1, len); - XP_DEST_XY(x, y); - } - - TGUI_COMMAND(GE_BLT); - XP4Sync(pScrn); -} - -void -XP4SetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD32 *DashPattern = (CARD32*)pattern; - CARD32 NiceDashPattern = DashPattern[0]; - - NiceDashPattern = *((CARD16 *)pattern) & ((1 << length) - 1); - switch(length) { - case 2: NiceDashPattern |= NiceDashPattern << 2; - case 4: NiceDashPattern |= NiceDashPattern << 4; - case 8: NiceDashPattern |= NiceDashPattern << 8; - } - pTrident->BltScanDirection = 0; - REPLICATE(fg); - if (pTrident->Chipset >= PROVIDIA9685) { - TGUI_FPATCOL(fg); - if (bg == -1) { - pTrident->BltScanDirection |= (1 << 12); - TGUI_BPATCOL(~fg); - } else { - REPLICATE(bg); - TGUI_BPATCOL(bg); - } - } else { - TGUI_FCOLOUR(fg); - if (bg == -1) { - pTrident->BltScanDirection |= (1 << 12); - TGUI_BCOLOUR(~fg); - } else { - REPLICATE(bg); - TGUI_BCOLOUR(bg); - } - } - - TGUI_FMIX(XAAPatternROP[rop]); - pTrident->LinePattern = NiceDashPattern; -} - -void -XP4SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant, int phase) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp = pTrident->BltScanDirection; - - if (octant & YMAJOR) tmp |= YMAJ; - if (octant & XDECREASING) tmp |= XNEG; - if (octant & YDECREASING) tmp |= YNEG; - - TGUI_STYLE(((pTrident->LinePattern >> phase) | - (pTrident->LinePattern << (16 - phase))) & 0x0000FFFF); - TGUI_DRAWFLAG(STENCIL | tmp); - XP_SRC_XY(dmin - dmaj, dmin); - XP_DEST_XY(x, y); - XP_DIM_XY(e + dmin, len); - TGUI_COMMAND(GE_BRESLINE); - XP4Sync(pScrn); -} -#endif - -static void -XP4SetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - ropcode = rop; - - REPLICATE(color); - MMIO_OUT32(pTrident->IOBase, 0x2158, color); - MMIO_OUT32(pTrident->IOBase, 0x2128, 1 << 14); -} - -static void -XP4SubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - MMIO_OUT32(pTrident->IOBase, 0x2138, (x << 16) | y); - MMIO_OUT32(pTrident->IOBase, 0x2140, (w << 16) | h); - XP4Sync(pScrn); - MMIO_OUT32(pTrident->IOBase, 0x2124, - (XAAGetPatternROP(ropcode) << 24) | - (bpp << 8) | - 2); -} - -#if 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; - } - - if (!dwords) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 1) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 2) return; - *dest = *src; - dest += 1; - src += 1; -} -#endif - -#if 0 -static void -MoveDWORDS_FixedBase(register CARD32* dest, - register CARD32* src, - register int dwords) -{ - while(dwords & ~0x03) { - *dest = *src; - *dest = *(src + 1); - *dest = *(src + 2); - *dest = *(src + 3); - dwords -= 4; - src += 4; - } - - if(!dwords) return; - *dest = *src; - if(dwords == 1) return; - *dest = *(src + 1); - if(dwords == 2) return; - *dest = *(src + 2); -} -#endif - -static void -XP4SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int drawflag = 0; - - REPLICATE(fg); - MMIO_OUT32(pTrident->IOBase, 0x2158, fg); - - if (bg == -1) { - drawflag |= (1 << 12); - MMIO_OUT32(pTrident->IOBase, 0x215C, ~fg); - } else { - REPLICATE(bg); - MMIO_OUT32(pTrident->IOBase, 0x215C, bg); - } - - ropcode = rop; - - drawflag |= (7 << 18); - TGUI_DRAWFLAG(PATMONO | drawflag); -} - -static void -XP4SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - MMIO_OUT32(pTrident->IOBase, 0x2180, patternx); - MMIO_OUT32(pTrident->IOBase, 0x2184, patterny); - MMIO_OUT32(pTrident->IOBase, 0x2138, (x << 16) | y); - MMIO_OUT32(pTrident->IOBase, 0x2140, (w << 16) | h); - XP4Sync(pScrn); - MMIO_OUT32(pTrident->IOBase, 0x2124, - (XAAGetPatternROP(ropcode) << 24) | - (bpp << 8) | - 2); -} - -#if 0 -static void -XP4SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - ropcode = XAAGetCopyROP(rop); -#if 0 - TGUI_FMIX(XAACopyROP[rop]); -#endif - if (bg == -1) { - TGUI_DRAWFLAG(SRCMONO | (1 << 12)); - REPLICATE(fg); - TGUI_FCOLOUR(fg); - } else { - TGUI_DRAWFLAG(SRCMONO); - REPLICATE(fg); - REPLICATE(bg); - TGUI_FCOLOUR(fg); - TGUI_BCOLOUR(bg); - } -} - -static void -XP4SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - MMIO_OUT32(pTrident->IOBase, 0x2138, (x << 16) | y); - MMIO_OUT32(pTrident->IOBase, 0x2140, (w << 16) | h); - XP4Sync(pScrn); - MMIO_OUT32(pTrident->IOBase, 0x2124, (ropcode << 24) | - (bpp << 8) | - 2); -} -#endif -#endif diff --git a/src/xp_xaa.c b/src/xp_xaa.c deleted file mode 100644 index 7f41a9b..0000000 --- a/src/xp_xaa.c +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Alan - * Hourihane not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Alan Hourihane makes no representations about the - * suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * BladeXP accelerated options. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" - -#include "xf86Pci.h" - -#include "miline.h" - -#include "trident.h" -#include "trident_regs.h" - -#ifdef HAVE_XAA_H -#include "xaarop.h" - -static void XPSync(ScrnInfoPtr pScrn); -#if 0 -static void XPSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern); -static void XPSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant, int phase); -static void XPSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void XPSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant); -#endif -static void XPSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, - int len, int dir); -static void XPSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask); -static void XPSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h); -static void XPSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h); -static void XPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color); -static void XPSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, - unsigned int planemask); -static void XPSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#if 0 -static void XPSetupForScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void XPSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void XPSubsequentColorExpandScanline(ScrnInfoPtr pScrn, - int bufno); -#endif - -static void -XPInitializeAccelerator(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int shift; - - /* This forces updating the clipper */ - pTrident->Clipping = TRUE; - - CHECKCLIPPING; - - BLADE_XP_OPERMODE(pTrident->EngineOperation); - pTrident->EngineOperation |= 0x40; - switch (pScrn->bitsPerPixel) { - case 8: - default: /* Muffle compiler */ - shift = 18; - break; - case 16: - shift = 19; - break; - case 32: - shift = 20; - break; - } - - MMIO_OUT32(pTrident->IOBase, 0x2154, - (pScrn->displayWidth) << shift); - MMIO_OUT32(pTrident->IOBase, 0x2150, - (pScrn->displayWidth) << shift); - MMIO_OUT8(pTrident->IOBase, 0x2126, 3); -} -#endif - -Bool XPAccelInit(ScreenPtr pScreen) { -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->NoAccel) - return FALSE; - - pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - infoPtr->Flags = PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; - - pTrident->InitializeAccelerator = XPInitializeAccelerator; - XPInitializeAccelerator(pScrn); - - infoPtr->Sync = XPSync; - -#if 0 /* TO DO for the XP */ - infoPtr->SolidLineFlags = NO_PLANEMASK; - infoPtr->SetupForSolidLine = XPSetupForSolidLine; - infoPtr->SolidBresenhamLineErrorTermBits = 12; - infoPtr->SubsequentSolidBresenhamLine = - XPSubsequentSolidBresenhamLine; - - infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED | - NO_PLANEMASK | - LINE_PATTERN_POWER_OF_2_ONLY; - infoPtr->SetupForDashedLine = XPSetupForDashedLine; - infoPtr->DashedBresenhamLineErrorTermBits = 12; - infoPtr->SubsequentDashedBresenhamLine = - XPSubsequentDashedBresenhamLine; - infoPtr->DashPatternMaxLength = 16; -#endif - - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = XPSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = XPSubsequentFillRectSolid; - infoPtr->SubsequentSolidHorVertLine = XPSubsequentSolidHorVertLine; - - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | - NO_TRANSPARENCY; - - infoPtr->SetupForScreenToScreenCopy = - XPSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - XPSubsequentScreenToScreenCopy; - - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForMono8x8PatternFill = - XPSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - XPSubsequentMono8x8PatternFillRect; - -#if 0 /* Needs fixing */ - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST; - - pTrident->XAAScanlineColorExpandBuffers[0] = - XNFalloc(((pScrn->virtualX + 63)) * - 4 * (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers = - pTrident->XAAScanlineColorExpandBuffers; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - XPSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - XPSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - XPSubsequentColorExpandScanline; -#endif - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -XPSync(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int count = 0, timeout = 0; - int busy; - - BLADE_XP_OPERMODE(pTrident->EngineOperation); - - for (;;) { - BLTBUSY(busy); - if (busy != GE_BUSY) { - return; - } - - count++; - if (count == 10000000) { - ErrorF("XP: BitBLT engine time-out.\n"); - count = 9990000; - timeout++; - if (timeout == 8) { - /* - * Reset BitBLT Engine. - */ - TGUI_STATUS(0x00); - return; - } - } - } -} - -static void -XPClearSync(ScrnInfoPtr pScrn) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int count = 0, timeout = 0; - int busy; - - for (;;) { - BLTBUSY(busy); - if (busy != GE_BUSY) { - return; - } - - count++; - if (count == 10000000) { - ErrorF("XP: BitBLT engine time-out.\n"); - count = 9990000; - timeout++; - if (timeout == 8) { - /* - * Reset BitBLT Engine. - */ - TGUI_STATUS(0x00); - return; - } - } - } -} - -static void -XPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int dst = 0; - - pTrident->BltScanDirection = 0; - if (xdir < 0) pTrident->BltScanDirection |= XNEG; - if (ydir < 0) pTrident->BltScanDirection |= YNEG; - - REPLICATE(transparency_color); - if (transparency_color != -1) { - dst |= (3 << 16); - MMIO_OUT32(pTrident->IOBase, 0x2134, transparency_color); - } - - TGUI_DRAWFLAG(pTrident->BltScanDirection | SCR2SCR | dst); - TGUI_FMIX(XAAGetCopyROP(rop)); -} - -static void -XPSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - if (pTrident->BltScanDirection & YNEG) { - y1 = y1 + h - 1; - y2 = y2 + h - 1; - } - - if (pTrident->BltScanDirection & XNEG) { - x1 = x1 + w - 1; - x2 = x2 + w - 1; - } - - XP_SRC_XY(x1,y1); - XP_DEST_XY(x2,y2); - XP_DIM_XY(w,h); - TGUI_COMMAND(GE_BLT); - XPClearSync(pScrn); -} - -#if 0 -static void -XPSetupForSolidLine(ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - pTrident->BltScanDirection = 0; - REPLICATE(color); - TGUI_FMIX(XAAGetPatternROP(rop)); - if (pTrident->Chipset >= PROVIDIA9685) { - TGUI_FPATCOL(color); - } else { - TGUI_FCOLOUR(color); - } -} - -static void -XPSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp = pTrident->BltScanDirection; - - if (octant & YMAJOR) tmp |= YMAJ; - if (octant & XDECREASING) tmp |= XNEG; - if (octant & YDECREASING) tmp |= YNEG; - TGUI_DRAWFLAG(SOLIDFILL | STENCIL | tmp); - XP_SRC_XY(dmin - dmaj, dmin); - XP_DEST_XY(x, y); - XP_DIM_XY(dmin + e, len); - TGUI_COMMAND(GE_BRESLINE); - XPSync(pScrn); -} -#endif - -static void -XPSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, - int len, int dir) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_DRAWFLAG(SOLIDFILL); - if (dir == DEGREES_0) { - XP_DIM_XY(len, 1); - XP_DEST_XY(x, y); - } else { - XP_DIM_XY(1, len); - XP_DEST_XY(x, y); - } - - TGUI_COMMAND(GE_BLT); - XPSync(pScrn); -} - -#if 0 -void -XPSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask, - int length, - unsigned char *pattern) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - CARD32 *DashPattern = (CARD32*)pattern; - CARD32 NiceDashPattern = DashPattern[0]; - - NiceDashPattern = *((CARD16 *)pattern) & ((1 << length) - 1); - switch(length) { - case 2: NiceDashPattern |= NiceDashPattern << 2; - case 4: NiceDashPattern |= NiceDashPattern << 4; - case 8: NiceDashPattern |= NiceDashPattern << 8; - } - - pTrident->BltScanDirection = 0; - REPLICATE(fg); - if (pTrident->Chipset >= PROVIDIA9685) { - TGUI_FPATCOL(fg); - if (bg == -1) { - pTrident->BltScanDirection |= (1 << 12); - TGUI_BPATCOL(~fg); - } else { - REPLICATE(bg); - TGUI_BPATCOL(bg); - } - } else { - TGUI_FCOLOUR(fg); - if (bg == -1) { - pTrident->BltScanDirection |= (1 << 12); - TGUI_BCOLOUR(~fg); - } else { - REPLICATE(bg); - TGUI_BCOLOUR(bg); - } - } - - TGUI_FMIX(XAAGetPatternROP(rop)); - pTrident->LinePattern = NiceDashPattern; -} - -void -XPSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, - int octant, int phase) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int tmp = pTrident->BltScanDirection; - - if (octant & YMAJOR) tmp |= YMAJ; - if (octant & XDECREASING) tmp |= XNEG; - if (octant & YDECREASING) tmp |= YNEG; - - TGUI_STYLE(((pTrident->LinePattern >> phase) | - (pTrident->LinePattern << (16 - phase))) & - 0x0000FFFF); - TGUI_DRAWFLAG(STENCIL | tmp); - XP_SRC_XY(dmin - dmaj, dmin); - XP_DEST_XY(x, y); - XP_DIM_XY(e + dmin, len); - TGUI_COMMAND(GE_BRESLINE); - XPSync(pScrn); -} -#endif - -static void -XPSetupForFillRectSolid(ScrnInfoPtr pScrn, - int color, - int rop, unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - REPLICATE(color); - TGUI_FMIX(XAAGetPatternROP(rop)); - MMIO_OUT32(pTrident->IOBase, 0x2158, color); - TGUI_DRAWFLAG(SOLIDFILL); -} - -static void -XPSubsequentFillRectSolid(ScrnInfoPtr pScrn, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - XP_DIM_XY(w, h); - XP_DEST_XY(x, y); - TGUI_COMMAND(GE_BLT); - XPSync(pScrn); -} - -#if 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; - } - - if (!dwords) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 1) return; - *dest = *src; - dest += 1; - src += 1; - if (dwords == 2) return; - *dest = *src; - dest += 1; - src += 1; -} -#endif - -#if 0 -static void -MoveDWORDS_FixedBase(register CARD32* dest, - register CARD32* src, - register int dwords) -{ - while(dwords & ~0x03) { - *dest = *src; - *dest = *(src + 1); - *dest = *(src + 2); - *dest = *(src + 3); - dwords -= 4; - src += 4; - } - - if(!dwords) return; - *dest = *src; - if(dwords == 1) return; - *dest = *(src + 1); - if(dwords == 2) return; - *dest = *(src + 2); -} -#endif - -static void -XPSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - int drawflag = 0; - - REPLICATE(fg); - MMIO_OUT32(pTrident->IOBase, 0x2158, fg); - - if (bg == -1) { - drawflag |= (1 << 12); - MMIO_OUT32(pTrident->IOBase, 0x215C, ~fg); - } else { - REPLICATE(bg); - MMIO_OUT32(pTrident->IOBase, 0x215C, bg); - } - - drawflag |= (7 << 18); - TGUI_DRAWFLAG(PATMONO | drawflag); - MMIO_OUT32(pTrident->IOBase, 0x2180, patternx); - MMIO_OUT32(pTrident->IOBase, 0x2184, patterny); - TGUI_FMIX(XAAGetPatternROP(rop)); -} - -static void -XPSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - XP_DEST_XY(x, y); - XP_DIM_XY(w, h); - TGUI_COMMAND(GE_BLT); - XPSync(pScrn); -} - -#if 0 -static void -XPSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - - TGUI_FMIX(XAAGetCopyROP(rop)); - if (bg == -1) { - TGUI_DRAWFLAG(SRCMONO | (1 << 12)); - REPLICATE(fg); - TGUI_FCOLOUR(fg); - } else { - TGUI_DRAWFLAG(SRCMONO); - REPLICATE(fg); - REPLICATE(bg); - TGUI_FCOLOUR(fg); - TGUI_BCOLOUR(bg); - } -} - -static void -XPSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - pTrident->dwords = (w + 31) >> 5; - pTrident->h = h; - - XP_DEST_XY(x, y); - XP_DIM_XY(w >> 1, h); - TGUI_COMMAND(GE_BLT); -} - -static void -XPSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - TRIDENTPtr pTrident = TRIDENTPTR(pScrn); - XAAInfoRecPtr infoRec; - infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - - MoveDWORDS_FixedBase((CARD32 *)pTrident->IOBase + 0x2160, - (CARD32 *)pTrident->XAAScanlineColorExpandBuffers[0], - pTrident->dwords); - - pTrident->h--; - if (pTrident->h) - XPSync(pScrn); -} -#endif -#endif |