diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/neo.h | 19 | ||||
-rw-r--r-- | src/neo_2070.c | 271 | ||||
-rw-r--r-- | src/neo_2090.c | 371 | ||||
-rw-r--r-- | src/neo_2097.c | 553 | ||||
-rw-r--r-- | src/neo_2200.c | 657 | ||||
-rw-r--r-- | src/neo_dga.c | 85 | ||||
-rw-r--r-- | src/neo_driver.c | 145 |
8 files changed, 5 insertions, 2100 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index ac7fa23..a6071ec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,10 +29,6 @@ neomagic_drv_la_LDFLAGS = -module -avoid-version neomagic_drv_ladir = @moduledir@/drivers neomagic_drv_la_SOURCES = \ - neo_2070.c \ - neo_2090.c \ - neo_2097.c \ - neo_2200.c \ neo_cursor.c \ neo_dga.c \ neo_driver.c \ @@ -46,10 +46,6 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Everything using inb/outb, etc needs "compiler.h" */ #include "compiler.h" -#ifdef HAVE_XAA_H -#include "xaa.h" -#include "xaalocal.h" /* XAA internals as we replace some of XAA */ -#endif #include "xf86fbman.h" #include "xf86Cursor.h" @@ -93,18 +89,6 @@ typedef enum { extern Bool NEOSwitchMode(SWITCH_MODE_ARGS_DECL); extern void NEOAdjustFrame(ADJUST_FRAME_ARGS_DECL); -/* in neo_2070.c */ -extern Bool Neo2070AccelInit(ScreenPtr pScreen); - -/* in neo_2090.c */ -extern Bool Neo2090AccelInit(ScreenPtr pScreen); - -/* in neo_2097.c */ -extern Bool Neo2097AccelInit(ScreenPtr pScreen); - -/* in neo_2200.c */ -extern Bool Neo2200AccelInit(ScreenPtr pScreen); - /* in neo_cursor.c */ extern Bool NeoCursorInit(ScreenPtr pScrn); extern void NeoShowCursor(ScrnInfoPtr pScrn); @@ -205,9 +189,6 @@ typedef struct neoRec PCITAG PciTag; #endif EntityInfoPtr pEnt; -#ifdef HAVE_XAA_H - XAAInfoRecPtr AccelInfoRec; -#endif NEOACLRec Accel; unsigned long NeoMMIOAddr; unsigned long NeoLinearAddr; diff --git a/src/neo_2070.c b/src/neo_2070.c deleted file mode 100644 index e57fd17..0000000 --- a/src/neo_2070.c +++ /dev/null @@ -1,271 +0,0 @@ -/********************************************************************** -Copyright 1998, 1999 by Precision Insight, Inc., Cedar Park, Texas. - - All Rights Reserved - -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 Precision Insight not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. Precision Insight -and its suppliers make no representations about the suitability of this -software for any purpose. It is provided "as is" without express or -implied warranty. - -PRECISION INSIGHT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. -**********************************************************************/ - -/* - * The original Precision Insight driver for - * XFree86 v.3.3 has been sponsored by Red Hat. - * - * Authors: - * Jens Owen (jens@tungstengraphics.com) - * Kevin E. Martin (kevin@precisioninsight.com) - * - * Port to Xfree86 v.4.0 - * 1998, 1999 by Egbert Eich (Egbert.Eich@Physik.TU-Darmstadt.DE) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "compiler.h" - -/* Drivers that use XAA need this */ -#include "xf86fbman.h" - -#include "miline.h" - -#include "neo.h" -#include "neo_reg.h" -#include "neo_macros.h" - -#ifdef HAVE_XAA_H -/* Memory Mapped I/O for BitBlt */ -#define NEO2070_BLTSTAT 0x00 -#define NEO2070_BLTCNTL 0x04 -#define NEO2070_XPCOLOR 0x08 -#define NEO2070_FGCOLOR 0x0c -#define NEO2070_BGCOLOR 0x10 -#define NEO2070_PLANEMASK 0x14 -#define NEO2070_XYEXT 0x18 -#define NEO2070_SRCPITCH 0x1c -#define NEO2070_SRCBITOFF 0x20 -#define NEO2070_SRCSTART 0x24 -#define NEO2070_DSTPITCH 0x28 -#define NEO2070_DSTBITOFF 0x2c -#define NEO2070_DSTSTART 0x30 - -static unsigned int neo2070Rop[16] = { - 0x000000, /* 0x0000 - GXclear */ - 0x080000, /* 0x1000 - GXand */ - 0x040000, /* 0x0100 - GXandReverse */ - 0x0c0000, /* 0x1100 - GXcopy */ - 0x020000, /* 0x0010 - GXandInvert */ - 0x0a0000, /* 0x1010 - GXnoop */ - 0x060000, /* 0x0110 - GXxor */ - 0x0e0000, /* 0x1110 - GXor */ - 0x010000, /* 0x0001 - GXnor */ - 0x090000, /* 0x1001 - GXequiv */ - 0x050000, /* 0x0101 - GXinvert */ - 0x0d0000, /* 0x1101 - GXorReverse */ - 0x030000, /* 0x0011 - GXcopyInvert */ - 0x0b0000, /* 0x1011 - GXorInverted */ - 0x070000, /* 0x0111 - GXnand */ - 0x0f0000 /* 0x1111 - GXset */ -}; - -static void Neo2070Sync(ScrnInfoPtr pScrn); -static void Neo2070SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, - int ydir, int rop, - unsigned int planemask, - int trans_color); -static void Neo2070SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, - int srcY, int dstX, int dstY, - int w, int h); -static void Neo2070SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void Neo2070SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h); - -#endif - -Bool -Neo2070AccelInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if(!infoPtr) return FALSE; - - /* - * Set up the main acceleration flags. - */ - infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; - if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE; -#if 0 - infoPtr->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES; -#endif - /* sync */ - infoPtr->Sync = Neo2070Sync; - - /* screen to screen copy */ - infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | GXCOPY_ONLY); - infoPtr->SetupForScreenToScreenCopy = - Neo2070SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - Neo2070SubsequentScreenToScreenCopy; - - /* solid filled rectangles */ - infoPtr->SolidFillFlags = GXCOPY_ONLY; - infoPtr->SetupForSolidFill = - Neo2070SetupForSolidFillRect; - infoPtr->SubsequentSolidFillRect = - Neo2070SubsequentSolidFillRect; - - /* - * Setup some global variables - */ - - /* Initialize for 8bpp or 15/16bpp support accelerated */ - switch (pScrn->bitsPerPixel) { - case 8: - nAcl->BltCntlFlags = NEO_BC1_DEPTH8; - nAcl->ColorShiftAmt = 8; - nAcl->PixelWidth = 1; - nAcl->PlaneMask = 0xff; - break; - case 15: - case 16: - nAcl->BltCntlFlags = NEO_BC1_DEPTH16; - nAcl->ColorShiftAmt = 0; - nAcl->PixelWidth = 2; - nAcl->PlaneMask = 0xffff; - break; - case 24: /* not supported, but check anyway */ - default: - return FALSE; - } - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -Neo2070Sync(ScrnInfoPtr pScrn) -{ - NEOPtr nPtr = NEOPTR(pScrn); - WAIT_ENGINE_IDLE(); -} - -static void -Neo2070SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, - unsigned int planemask, - int trans_color) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - /* set blt control */ - WAIT_ENGINE_IDLE(); - OUTREG(NEO2070_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEO2070_PLANEMASK, planemask |= (planemask << nAcl->ColorShiftAmt)); - OUTREG(NEO2070_SRCPITCH, nAcl->Pitch); - OUTREG(NEO2070_DSTPITCH, nAcl->Pitch); - OUTREG(NEO2070_SRCBITOFF, 0); - OUTREG(NEO2070_DSTBITOFF, 0); -} - -static void -Neo2070SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int srcX, int srcY, - int dstX, int dstY, - int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - /* start with upper left corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEO2070_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEO2070_XYEXT, ((h-1)<<16) | ((w-1) & 0xffff)); - OUTREG(NEO2070_SRCSTART, - (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth)); - OUTREG(NEO2070_DSTSTART, - (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth)); - } - else { - /* start with lower right corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEO2070_BLTCNTL, (nAcl->tmpBltCntlFlags | NEO_BC0_X_DEC - | NEO_BC0_DST_Y_DEC - | NEO_BC0_SRC_Y_DEC)); - OUTREG(NEO2070_XYEXT, ((h-1)<<16) | ((w-1) & 0xffff)); - OUTREG(NEO2070_SRCSTART, - ((srcY+h-1) * nAcl->Pitch) + ((srcX+w-1) * nAcl->PixelWidth)); - OUTREG(NEO2070_DSTSTART, - ((dstY+h-1) * nAcl->Pitch) + ((dstX+w-1) * nAcl->PixelWidth)); - } -} - - -static void -Neo2070SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - planemask &= nAcl->PlaneMask; - if (!rop) color=0; - - WAIT_ENGINE_IDLE(); - - OUTREG(NEO2070_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SRC_IS_FG | neo2070Rop[3]); - OUTREG(NEO2070_PLANEMASK, planemask |= (planemask << nAcl->ColorShiftAmt)); - if (pScrn->bitsPerPixel == 8) - OUTREG(NEO2070_FGCOLOR, color |= (color << 8)); - else - /* swap bytes in color */ - OUTREG(NEO2070_FGCOLOR, ((color&0xff00) >> 8) | (color << 8)); - OUTREG(NEO2070_SRCPITCH, nAcl->Pitch); - OUTREG(NEO2070_DSTPITCH, nAcl->Pitch); - OUTREG(NEO2070_SRCBITOFF, 0); - OUTREG(NEO2070_DSTBITOFF, 0); -} - - -static void -Neo2070SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - WAIT_ENGINE_IDLE(); - OUTREG(NEO2070_XYEXT, ((h-1)<<16) | ((w-1) & 0xffff)); - OUTREG(NEO2070_DSTSTART, (y * nAcl->Pitch) + (x * nAcl->PixelWidth)); -} -#endif - diff --git a/src/neo_2090.c b/src/neo_2090.c deleted file mode 100644 index 9f28436..0000000 --- a/src/neo_2090.c +++ /dev/null @@ -1,371 +0,0 @@ -/********************************************************************** -Copyright 1998, 1999 by Precision Insight, Inc., Cedar Park, Texas. - - All Rights Reserved - -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 Precision Insight not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. Precision Insight -and its suppliers make no representations about the suitability of this -software for any purpose. It is provided "as is" without express or -implied warranty. - -PRECISION INSIGHT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. -**********************************************************************/ - -/* - * The original Precision Insight driver for - * XFree86 v.3.3 has been sponsored by Red Hat. - * - * Authors: - * Jens Owen (jens@tungstengraphics.com) - * Kevin E. Martin (kevin@precisioninsight.com) - * - * Port to Xfree86 v.4.0 - * 1998, 1999 by Egbert Eich (Egbert.Eich@Physik.TU-Darmstadt.DE) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "compiler.h" - -/* Drivers that use XAA need this */ -#include "xf86fbman.h" - -#include "miline.h" - -#include "neo.h" -#include "neo_reg.h" -#include "neo_macros.h" - -#ifdef HAVE_XAA_H -static unsigned int neo2090Rop[16] = { - 0x000000, /* 0x0000 - GXclear */ - 0x080000, /* 0x1000 - GXand */ - 0x040000, /* 0x0100 - GXandReverse */ - 0x0c0000, /* 0x1100 - GXcopy */ - 0x020000, /* 0x0010 - GXandInvert */ - 0x0a0000, /* 0x1010 - GXnoop */ - 0x060000, /* 0x0110 - GXxor */ - 0x0e0000, /* 0x1110 - GXor */ - 0x010000, /* 0x0001 - GXnor */ - 0x090000, /* 0x1001 - GXequiv */ - 0x050000, /* 0x0101 - GXinvert */ - 0x0d0000, /* 0x1101 - GXorReverse */ - 0x030000, /* 0x0011 - GXcopyInvert */ - 0x0b0000, /* 0x1011 - GXorInverted */ - 0x070000, /* 0x0111 - GXnand */ - 0x0f0000 /* 0x1111 - GXset */ -}; - -static void Neo2090Sync(ScrnInfoPtr pScrn); -static void Neo2090SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, - int ydir, int rop, - unsigned int planemask, - int trans_color); -static void Neo2090SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, - int srcY, int dstX, int dstY, - int w, int h); -static void Neo2090SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void Neo2090SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h); -static void Neo2093SetupForScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void Neo2093SubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void Neo2093SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -#endif -Bool -Neo2090AccelInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if(!infoPtr) return FALSE; - - /* - * Set up the main acceleration flags. - */ - infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; - if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE; -#if 0 - infoPtr->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES; -#endif - /* sync */ - infoPtr->Sync = Neo2090Sync; - - /* screen to screen copy */ - infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | NO_PLANEMASK); - infoPtr->SetupForScreenToScreenCopy = - Neo2090SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - Neo2090SubsequentScreenToScreenCopy; - - /* solid filled rectangles */ - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = - Neo2090SetupForSolidFillRect; - infoPtr->SubsequentSolidFillRect = - Neo2090SubsequentSolidFillRect; - - if (nPtr->NeoChipset == PCI_CHIP_NM2093 && !nPtr->strangeLockups) { - /* - * We do CPUToScreenColorExpand (ab)using the Scanline functions: - * the neo chipsets need byte padding however we can only do dword - * padding. Fortunately the graphics engine doesn't choke if we - * transfer up to 3 bytes more than it wants. - */ - - /* cpu to screen color expansion */ - infoPtr->ScanlineColorExpandBuffers = - (unsigned char **)XNFalloc(sizeof(char*)); - infoPtr->ScanlineColorExpandBuffers[0] = - (unsigned char *)(nPtr->NeoMMIOBase + 0x100000); - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK | - SCANLINE_PAD_DWORD | - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST ); - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - Neo2093SetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - Neo2093SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - Neo2093SubsequentColorExpandScanline; - } - - /* - * Setup some global variables - */ - nAcl->ColorShiftAmt = 0; - - /* Initialize for 8bpp or 15/16bpp support accelerated */ - switch (pScrn->bitsPerPixel) { - case 8: - nAcl->BltCntlFlags = NEO_BC1_DEPTH8; - nAcl->ColorShiftAmt = 8; - break; - case 15: - case 16: - nAcl->BltCntlFlags = NEO_BC1_DEPTH16; - nAcl->ColorShiftAmt = 0; - break; - case 24: - default: - return FALSE; - } - - /* Initialize for widths */ - switch (pScrn->displayWidth) { - case 640: - nAcl->BltCntlFlags |= NEO_BC1_X_640; - break; - case 800: - nAcl->BltCntlFlags |= NEO_BC1_X_800; - break; - case 1024: - nAcl->BltCntlFlags |= NEO_BC1_X_1024; - break; - default: - return FALSE; - } - - nAcl->BltCntlFlags |= NEO_BC3_FIFO_EN; - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -Neo2090Sync(ScrnInfoPtr pScrn) -{ - NEOPtr nPtr = NEOPTR(pScrn); - - WAIT_ENGINE_IDLE(); -} - -static void -Neo2090SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, - unsigned int planemask, - int trans_color) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nAcl->tmpBltCntlFlags = (nAcl->BltCntlFlags | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | - NEO_BC3_SRC_XY_ADDR | neo2090Rop[rop]); - - /* set blt control */ - WAIT_FIFO(2); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); -} - -static void -Neo2090SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int srcX, int srcY, - int dstX, int dstY, - int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - /* start with upper left corner */ - WAIT_FIFO(4); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEOREG_SRCSTARTOFF, (srcY<<16) | (srcX & 0xffff)); - OUTREG(NEOREG_DSTSTARTOFF, (dstY<<16) | (dstX & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } - else { - /* start with lower right corner */ - WAIT_FIFO(4); - OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags | NEO_BC0_X_DEC - | NEO_BC0_DST_Y_DEC - | NEO_BC0_SRC_Y_DEC)); - OUTREG(NEOREG_SRCSTARTOFF, ((srcY+h-1)<<16) | ((srcX+w-1) & 0xffff)); - OUTREG(NEOREG_DSTSTARTOFF, ((dstY+h-1)<<16) | ((dstX+w-1) & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } -} - - -static void -Neo2090SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - WAIT_FIFO(2); - - /* set blt control */ - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SRC_IS_FG | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | - NEO_BC3_SRC_XY_ADDR | neo2090Rop[rop]); - - /* set foreground color */ - OUTREG(NEOREG_FGCOLOR, color |= (color << nAcl->ColorShiftAmt)); -} - - -static void -Neo2090SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - - WAIT_FIFO(2); - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - -} - -static void -Neo2093SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if (bg == -1) { - /* transparent setup */ - WAIT_FIFO(2); - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC0_SRC_TRANS | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | neo2090Rop[rop]); - - OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt)); - } - else { - /* opaque setup */ - WAIT_FIFO(3); - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | neo2090Rop[rop]); - - OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt)); - OUTREG(NEOREG_BGCOLOR, bg |= (bg << nAcl->ColorShiftAmt)); - } -} - -static void -Neo2093SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nAcl->CPUToScreenColorExpandFill_x = x; - nAcl->CPUToScreenColorExpandFill_y = y; - nAcl->CPUToScreenColorExpandFill_w = w; - nAcl->CPUToScreenColorExpandFill_h = h; - nAcl->CPUToScreenColorExpandFill_skipleft = skipleft; - - WAIT_FIFO(4); - OUTREG(NEOREG_SRCBITOFF, skipleft); - OUTREG(NEOREG_SRCSTARTOFF, 0); - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); - OUTREG(NEOREG_XYEXT, (1<<16) | (w & 0xffff)); -} - -static void -Neo2093SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if (!(--nAcl->CPUToScreenColorExpandFill_h)) - return; - - WAIT_FIFO(4); - OUTREG(NEOREG_SRCBITOFF, nAcl->CPUToScreenColorExpandFill_skipleft); - OUTREG(NEOREG_SRCSTARTOFF, 0); - OUTREG(NEOREG_DSTSTARTOFF, ((++nAcl->CPUToScreenColorExpandFill_y)<<16) - | (nAcl->CPUToScreenColorExpandFill_x & 0xffff)); - OUTREG(NEOREG_XYEXT, (1<<16) - | (nAcl->CPUToScreenColorExpandFill_w & 0xffff)); -} -#endif diff --git a/src/neo_2097.c b/src/neo_2097.c deleted file mode 100644 index 720a884..0000000 --- a/src/neo_2097.c +++ /dev/null @@ -1,553 +0,0 @@ -/********************************************************************** -Copyright 1998, 1999 by Precision Insight, Inc., Cedar Park, Texas. - - All Rights Reserved - -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 Precision Insight not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. Precision Insight -and its suppliers make no representations about the suitability of this -software for any purpose. It is provided "as is" without express or -implied warranty. - -PRECISION INSIGHT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. -**********************************************************************/ - -/* - * The original Precision Insight driver for - * XFree86 v.3.3 has been sponsored by Red Hat. - * - * Authors: - * Jens Owen (jens@tungstengraphics.com) - * Kevin E. Martin (kevin@precisioninsight.com) - * - * Port to Xfree86 v.4.0 - * 1998, 1999 by Egbert Eich (Egbert.Eich@Physik.TU-Darmstadt.DE) - */ - -/* - * This module supports acceleration for 2097 and 2160. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "compiler.h" - -/* Drivers that use XAA need this */ -#include "xf86fbman.h" - -#include "miline.h" - -#include "neo.h" -#include "neo_reg.h" -#include "neo_macros.h" - -#ifdef HAVE_XAA_H -static void Neo2097Sync(ScrnInfoPtr pScrn); -static void Neo2097SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, - int ydir, int rop, - unsigned int planemask, - int trans_color); -static void Neo2097SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, - int srcY, int dstX, int dstY, - int w, int h); -static void Neo2097SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void Neo2097SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h); -static void Neo2097SetupScanlineForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void Neo2097SubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void Neo2097SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -#if 0 -static void Neo2097SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, unsigned int planemask); -static void Neo2097SubsequentMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#endif -static void Neo2097SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, - int transparency_color, int bpp, int depth); -static void Neo2097SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -static void Neo2097SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int num); - - - -static unsigned int neo2097Rop[16] = { - 0x000000, /* 0x0000 - GXclear */ - 0x080000, /* 0x1000 - GXand */ - 0x040000, /* 0x0100 - GXandReverse */ - 0x0c0000, /* 0x1100 - GXcopy */ - 0x020000, /* 0x0010 - GXandInvert */ - 0x0a0000, /* 0x1010 - GXnoop */ - 0x060000, /* 0x0110 - GXxor */ - 0x0e0000, /* 0x1110 - GXor */ - 0x010000, /* 0x0001 - GXnor */ - 0x090000, /* 0x1001 - GXequiv */ - 0x050000, /* 0x0101 - GXinvert */ - 0x0d0000, /* 0x1101 - GXorReverse */ - 0x030000, /* 0x0011 - GXcopyInvert */ - 0x0b0000, /* 0x1011 - GXorInverted */ - 0x070000, /* 0x0111 - GXnand */ - 0x0f0000 /* 0x1111 - GXset */ -}; -#endif - -Bool -Neo2097AccelInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if(!infoPtr) return FALSE; - - /* - * Set up the main acceleration flags. - */ - infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; - if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE; - - infoPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES; - - /* sync */ - infoPtr->Sync = Neo2097Sync; - - /* screen to screen copy */ - infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | NO_PLANEMASK); - infoPtr->SetupForScreenToScreenCopy = - Neo2097SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - Neo2097SubsequentScreenToScreenCopy; - - /* solid filled rectangles */ - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = - Neo2097SetupForSolidFillRect; - infoPtr->SubsequentSolidFillRect = - Neo2097SubsequentSolidFillRect; - - if (!nPtr->strangeLockups) { - /* cpu to screen color expansion */ - /* - * We do CPUToScreenColorExpand (ab)using the Scanline functions: - * the neo chipsets need byte padding however we can only do dword - * padding. Fortunately the graphics engine doesn't choke if we - * transfer up to 3 bytes more than it wants. - */ - infoPtr->ScanlineColorExpandBuffers = - (unsigned char **)XNFalloc(sizeof(char*)); - infoPtr->ScanlineColorExpandBuffers[0] = (unsigned char *)(nPtr->NeoMMIOBase + 0x100000); - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK | -#ifdef NEO_DO_CLIPPING - LEFT_EDGE_CLIPPING | -#endif - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST ); - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - Neo2097SetupScanlineForCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - Neo2097SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - Neo2097SubsequentColorExpandScanline; - } - -#if 0 - /* 8x8 pattern fills */ - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK - | HARDWARE_PATTERN_PROGRAMMED_ORIGIN - | BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForMono8x8PatternFill = - Neo2097SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - Neo2097SubsequentMono8x8PatternFill; -#endif - - if (!nPtr->strangeLockups) { - /* image writes */ - infoPtr->ScanlineImageWriteFlags = ( CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - NO_TRANSPARENCY | - NO_PLANEMASK ); - - infoPtr->SetupForScanlineImageWrite = - Neo2097SetupForScanlineImageWrite; - infoPtr->SubsequentScanlineImageWriteRect = - Neo2097SubsequentScanlineImageWriteRect; - infoPtr->SubsequentImageWriteScanline = - Neo2097SubsequentImageWriteScanline; - infoPtr->NumScanlineImageWriteBuffers = 1; - infoPtr->ScanlineImageWriteBuffers = - infoPtr->ScanlineColorExpandBuffers; - } - - /* - * Setup some global variables - */ - nAcl->ColorShiftAmt = 0; - - /* Initialize for 8bpp or 15/16bpp support accelerated */ - switch (pScrn->bitsPerPixel) { - case 8: - nAcl->BltCntlFlags = NEO_BC1_DEPTH8; - nAcl->ColorShiftAmt = 8; - break; - case 15: - case 16: - nAcl->BltCntlFlags = NEO_BC1_DEPTH16; - nAcl->ColorShiftAmt = 0; - break; - case 24: - default: - return FALSE; - } - - /* Initialize for widths */ - switch (pScrn->displayWidth) { - case 640: - nAcl->BltCntlFlags |= NEO_BC1_X_640; - break; - case 800: - nAcl->BltCntlFlags |= NEO_BC1_X_800; - break; - case 1024: - nAcl->BltCntlFlags |= NEO_BC1_X_1024; - break; - default: - return FALSE; - } - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -Neo2097Sync(ScrnInfoPtr pScrn) -{ - NEOPtr nPtr = NEOPTR(pScrn); - - WAIT_ENGINE_IDLE(); -} - -static void -Neo2097SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, - unsigned int planemask, - int trans_color) -{ - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nAcl->tmpBltCntlFlags = (nAcl->BltCntlFlags | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | - NEO_BC3_SRC_XY_ADDR | neo2097Rop[rop]); -} - -static void -Neo2097SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int srcX, int srcY, - int dstX, int dstY, - int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - /* start with upper left corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEOREG_SRCSTARTOFF, (srcY<<16) | (srcX & 0xffff)); - OUTREG(NEOREG_DSTSTARTOFF, (dstY<<16) | (dstX & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } - else { - /* start with lower right corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags | NEO_BC0_X_DEC - | NEO_BC0_DST_Y_DEC - | NEO_BC0_SRC_Y_DEC)); - OUTREG(NEOREG_SRCSTARTOFF, ((srcY+h-1)<<16) | ((srcX+w-1) & 0xffff)); - OUTREG(NEOREG_DSTSTARTOFF, ((dstY+h-1)<<16) | ((dstX+w-1) & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } -} - - -static void -Neo2097SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - WAIT_ENGINE_IDLE(); - - /* set blt control */ - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SRC_IS_FG | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | - NEO_BC3_SRC_XY_ADDR | neo2097Rop[rop]); - - /* set foreground color */ - OUTREG(NEOREG_FGCOLOR, color |= (color << nAcl->ColorShiftAmt)); -} - - -static void -Neo2097SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); -} - -static void -Neo2097SetupScanlineForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if (bg == -1) { - /* transparent setup */ - WAIT_ENGINE_IDLE(); -#ifdef NEO_DO_CLIPPING - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC0_SRC_TRANS | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_CLIP_ON | - NEO_BC3_DST_XY_ADDR | neo2097Rop[rop]); -#else - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC0_SRC_TRANS | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | neo2097Rop[rop]); -#endif - - OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt)); - } - else { - /* opaque setup */ - WAIT_ENGINE_IDLE(); -#ifdef NEO_DO_CLIPPING - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_CLIP_ON | - NEO_BC3_DST_XY_ADDR | neo2097Rop[rop]); -#else - OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags | - NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | neo2097Rop[rop]); -#endif - - OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt)); - OUTREG(NEOREG_BGCOLOR, bg |= (bg << nAcl->ColorShiftAmt)); - } -} - -static void -Neo2097SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - -#ifdef NEO_DO_CLIPPING - w = (w + 31) & ~31; -#else - nAcl->CPUToScreenColorExpandFill_x = x; - nAcl->CPUToScreenColorExpandFill_y = y; - nAcl->CPUToScreenColorExpandFill_w = w; - nAcl->CPUToScreenColorExpandFill_h = h; -#endif - WAIT_ENGINE_IDLE(); -#ifdef NEO_DO_CLIPPING - OUTREG(NEOREG_CLIPLT, (y << 16) | (x + skipleft)); - OUTREG(NEOREG_CLIPRB, ((y + h) << 16) | (x + w)); - WAIT_ENGINE_IDLE(); -#endif - OUTREG(NEOREG_SRCSTARTOFF, 0); - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); -#ifdef NEO_DO_CLIPPING - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); -#else - OUTREG(NEOREG_XYEXT, (1<<16) | (w & 0xffff)); -#endif -} - -static void -Neo2097SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ -#ifdef NEO_DO_CLIPPING - /* Should I be waiting for fifo slots to prevent retries ? - How do I do that on this engine ? */ -#else - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if (!(--nAcl->CPUToScreenColorExpandFill_h)) - return; - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_SRCSTARTOFF, 0); - OUTREG(NEOREG_DSTSTARTOFF, ((++nAcl->CPUToScreenColorExpandFill_y)<<16) - | (nAcl->CPUToScreenColorExpandFill_x & 0xffff)); - OUTREG(NEOREG_XYEXT, (1<<16) - | (nAcl->CPUToScreenColorExpandFill_w & 0xffff)); -#endif -} - -#if 0 -static void -Neo2097SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if (bg == -1) { - /* transparent setup */ - nAcl->tmpBltCntlFlags = ( nAcl->BltCntlFlags | - NEO_BC0_SRC_MONO | - NEO_BC0_FILL_PAT | - NEO_BC0_SRC_TRANS | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_SRC_XY_ADDR | - NEO_BC3_DST_XY_ADDR | neo2097Rop[rop]); - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt)); - OUTREG(NEOREG_SRCSTARTOFF, (patterny << 16) | patternx); - } - else { - /* opaque setup */ - nAcl->tmpBltCntlFlags = ( nAcl->BltCntlFlags | - NEO_BC0_SRC_MONO | - NEO_BC0_FILL_PAT | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_SRC_XY_ADDR | - NEO_BC3_DST_XY_ADDR | neo2097Rop[rop]); - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt)); - OUTREG(NEOREG_BGCOLOR, bg |= (bg << nAcl->ColorShiftAmt)); - OUTREG(NEOREG_SRCSTARTOFF, (patterny << 16) | patternx); - } -} - - -static void -Neo2097SubsequentMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - patterny &= 0x7; - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags | (patterny << 20)); -/* OUTREG(NEOREG_SRCBITOFF, patternx); Bad Register */ - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); -} -#endif - -static void -Neo2097SetupForScanlineImageWrite( - ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth -){ - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nAcl->tmpBltCntlFlags = (nAcl->BltCntlFlags | - NEO_BC0_SYS_TO_VID | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | neo2097Rop[rop]); -} - - -static void -Neo2097SubsequentScanlineImageWriteRect( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEOREG_SRCSTARTOFF, 0); - OUTREG(NEOREG_DSTSTARTOFF, (y << 16) | (x & 0xffff)); - OUTREG(NEOREG_XYEXT, (h << 16) | w); -} - -static void -Neo2097SubsequentImageWriteScanline( - ScrnInfoPtr pScrn, - int bufno -){ - /* should I be checking for fifo slots here ? */ -} -#endif diff --git a/src/neo_2200.c b/src/neo_2200.c deleted file mode 100644 index 40544c5..0000000 --- a/src/neo_2200.c +++ /dev/null @@ -1,657 +0,0 @@ -/******************************************************************** -Copyright 1998, 1999 by Precision Insight, Inc., Cedar Park, Texas. - - All Rights Reserved - -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 Precision Insight not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. Precision Insight -and its suppliers make no representations about the suitability of this -software for any purpose. It is provided "as is" without express or -implied warranty. - -PRECISION INSIGHT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. -**********************************************************************/ -/* - * The original Precision Insight driver for - * XFree86 v.3.3 has been sponsored by Red Hat. - * - * Authors: - * Jens Owen (jens@tungstengraphics.com) - * Kevin E. Martin (kevin@precisioninsight.com) - * - * Port to Xfree86 v.4.0 - * 1998, 1999 by Egbert Eich (Egbert.Eich@Physik.TU-Darmstadt.DE) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "compiler.h" - -/* Drivers that use XAA need this */ -#include "xf86fbman.h" - -#include "miline.h" - -#include "neo.h" -#include "neo_reg.h" -#include "neo_macros.h" - -#ifdef HAVE_XAA_H -static void Neo2200Sync(ScrnInfoPtr pScrn); -static void Neo2200SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, - int ydir, int rop, - unsigned int planemask, - int trans_color); -#ifdef NOT_BROKEN -static void Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX, - int srcY, int dstX, int dstY, - int w, int h); -#else -static void Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn, int srcX, - int srcY, int dstX, int dstY, - int w, int h); -#endif -static void Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void Neo2200SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h); -static void Neo2200SetupForScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask); -static void Neo2200SubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft); -static void Neo2200SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -#if 0 -static void Neo2200SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int bg, - int fg, - int rop, - unsigned int planemask); -static void Neo2200SubsequentMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h); -#endif - - -static unsigned int neo2200Rop[16] = { - 0x000000, /* 0x0000 - GXclear */ - 0x080000, /* 0x1000 - GXand */ - 0x040000, /* 0x0100 - GXandReverse */ - 0x0c0000, /* 0x1100 - GXcopy */ - 0x020000, /* 0x0010 - GXandInvert */ - 0x0a0000, /* 0x1010 - GXnoop */ - 0x060000, /* 0x0110 - GXxor */ - 0x0e0000, /* 0x1110 - GXor */ - 0x010000, /* 0x0001 - GXnor */ - 0x090000, /* 0x1001 - GXequiv */ - 0x050000, /* 0x0101 - GXinvert */ - 0x0d0000, /* 0x1101 - GXorReverse */ - 0x030000, /* 0x0011 - GXcopyInvert */ - 0x0b0000, /* 0x1011 - GXorInverted */ - 0x070000, /* 0x0111 - GXnand */ - 0x0f0000 /* 0x1111 - GXset */ -}; - -#endif -Bool -Neo2200AccelInit(ScreenPtr pScreen) -{ -#ifdef HAVE_XAA_H - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if(!infoPtr) return FALSE; - - /* - * Set up the main acceleration flags. - */ - infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; - if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE; -#if 0 - infoPtr->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES; -#endif - /* sync */ - infoPtr->Sync = Neo2200Sync; - - /* screen to screen copy */ - infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | NO_PLANEMASK); - infoPtr->SetupForScreenToScreenCopy = - Neo2200SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy -#ifdef NOT_BROKEN - = Neo2200SubsequentScreenToScreenCopy; -#else - = Neo2200SubsequentScreenToScreenCopyBroken; -#endif - - /* solid filled rectangles */ - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = - Neo2200SetupForSolidFillRect; - infoPtr->SubsequentSolidFillRect = - Neo2200SubsequentSolidFillRect; - - /* cpu to screen color expansion */ - /* - * We do CPUToScreenColorExpand (ab)using the Scanline functions: - * the neo chipsets need byte padding however we can only do dword - * padding. Fortunately the graphics engine doesn't choke if we - * transfer up to 3 bytes more than it wants. - */ - - if (!nPtr->strangeLockups) { - - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK | -#ifdef NEO_DO_CLIPPING - LEFT_EDGE_CLIPPING | -#endif - SCANLINE_PAD_DWORD | - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST ); - infoPtr->ScanlineColorExpandBuffers = - (unsigned char **)XNFalloc(sizeof(char*)); - infoPtr->ScanlineColorExpandBuffers[0] = - (unsigned char *)(nPtr->NeoMMIOBase + 0x100000); - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - Neo2200SetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - Neo2200SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - Neo2200SubsequentColorExpandScanline; - } - -#if 0 - /* 8x8 pattern fills */ - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK - | HARDWARE_PATTERN_PROGRAMMED_ORIGIN - |BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForMono8x8PatternFill = - Neo2200SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - Neo2200SubsequentMono8x8PatternFill; -#endif - - /* - * Setup some global variables - */ - - /* Initialize for 8bpp or 15/16bpp support accelerated */ - switch (pScrn->bitsPerPixel) { - case 8: - nAcl->BltModeFlags = NEO_MODE1_DEPTH8; - nAcl->PixelWidth = 1; - break; - case 15: - case 16: - nAcl->BltModeFlags = NEO_MODE1_DEPTH16; - nAcl->PixelWidth = 2; - break; - case 24: - if (nPtr->noAccelSet || nPtr->NeoChipset == NM2230 - || nPtr->NeoChipset == NM2360 - || nPtr->NeoChipset == NM2380) { - nAcl->BltModeFlags = NEO_MODE1_DEPTH24; - nAcl->PixelWidth = 3; - } else - return FALSE; - break; - default: - return FALSE; - } - nAcl->Pitch = pScrn->displayWidth * nAcl->PixelWidth; - - /* Initialize for widths */ - switch (pScrn->displayWidth) { - case 320: - nAcl->BltModeFlags |= NEO_MODE1_X_320; - break; - case 640: - nAcl->BltModeFlags |= NEO_MODE1_X_640; - break; - case 800: - nAcl->BltModeFlags |= NEO_MODE1_X_800; - break; - case 1024: - nAcl->BltModeFlags |= NEO_MODE1_X_1024; - break; - case 1152: - nAcl->BltModeFlags |= NEO_MODE1_X_1152; - break; - case 1280: - nAcl->BltModeFlags |= NEO_MODE1_X_1280; - break; - case 1600: - nAcl->BltModeFlags |= NEO_MODE1_X_1600; - break; - default: - return FALSE; - } - - return(XAAInit(pScreen, infoPtr)); -#else - return FALSE; -#endif -} - -#ifdef HAVE_XAA_H -static void -Neo2200Sync(ScrnInfoPtr pScrn) -{ - NEOPtr nPtr = NEOPTR(pScrn); - - WAIT_ENGINE_IDLE(); -} - -static void -Neo2200SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, - unsigned int planemask, - int trans_color) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - nAcl->tmpBltCntlFlags = (NEO_BC3_SKIP_MAPPING | neo2200Rop[rop]); - /* set blt control */ - WAIT_ENGINE_IDLE(); - /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ - OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEOREG_PITCH, (nAcl->Pitch<<16) - | (nAcl->Pitch & 0xffff)); -} - -#ifdef NOT_BROKEN -static void -Neo2200SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int srcX, int srcY, - int dstX, int dstY, - int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - /* start with upper left corner */ - WAIT_ENGINE_IDLE(); -#if 0 - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); -#endif - OUTREG(NEOREG_SRCSTARTOFF, - (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } - else { - /* start with lower right corner */ - WAIT_ENGINE_IDLE(); -#if 0 - OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags - | NEO_BC0_X_DEC - | NEO_BC0_DST_Y_DEC - | NEO_BC0_SRC_Y_DEC)); -#endif - OUTREG(NEOREG_SRCSTARTOFF, - ((srcY+h-1) * nAcl->Pitch) + ((srcX+w-1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - ((dstY+h-1) * nAcl->Pitch) + ((dstX+w-1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } -} - -#else /* NOT_BROKEN */ - -static void -Neo2200SubsequentScreenToScreenCopyBroken(ScrnInfoPtr pScrn, - int srcX, int srcY, - int dstX, int dstY, - int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - if ((((dstX < 64) && ((srcX + w + 64) >= pScrn->displayWidth)) || - ((dstX == 0) && (w > (pScrn->displayWidth - 64)))) && (w > 64)) { - -#define COPY_64 \ - OUTREG(NEOREG_SRCSTARTOFF,\ - (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth));\ - OUTREG(NEOREG_DSTSTARTOFF,\ - (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth));\ - OUTREG(NEOREG_XYEXT, (h<<16) | (64)); -#define COPY_W \ - OUTREG(NEOREG_SRCSTARTOFF,\ - (srcY * nAcl->Pitch) + (srcX1 * nAcl->PixelWidth));\ - OUTREG(NEOREG_DSTSTARTOFF,\ - (dstY * nAcl->Pitch) + (dstX1 * nAcl->PixelWidth));\ - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - - int srcX1 = srcX + 64; - int dstX1 = dstX + 64; - w -= 64; - /* start with upper left corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - if (srcX < dstX) { - COPY_W; - WAIT_ENGINE_IDLE(); - COPY_64; - } else { - COPY_64; - WAIT_ENGINE_IDLE(); - COPY_W; - } -#undef COPY_W -#undef COPY_64 - } else { - /* start with upper left corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEOREG_SRCSTARTOFF, - (srcY * nAcl->Pitch) + (srcX * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - (dstY * nAcl->Pitch) + (dstX * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } - } else { - if (((((dstX + w) > (pScrn->displayWidth - 64)) && (srcX == 0)) - || (((dstX + w + 64) >= pScrn->displayWidth) - && (w > (pScrn->displayWidth - 64)))) && (w > 64)) { -#define COPY_64 \ - OUTREG(NEOREG_SRCSTARTOFF, \ - ((srcY+h-1) * nAcl->Pitch) + ((srcX1+64-1) \ - * nAcl->PixelWidth)); \ - OUTREG(NEOREG_DSTSTARTOFF, \ - ((dstY+h-1) * nAcl->Pitch) + ((dstX1+64-1) \ - * nAcl->PixelWidth)); \ - OUTREG(NEOREG_XYEXT, (h<<16) | (64 & 0xffff)); -#define COPY_W \ - OUTREG(NEOREG_SRCSTARTOFF, \ - ((srcY+h-1) * nAcl->Pitch) + ((srcX + w -1) \ - * nAcl->PixelWidth)); \ - OUTREG(NEOREG_DSTSTARTOFF, \ - ((dstY+h-1) * nAcl->Pitch) + ((dstX + w -1) \ - * nAcl->PixelWidth)); \ - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - - int srcX1, dstX1; - - w -= 64; - srcX1 = srcX + w; - dstX1 = dstX + w; - /* start with lower right corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags - | NEO_BC0_X_DEC - | NEO_BC0_DST_Y_DEC - | NEO_BC0_SRC_Y_DEC)); - if (srcX < dstX) { - COPY_64; - WAIT_ENGINE_IDLE(); - COPY_W; - } else { - COPY_W; - WAIT_ENGINE_IDLE(); - COPY_64; - } -#undef COPY_W -#undef COPY_64 - } else { - /* start with lower right corner */ - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags - | NEO_BC0_X_DEC - | NEO_BC0_DST_Y_DEC - | NEO_BC0_SRC_Y_DEC)); - OUTREG(NEOREG_SRCSTARTOFF, - ((srcY+h-1) * nAcl->Pitch) + ((srcX+w-1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_DSTSTARTOFF, - ((dstY+h-1) * nAcl->Pitch) + ((dstX+w-1) - * nAcl->PixelWidth)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); - } - } -} - -#endif /* NOT_BROKEN */ - -static void -Neo2200SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - WAIT_ENGINE_IDLE(); - - /* set blt control */ - /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ - OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16); - OUTREG(NEOREG_BLTCNTL, NEO_BC0_SRC_IS_FG | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | - NEO_BC3_SRC_XY_ADDR | neo2200Rop[rop]); - - /* set foreground color */ - OUTREG(NEOREG_FGCOLOR, color); -} - - -static void -Neo2200SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_DSTSTARTOFF, (y <<16) | (x & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); -} - -static void -Neo2200SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if (bg == -1) { - /* transparent setup */ - nAcl->tmpBltCntlFlags = ( NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC0_SRC_TRANS | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | -#ifdef NEO_DO_CLIPPING - NEO_BC3_CLIP_ON | -#endif - neo2200Rop[rop]); - - WAIT_ENGINE_IDLE(); - /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ - OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags); - OUTREG(NEOREG_FGCOLOR, fg); - } - else { - /* opaque setup */ - nAcl->tmpBltCntlFlags = ( NEO_BC0_SYS_TO_VID | - NEO_BC0_SRC_MONO | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | -#ifdef NEO_DO_CLIPPING - NEO_BC3_CLIP_ON | -#endif - neo2200Rop[rop]); - - WAIT_ENGINE_IDLE(); - /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ - OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16); - OUTREG(NEOREG_FGCOLOR, fg); - OUTREG(NEOREG_BGCOLOR, bg); - } -} - - -static void -Neo2200SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int skipleft) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - -#ifdef NEO_DO_CLIPPING - w = (w + 31) & ~31; -#else - nAcl->CPUToScreenColorExpandFill_x = x; - nAcl->CPUToScreenColorExpandFill_y = y; - nAcl->CPUToScreenColorExpandFill_w = w; - nAcl->CPUToScreenColorExpandFill_h = h; - nAcl->CPUToScreenColorExpandFill_skipleft = skipleft; -#endif - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags - | ((skipleft << 2) & 0x1C)); -#ifdef NEO_DO_CLIPPING - OUTREG(NEOREG_CLIPLT, (y << 16) | (x + skipleft)); - OUTREG(NEOREG_CLIPRB, ((y + h) << 16) | (x + w)); -#endif - OUTREG(NEOREG_SRCSTARTOFF, 0); - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); -#ifdef NEO_DO_CLIPPING - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); -#else - OUTREG(NEOREG_XYEXT, (1<<16) | (w & 0xffff)); -#endif -} - -static void -Neo2200SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - -#ifdef NEO_DO_CLIPPING - /* Should I be waiting for fifo slots to prevent retries ? - How do I do that on this engine ? */ -#else - if (!(--nAcl->CPUToScreenColorExpandFill_h)) - return; - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags - | ((nAcl->CPUToScreenColorExpandFill_skipleft << 2) & 0x1C)); - OUTREG(NEOREG_SRCSTARTOFF, 0); - OUTREG(NEOREG_DSTSTARTOFF, ((++nAcl->CPUToScreenColorExpandFill_y)<<16) - | (nAcl->CPUToScreenColorExpandFill_x & 0xffff)); - OUTREG(NEOREG_XYEXT, (1<<16) - | (nAcl->CPUToScreenColorExpandFill_w & 0xffff)); -#endif -} - -#if 0 -static void -Neo2200SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int fg, int bg, - int rop, unsigned int planemask) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - if (bg == -1) { - /* transparent setup */ - nAcl->tmpBltCntlFlags = ( NEO_BC0_SRC_MONO | - NEO_BC0_FILL_PAT | - NEO_BC0_SRC_TRANS | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | - neo2200Rop[rop]); - - WAIT_ENGINE_IDLE(); - /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ - OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16); - OUTREG(NEOREG_FGCOLOR, fg); - OUTREG(NEOREG_SRCSTARTOFF, - (patterny * pScrn->displayWidth * pScrn->bitsPerPixel - + patternx) >> 3); - } - else { - /* opaque setup */ - nAcl->tmpBltCntlFlags = ( NEO_BC0_SRC_MONO | - NEO_BC0_FILL_PAT | - NEO_BC3_SKIP_MAPPING | - NEO_BC3_DST_XY_ADDR | - neo2200Rop[rop]); - - WAIT_ENGINE_IDLE(); - /*OUTREG16(NEOREG_BLTMODE, nAcl->BltModeFlags);*/ - OUTREG(NEOREG_BLTSTAT, nAcl->BltModeFlags << 16); - OUTREG(NEOREG_FGCOLOR, fg); - OUTREG(NEOREG_BGCOLOR, bg); - OUTREG(NEOREG_SRCSTARTOFF, - (patterny * pScrn->displayWidth * pScrn->bitsPerPixel - + patternx) >> 3); - } -} - - -static void -Neo2200SubsequentMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, - int patterny, - int x, int y, - int w, int h) -{ - NEOPtr nPtr = NEOPTR(pScrn); - NEOACLPtr nAcl = NEOACLPTR(pScrn); - - patterny &= 0x7; - - WAIT_ENGINE_IDLE(); - OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags | - (patterny << 20) | - ((patternx << 10) & 0x1C00)); - OUTREG(NEOREG_SRCBITOFF, patternx); - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff)); - OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff)); -} -#endif -#endif diff --git a/src/neo_dga.c b/src/neo_dga.c index c5d60d5..834fc87 100644 --- a/src/neo_dga.c +++ b/src/neo_dga.c @@ -39,15 +39,6 @@ static Bool NEO_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, static Bool NEO_SetMode(ScrnInfoPtr, DGAModePtr); static int NEO_GetViewport(ScrnInfoPtr); static void NEO_SetViewport(ScrnInfoPtr, int, int, int); -#ifdef HAVE_XAA_H -static void NEO_Sync(ScrnInfoPtr); -static void NEO_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); -static void NEO_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 -static void NEO_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -#endif -#endif static DGAFunctionRec NEODGAFuncs = { @@ -56,18 +47,7 @@ DGAFunctionRec NEODGAFuncs = { NEO_SetMode, NEO_SetViewport, NEO_GetViewport, -#ifdef HAVE_XAA_H - NEO_Sync, - NEO_FillRect, - NEO_BlitRect, -#if 0 - NEO_BlitTransRect -#else - NULL -#endif -#else NULL, NULL, NULL -#endif }; Bool @@ -102,10 +82,6 @@ NEODGAInit(ScreenPtr pScreen) currentMode->mode = pMode; currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; -#ifdef HAVE_XAA_H - if (!pNEO->noAccel) - currentMode->flags |= (DGA_FILL_RECT | DGA_BLIT_RECT); -#endif if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) @@ -202,67 +178,6 @@ NEO_SetViewport( pNEO->DGAViewportStatus = 0; } -#ifdef HAVE_XAA_H -static void -NEO_FillRect ( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned long color -){ - NEOPtr pNEO = NEOPTR(pScrn); - - if(pNEO->AccelInfoRec) { - (*pNEO->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*pNEO->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(pNEO->AccelInfoRec); - } -} - -static void -NEO_Sync( - ScrnInfoPtr pScrn -){ - NEOPtr pNEO = NEOPTR(pScrn); - if(pNEO->AccelInfoRec) { - (*pNEO->AccelInfoRec->Sync)(pScrn); - } -} - -static void -NEO_BlitRect( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty -){ - NEOPtr pNEO = NEOPTR(pScrn); - - if(pNEO->AccelInfoRec) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pNEO->AccelInfoRec->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, ~0, -1); - (*pNEO->AccelInfoRec->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pNEO->AccelInfoRec); - } -} - -#if 0 -static void -NEO_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 NEO_OpenFramebuffer( ScrnInfoPtr pScrn, diff --git a/src/neo_driver.c b/src/neo_driver.c index 704a9fb..ed5fb33 100644 --- a/src/neo_driver.c +++ b/src/neo_driver.c @@ -54,12 +54,6 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Everything using inb/outb, etc needs "compiler.h" */ #include "compiler.h" -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 -#include "xf86Resources.h" -/* Needed by Resources Access Control (RAC) */ -#include "xf86RAC.h" -#endif - /* Drivers that need to access the PCI config space directly need this */ #include "xf86Pci.h" @@ -118,9 +112,6 @@ static ModeStatus NEOValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags); /* Internally used functions */ -#ifdef HAVE_ISA -static int neoFindIsaDevice(GDevPtr dev); -#endif static Bool neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void neoSave(ScrnInfoPtr pScrn); static void neoRestore(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, @@ -314,18 +305,6 @@ static PciChipsets NEOPCIchipsets[] = { { -1, -1, RES_UNDEFINED} }; -#ifdef HAVE_ISA -static IsaChipsets NEOISAchipsets[] = { - { NM2070, RES_EXCLUSIVE_VGA }, - { NM2090, RES_EXCLUSIVE_VGA }, - { NM2093, RES_EXCLUSIVE_VGA }, - { NM2097, RES_EXCLUSIVE_VGA }, - { NM2160, RES_EXCLUSIVE_VGA }, - { NM2200, RES_EXCLUSIVE_VGA }, - { -1, RES_UNDEFINED } -}; -#endif - /* The options supported by the Neomagic Driver */ typedef enum { OPTION_NOACCEL, @@ -552,72 +531,10 @@ NEOProbe(DriverPtr drv, int flags) } } -#ifdef HAVE_ISA - /* Isa Bus */ - - numUsed = xf86MatchIsaInstances(NEO_NAME,NEOChipsets,NEOISAchipsets, - drv,neoFindIsaDevice,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], - NEOISAchipsets, NULL, NULL, - NULL, NULL, NULL))) { - pScrn->driverVersion = NEO_VERSION; - pScrn->driverName = NEO_DRIVER_NAME; - pScrn->name = NEO_NAME; - pScrn->Probe = NEOProbe; - pScrn->PreInit = NEOPreInit; - pScrn->ScreenInit = NEOScreenInit; - pScrn->SwitchMode = NEOSwitchMode; - pScrn->AdjustFrame = NEOAdjustFrame; - pScrn->EnterVT = NEOEnterVT; - pScrn->LeaveVT = NEOLeaveVT; - pScrn->FreeScreen = NEOFreeScreen; - pScrn->ValidMode = NEOValidMode; - foundScreen = TRUE; - } - } - free(usedChips); - } -#endif - free(devSections); return foundScreen; } -#ifdef HAVE_ISA -static int -neoFindIsaDevice(GDevPtr dev) -{ - unsigned int vgaIOBase; - unsigned char id; - - vgaIOBase = (inb(0x3CC) & 0x01) ? 0x3D0 : 0x3B0; - /* ยงยงยง Too intrusive ? */ - outw(GRAX, 0x2609); /* Unlock NeoMagic registers */ - - outb(vgaIOBase + 4, 0x1A); - id = inb(vgaIOBase + 5); - - outw(GRAX, 0x0009); /* Lock NeoMagic registers */ - - switch (id) { - case PROBED_NM2070 : - return NM2070; - case PROBED_NM2090 : - return NM2090; - case PROBED_NM2093 : - return NM2093; - default : - return -1; - } -} -#endif - /* Mandatory */ Bool NEOPreInit(ScrnInfoPtr pScrn, int flags) @@ -685,7 +602,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags) nPtr->NeoChipset = nPtr->pEnt->chipset; pScrn->chipset = (char *)xf86TokenToString(NEOChipsets, nPtr->pEnt->chipset); - /* This driver can handle ISA and PCI buses */ + /* This driver can handle PCI buses */ if (nPtr->pEnt->location.type == BUS_PCI) { nPtr->PciInfo = xf86GetPciInfoForEntity(nPtr->pEnt->index); #ifndef XSERVER_LIBPCIACCESS @@ -1088,10 +1005,8 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex,X_CONFIG, "Show cache for debugging\n"); - if (!xf86LoadSubModule(pScrn, "xaa")) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Falling back to shadow\n"); - nPtr->shadowFB = 1; - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Falling back to shadow\n"); + nPtr->shadowFB = 1; if (nPtr->shadowFB) { if (!xf86LoadSubModule(pScrn, "shadow")) { @@ -1172,34 +1087,6 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags) #endif } -#ifndef XSERVER_LIBPCIACCESS - else if (nPtr->pEnt->location.type == BUS_ISA) { - unsigned int addr; - resRange linearRes[] = { {ResExcMemBlock|ResBios|ResBus,0,0},_END }; - - if (!nPtr->NeoLinearAddr) { - VGAwGR(0x09,0x26); - addr = VGArGR(0x13); - VGAwGR(0x09,0x00); - nPtr->NeoLinearAddr = addr << 20; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "FB base address is set at 0x%lX.\n", - nPtr->NeoLinearAddr); - } - if (!nPtr->NeoMMIOAddr && !nPtr->noMMIO) { - nPtr->NeoMMIOAddr = nPtr->NeoLinearAddr + 0x100000; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "MMIO base address is set at 0x%lX.\n", - nPtr->NeoMMIOAddr); - } - - linearRes[0].rBegin = nPtr->NeoLinearAddr; - linearRes[1].rEnd = nPtr->NeoLinearAddr + nPtr->NeoFbMapSize - 1; - if (xf86RegisterResources(nPtr->pEnt->index,linearRes,ResNone)) { - RETURN; - } - } -#endif else RETURN; @@ -1641,27 +1528,9 @@ NEOScreenInit(SCREEN_INIT_ARGS_DECL) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Too little space for pixmap cache.\n"); } - switch(nPtr->NeoChipset) { - case NM2070 : - ret = Neo2070AccelInit(pScreen); - break; - case NM2090 : - case NM2093 : - ret = Neo2090AccelInit(pScreen); - break; - case NM2097 : - case NM2160 : - ret = Neo2097AccelInit(pScreen); - break; - case NM2200 : - case NM2230 : - case NM2360 : - case NM2380 : - ret = Neo2200AccelInit(pScreen); - break; - } + xf86DrvMsg(pScrn->scrnIndex,X_INFO, - "Acceleration %s Initialized\n",ret ? "" : "not"); + "Acceleration not available\n"); } xf86SetBackingStore(pScreen); @@ -1830,10 +1699,6 @@ NEOCloseScreen(CLOSE_SCREEN_ARGS_DECL) neoLock(pScrn); neoUnmapMem(pScrn); } -#ifdef HAVE_XAA_H - if (nPtr->AccelInfoRec) - XAADestroyInfoRec(nPtr->AccelInfoRec); -#endif if (nPtr->CursorInfo) xf86DestroyCursorInfoRec(nPtr->CursorInfo); if (nPtr->ShadowPtr) |