diff options
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | src/ast.h | 14 | ||||
-rw-r--r-- | src/ast_accel.c | 1631 | ||||
-rw-r--r-- | src/ast_driver.c | 90 |
4 files changed, 5 insertions, 1751 deletions
diff --git a/configure.ac b/configure.ac index 710e1ea..78f157c 100644 --- a/configure.ac +++ b/configure.ac @@ -58,7 +58,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto) XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Obtain compiler/linker options for the driver dependencies -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto >= 7.0.22 fontsproto $REQUIRED_MODULES]) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18 xproto >= 7.0.22 fontsproto $REQUIRED_MODULES]) # Checks for libraries. SAVE_CPPFLAGS="$CPPFLAGS" @@ -74,25 +74,6 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then fi AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) -AC_ARG_ENABLE(xaa, - AS_HELP_STRING([--enable-xaa], - [Enable legacy X Acceleration Architecture (XAA) [default=auto]]), - [XAA="$enableval"], - [XAA=auto]) -if test "x$XAA" != xno; then - save_CFLAGS=$CFLAGS - save_CPPFLAGS=$CPPFLAGS - CFLAGS=$XORG_CFLAGS - CPPFLAGS="$XORG_CFLAGS" - AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no) - CFLAGS=$save_CFLAGS - CPPFLAGS=$save_CPPFLAGS -fi -AC_MSG_CHECKING([whether to include XAA support]) -AM_CONDITIONAL(XAA, test "x$XAA" = xyes) -AC_MSG_RESULT([$XAA]) - - AC_SUBST([moduledir]) DRIVER_NAME=nv @@ -34,10 +34,6 @@ #include <string.h> #include <stdlib.h> -#ifdef HAVE_XAA_H -#include "xaa.h" -#endif - #include "ast_pcirename.h" #include "compat-api.h" @@ -231,9 +227,6 @@ typedef struct _ASTRec { OptionInfoPtr Options; DisplayModePtr ModePtr; FBLinearPtr pCMDQPtr; -#ifdef HAVE_XAA_H - XAAInfoRecPtr AccelInfoPtr; -#endif xf86CursorInfoPtr HWCInfoPtr; FBLinearPtr pHWCPtr; @@ -266,11 +259,7 @@ typedef struct _ASTRec { unsigned long FbMapSize; unsigned long MMIOMapSize; -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - IOADDRESS RelocateIO; -#else int RelocateIO; -#endif VIDEOMODE VideoModeInfo; ASTRegRec SavedReg; @@ -351,9 +340,6 @@ void ASTDisableHWC(ScrnInfoPtr pScrn); Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); /* ast_accel.c */ -#ifdef HAVE_XAA_H -Bool ASTAccelInit(ScreenPtr pScreen); -#endif void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxes, int id); /* ast_tool.c */ diff --git a/src/ast_accel.c b/src/ast_accel.c index 701624f..eb9d0ec 100644 --- a/src/ast_accel.c +++ b/src/ast_accel.c @@ -41,12 +41,6 @@ /* framebuffer offscreen manager */ #include "xf86fbman.h" -/* include xaa includes */ -#ifdef HAVE_XAA_H -#include "xaa.h" -#include "xaarop.h" -#endif - /* H/W cursor support */ #include "xf86Cursor.h" @@ -56,1631 +50,6 @@ #ifdef Accel_2D -#ifdef HAVE_XAA_H -/* ROP Translation Table */ -int ASTXAACopyROP[16] = -{ - ROP_0, /* GXclear */ - ROP_DSa, /* GXand */ - ROP_SDna, /* GXandReverse */ - ROP_S, /* GXcopy */ - ROP_DSna, /* GXandInverted */ - ROP_D, /* GXnoop */ - ROP_DSx, /* GXxor */ - ROP_DSo, /* GXor */ - ROP_DSon, /* GXnor */ - ROP_DSxn, /* GXequiv */ - ROP_Dn, /* GXinvert*/ - ROP_SDno, /* GXorReverse */ - ROP_Sn, /* GXcopyInverted */ - ROP_DSno, /* GXorInverted */ - ROP_DSan, /* GXnand */ - ROP_1 /* GXset */ -}; - -int ASTXAAPatternROP[16]= -{ - ROP_0, - ROP_DPa, - ROP_PDna, - ROP_P, - ROP_DPna, - ROP_D, - ROP_DPx, - ROP_DPo, - ROP_DPon, - ROP_PDxn, - ROP_Dn, - ROP_PDno, - ROP_Pn, - ROP_DPno, - ROP_DPan, - ROP_1 -}; - -/* Prototype type declaration */ -static void ASTSync(ScrnInfoPtr pScrn); -static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, int trans_color); -static void ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h); -static void ASTSetupForSolidFill(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask); -static void ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn, - int dst_x, int dst_y, int width, int height); -static void ASTSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask); -static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir); -static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags); -static void ASTSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask, - int length, UCHAR *pattern); -static void ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase); -static void ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask); -static void ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h); -static void ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, - int rop, unsigned int planemask, int trans_col); -static void ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, - int x, int y, int w, int h); -static void ASTSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask); -static void ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int width, int height, int skipleft); -static void ASTSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask); -static void ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int width, int height, - int src_x, int src_y, int offset); -static void ASTSetClippingRectangle(ScrnInfoPtr pScrn, - int left, int top, int right, int bottom); -static void ASTDisableClipping(ScrnInfoPtr pScrn); -static void ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y); - -static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags); -static void AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase); - -Bool -ASTAccelInit(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - ASTRecPtr pAST = ASTPTR(pScrn); - - pAST->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - infoPtr->Flags = LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS | - PIXMAP_CACHE; - - /* Sync */ - if (pAST->ENGCaps & ENG_CAP_Sync) - infoPtr->Sync = ASTSync; - - /* Screen To Screen copy */ - if (pAST->ENGCaps & ENG_CAP_ScreenToScreenCopy) - { - infoPtr->SetupForScreenToScreenCopy = ASTSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = ASTSubsequentScreenToScreenCopy; - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; - } - - /* Solid fill */ - if (pAST->ENGCaps & ENG_CAP_SolidFill) - { - infoPtr->SetupForSolidFill = ASTSetupForSolidFill; - infoPtr->SubsequentSolidFillRect = ASTSubsequentSolidFillRect; - infoPtr->SolidFillFlags = NO_PLANEMASK; - } - - /* Solid Lines */ - if (pAST->ENGCaps & ENG_CAP_SolidLine) - { - if ( (pAST->jChipType == AST2300) || (pAST->jChipType == AST2400) || (pAST->jChipType == AST2500) || (pAST->jChipType == AST1180) ) - { - infoPtr->SubsequentSolidTwoPointLine = AIPSubsequentSolidTwoPointLine; - } - else - { - infoPtr->SubsequentSolidTwoPointLine = ASTSubsequentSolidTwoPointLine; - } - - infoPtr->SetupForSolidLine = ASTSetupForSolidLine; - infoPtr->SubsequentSolidHorVertLine = ASTSubsequentSolidHorVertLine; - infoPtr->SolidLineFlags = NO_PLANEMASK; - } - - /* Dashed Lines */ - if (pAST->ENGCaps & ENG_CAP_DashedLine) - { - if ( (pAST->jChipType == AST2300) || (pAST->jChipType == AST2400) || (pAST->jChipType == AST2500) || (pAST->jChipType == AST1180) ) - { - infoPtr->SubsequentDashedTwoPointLine = AIPSubsequentDashedTwoPointLine; - } - else - { - infoPtr->SubsequentDashedTwoPointLine = ASTSubsequentDashedTwoPointLine; - } - - infoPtr->SetupForDashedLine = ASTSetupForDashedLine; - infoPtr->DashPatternMaxLength = 64; - infoPtr->DashedLineFlags = NO_PLANEMASK | - LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; - } - - /* 8x8 mono pattern fill */ - if (pAST->ENGCaps & ENG_CAP_Mono8x8PatternFill) - { - infoPtr->SetupForMono8x8PatternFill = ASTSetupForMonoPatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = ASTSubsequentMonoPatternFill; - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - NO_TRANSPARENCY | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - BIT_ORDER_IN_BYTE_MSBFIRST; - } - - /* 8x8 color pattern fill */ - if (pAST->ENGCaps & ENG_CAP_Color8x8PatternFill) - { - infoPtr->SetupForColor8x8PatternFill = ASTSetupForColor8x8PatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = ASTSubsequentColor8x8PatternFillRect; - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - NO_TRANSPARENCY | - HARDWARE_PATTERN_SCREEN_ORIGIN; - } - - /* CPU To Screen Color Expand */ - if (pAST->ENGCaps & ENG_CAP_CPUToScreenColorExpand) - { - infoPtr->SetupForCPUToScreenColorExpandFill = ASTSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = ASTSubsequentCPUToScreenColorExpandFill; - infoPtr->ColorExpandRange = MAX_PATReg_Size; - infoPtr->ColorExpandBase = MMIOREG_PAT; - infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST; - } - - /* Screen To Screen Color Expand */ - if (pAST->ENGCaps & ENG_CAP_ScreenToScreenColorExpand) - { - infoPtr->SetupForScreenToScreenColorExpandFill = ASTSetupForScreenToScreenColorExpandFill; - infoPtr->SubsequentScreenToScreenColorExpandFill = ASTSubsequentScreenToScreenColorExpandFill; - infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST; - } - - /* Clipping */ - if (pAST->ENGCaps & ENG_CAP_Clipping) - { - infoPtr->SetClippingRectangle = ASTSetClippingRectangle; - infoPtr->DisableClipping = ASTDisableClipping; - infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | - HARDWARE_CLIP_MONO_8x8_FILL | - HARDWARE_CLIP_COLOR_8x8_FILL | - HARDWARE_CLIP_SOLID_LINE | - HARDWARE_CLIP_DASHED_LINE | - HARDWARE_CLIP_SOLID_LINE; - } - - return(XAAInit(pScreen, infoPtr)); - -} /* end of ASTAccelInit */ - -static void -ASTSync(ScrnInfoPtr pScrn) -{ - ASTRecPtr pAST = ASTPTR(pScrn); - - /* wait engle idle */ - vASTWaitEngIdle(pScrn, pAST); - -} /* end of ASTSync */ - - -static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, int trans_color) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForScreenToScreenCopy\n"); -*/ - /* Modify Reg. Value */ - cmdreg = CMD_BITBLT; - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAACopyROP[rop] << 8); - pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); - - ASTSetupSRCPitch(pSingleCMD, pAST->VideoModeInfo.ScreenPitch); - pSingleCMD++; - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - /* Write to MMIO */ - ASTSetupSRCPitch_MMIO(pAST->VideoModeInfo.ScreenPitch); - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - } - -} /* end of ASTSetupForScreenToScreenCopy */ - -static void -ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int width, int height) -{ - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - int src_x, src_y, dst_x, dst_y; - ULONG srcbase, dstbase, cmdreg; - int delta_y = 0; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenCopy\n"); -*/ - - if ((width != 0) && (height != 0)) - { - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - else - cmdreg &= ~CMD_ENABLE_CLIP; - srcbase = dstbase = 0; - - if (x1 < x2) - cmdreg |= CMD_X_DEC; - - if (y1 < y2) - cmdreg |= CMD_Y_DEC; - - if ((y1 + height) >= MAX_SRC_Y) - { - srcbase=pAST->VideoModeInfo.ScreenPitch*y1; - y1 = 0; - } - - if ((y2 + height) >= pScrn->virtualY) - { - delta_y = y2; - dstbase=pAST->VideoModeInfo.ScreenPitch*y2; - y2 = 0; - } - - if (cmdreg & CMD_X_DEC) - { - src_x = x1 + width - 1; - dst_x = x2 + width - 1; - } - else - { - src_x = x1; - dst_x = x2; - } - - if (cmdreg & CMD_Y_DEC) - { - src_y = y1 + height - 1; - dst_y = y2 + height - 1; - } - else - { - src_y = y1; - dst_y = y2; - } - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6); - - ASTSetupSRCBase(pSingleCMD, srcbase); - pSingleCMD++; - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; - ASTSetupSRCXY(pSingleCMD, src_x, src_y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupSRCBase_MMIO(srcbase); - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(dst_x, dst_y); - ASTSetupSRCXY_MMIO(src_x, src_y); - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vASTWaitEngIdle(pScrn, pAST); - } - - } /* width & height check */ - -} /* end of ASTSubsequentScreenToScreenCopy */ - -static void -ASTSetupForSolidFill(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForSolidFill\n"); -*/ - /* Modify Reg. Value */ - cmdreg = CMD_BITBLT | CMD_PAT_FGCOLOR; - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAAPatternROP[rop] << 8); - pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, color); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(color); - } - -} /* end of ASTSetupForSolidFill */ - - -static void -ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn, - int dst_x, int dst_y, int width, int height) -{ - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG dstbase, cmdreg; - int delta_y = 0; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidFillRect\n"); -*/ - - if ((width != 0) && (height != 0)) - { - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - else - cmdreg &= ~CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - delta_y = dst_y; - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(dst_x, dst_y); - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vASTWaitEngIdle(pScrn, pAST); - - } - - } /* width & height check */ - - -} /* end of ASTSubsequentSolidFillRect */ - -/* Line */ -static void ASTSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForSolidLine\n"); -*/ - /* Modify Reg. Value */ - cmdreg = CMD_BITBLT; - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAAPatternROP[rop] << 8); - pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, color); - pSingleCMD++; - ASTSetupBG(pSingleCMD, 0); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - /* Write to MMIO */ - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(color); - ASTSetupBG_MMIO(0); - } - -} /* end of ASTSetupForSolidLine */ - - -static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, - int x, int y, int len, int dir) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG dstbase, cmdreg; - int width, height; - int delta_y = 0; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidHorVertLine\n"); -*/ - - if (len != 0) - { - /* Modify Reg. Value */ - cmdreg = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - else - cmdreg &= ~CMD_ENABLE_CLIP; - dstbase = 0; - - if(dir == DEGREES_0) { /* horizontal */ - width = len; - height = 1; - } else { /* vertical */ - width = 1; - height = len; - } - - if ((y + height) >= pScrn->virtualY) - { - delta_y = y; - dstbase=pAST->VideoModeInfo.ScreenPitch*y; - y=0; - } - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, x, y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(x, y); - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vASTWaitEngIdle(pScrn, pAST); - - } - - } /* len check */ - -} /* end of ASTSubsequentSolidHorVertLine */ - -static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - LINEPARAM dsLineParam; - _LINEInfo LineInfo; - ULONG dstbase, ulCommand; - ULONG miny, maxy; - USHORT usXM; - int delta_y = 0; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n"); -*/ - - /* Modify Reg. Value */ - ulCommand = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW; - if(flags & OMIT_LAST) - ulCommand |= CMD_NOT_DRAW_LAST_PIXEL; - else - ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; - if (pAST->EnableClip) - ulCommand |= CMD_ENABLE_CLIP; - else - ulCommand &= ~CMD_ENABLE_CLIP; - dstbase = 0; - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= pScrn->virtualY) { - delta_y = miny; - dstbase = pAST->VideoModeInfo.ScreenPitch * miny; - y1 -= miny; - y2 -= miny; - } - - LineInfo.X1 = x1; - LineInfo.Y1 = y1; - LineInfo.X2 = x2; - LineInfo.Y2 = y2; - - bASTGetLineTerm(&LineInfo, &dsLineParam); /* Get Line Parameter */ - - if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC) - ulCommand |= CMD_X_DEC; - if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC) - ulCommand |= CMD_Y_DEC; - - usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0; - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*7); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupLineXY(pSingleCMD, dsLineParam.dsLineX, dsLineParam.dsLineY); - pSingleCMD++; - ASTSetupLineXMErrTerm(pSingleCMD, usXM , dsLineParam.dwErrorTerm); - pSingleCMD++; - ASTSetupLineWidth(pSingleCMD, dsLineParam.dsLineWidth); - pSingleCMD++; - ASTSetupLineK1Term(pSingleCMD, dsLineParam.dwK1Term); - pSingleCMD++; - ASTSetupLineK2Term(pSingleCMD, dsLineParam.dwK2Term); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - - /* Update Write Pointer */ - mUpdateWritePointer; - - /* Patch KDE pass abnormal point, ycchen@052507 */ - vASTWaitEngIdle(pScrn, pAST); - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupLineXY_MMIO(dsLineParam.dsLineX, dsLineParam.dsLineY); - ASTSetupLineXMErrTerm_MMIO( usXM , dsLineParam.dwErrorTerm); - ASTSetupLineWidth_MMIO(dsLineParam.dsLineWidth); - ASTSetupLineK1Term_MMIO(dsLineParam.dwK1Term); - ASTSetupLineK2Term_MMIO(dsLineParam.dwK2Term); - ASTSetupCMDReg_MMIO(ulCommand); - - vASTWaitEngIdle(pScrn, pAST); - - } - - -} /* end of ASTSubsequentSolidTwoPointLine */ - -/* Dash Line */ -static void -ASTSetupForDashedLine(ScrnInfoPtr pScrn, - int fg, int bg, int rop, unsigned int planemask, - int length, UCHAR *pattern) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForDashedLine\n"); -*/ - /* Modify Reg. Value */ - cmdreg = CMD_LINEDRAW | CMD_RESET_STYLE_COUNTER | CMD_ENABLE_LINE_STYLE; - - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAAPatternROP[rop] << 8); - if(bg == -1) { - cmdreg |= CMD_TRANSPARENT; - bg = 0; - } - cmdreg |= (((length-1) & 0x3F) << 24); /* line period */ - pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); - pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); - pSingleCMD++; - ASTSetupLineStyle1(pSingleCMD, *pattern); - pSingleCMD++; - ASTSetupLineStyle2(pSingleCMD, *(pattern+4)); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - /* Write to MMIO */ - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); - ASTSetupBG_MMIO(bg); - ASTSetupLineStyle1_MMIO(*pattern); - ASTSetupLineStyle2_MMIO(*(pattern+4)); - - } - -} - -static void -ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - LINEPARAM dsLineParam; - _LINEInfo LineInfo; - ULONG dstbase, ulCommand; - ULONG miny, maxy; - USHORT usXM; - int delta_y = 0; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n"); -*/ - - /* Modify Reg. Value */ - ulCommand = pAST->ulCMDReg; - if(flags & OMIT_LAST) - ulCommand |= CMD_NOT_DRAW_LAST_PIXEL; - else - ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; - if (pAST->EnableClip) - ulCommand |= CMD_ENABLE_CLIP; - else - ulCommand &= ~CMD_ENABLE_CLIP; - dstbase = 0; - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= pScrn->virtualY) { - delta_y = miny; - dstbase = pAST->VideoModeInfo.ScreenPitch * miny; - y1 -= miny; - y2 -= miny; - } - - LineInfo.X1 = x1; - LineInfo.Y1 = y1; - LineInfo.X2 = x2; - LineInfo.Y2 = y2; - - bASTGetLineTerm(&LineInfo, &dsLineParam); /* Get Line Parameter */ - - if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC) - ulCommand |= CMD_X_DEC; - if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC) - ulCommand |= CMD_Y_DEC; - - usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0; - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*7); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupLineXY(pSingleCMD, dsLineParam.dsLineX, dsLineParam.dsLineY); - pSingleCMD++; - ASTSetupLineXMErrTerm(pSingleCMD, usXM , dsLineParam.dwErrorTerm); - pSingleCMD++; - ASTSetupLineWidth(pSingleCMD, dsLineParam.dsLineWidth); - pSingleCMD++; - ASTSetupLineK1Term(pSingleCMD, dsLineParam.dwK1Term); - pSingleCMD++; - ASTSetupLineK2Term(pSingleCMD, dsLineParam.dwK2Term); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - - /* Update Write Pointer */ - mUpdateWritePointer; - - /* Patch KDE pass abnormal point, ycchen@052507 */ - vASTWaitEngIdle(pScrn, pAST); - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupLineXY_MMIO(dsLineParam.dsLineX, dsLineParam.dsLineY); - ASTSetupLineXMErrTerm_MMIO( usXM , dsLineParam.dwErrorTerm); - ASTSetupLineWidth_MMIO(dsLineParam.dsLineWidth); - ASTSetupLineK1Term_MMIO(dsLineParam.dwK1Term); - ASTSetupLineK2Term_MMIO(dsLineParam.dwK2Term); - ASTSetupCMDReg_MMIO(ulCommand); - - vASTWaitEngIdle(pScrn, pAST); - - } - -} - -/* Mono Pattern Fill */ -static void -ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForMonoPatternFill\n"); -*/ - /* Modify Reg. Value */ - cmdreg = CMD_BITBLT | CMD_PAT_MONOMASK; - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAAPatternROP[rop] << 8); - pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); - pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); - pSingleCMD++; - ASTSetupMONO1(pSingleCMD, patx); - pSingleCMD++; - ASTSetupMONO2(pSingleCMD, paty); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); - ASTSetupBG_MMIO(bg); - ASTSetupMONO1_MMIO(patx); - ASTSetupMONO2_MMIO(paty); - } - -} /* end of ASTSetupForMonoPatternFill */ - - -static void -ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn, - int patx, int paty, - int dst_x, int dst_y, int width, int height) -{ - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG dstbase, cmdreg; - int delta_y = 0; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentMonoPatternFill\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - else - cmdreg &= ~CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - delta_y = dst_y; - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(dst_x, dst_y); - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vASTWaitEngIdle(pScrn, pAST); - } - -} /* end of ASTSubsequentMonoPatternFill */ - -static void -ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, - int rop, unsigned int planemask, int trans_col) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; - CARD32 *pataddr; - ULONG ulPatSize; - int i, j, cpp; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForColor8x8PatternFill\n"); -*/ - /* Modify Reg. Value */ - cmdreg = CMD_BITBLT | CMD_PAT_PATREG; - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAAPatternROP[rop] << 8); - pAST->ulCMDReg = cmdreg; - cpp = (pScrn->bitsPerPixel + 1) / 8; - pataddr = (CARD32 *)(pAST->FBVirtualAddr + - (paty * pAST->VideoModeInfo.ScreenPitch) + (patx * cpp)); - ulPatSize = 8*8*cpp; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*(1 + ulPatSize/4)); - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - for (i=0; i<8; i++) - { - for (j=0; j<8*cpp/4; j++) - { - ASTSetupPatReg(pSingleCMD, (i*j + j) , (*(CARD32 *) (pataddr++))); - pSingleCMD++; - } - } - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - for (i=0; i<8; i++) - { - for (j=0; j<8*cpp/4; j++) - { - ASTSetupPatReg_MMIO((i*j + j) , (*(CARD32 *) (pataddr++))); - } - } - - } - -} /* end of ASTSetupForColor8x8PatternFill */ - -static void -ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, - int dst_x, int dst_y, int width, int height) -{ - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG dstbase, cmdreg; - int delta_y = 0; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentColor8x8PatternFillRect\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - else - cmdreg &= ~CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - delta_y = dst_y; - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(dst_x, dst_y); - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vASTWaitEngIdle(pScrn, pAST); - } - -} /* ASTSubsequentColor8x8PatternFillRect */ - -/* CPU to Screen Expand */ -static void -ASTSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForCPUToScreenColorExpandFill\n"); -*/ - /* Modify Reg. Value */ - cmdreg = CMD_COLOREXP; - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAAPatternROP[rop] << 8); - if(bg == -1) { - cmdreg |= CMD_FONT_TRANSPARENT; - bg = 0; - } - pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); - pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); - ASTSetupBG_MMIO(bg); - - } - -} - -static void -ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int dst_x, int dst_y, - int width, int height, int offset) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG dstbase, cmdreg; - int delta_y = 0; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentCPUToScreenColorExpandFill\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - else - cmdreg &= ~CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - delta_y = dst_y; - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); - - ASTSetupSRCPitch(pSingleCMD, ((width+7)/8)); - pSingleCMD++; - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupSRCPitch_MMIO((width+7)/8); - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(dst_x, dst_y); - ASTSetupSRCXY_MMIO(0, 0); - - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vASTWaitEngIdle(pScrn, pAST); - - } - -} - - -/* Screen to Screen Color Expand */ -static void -ASTSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG cmdreg; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForScreenToScreenColorExpandFill\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = CMD_ENHCOLOREXP; - switch (pAST->VideoModeInfo.bitsPerPixel) - { - case 8: - cmdreg |= CMD_COLOR_08; - break; - case 15: - case 16: - cmdreg |= CMD_COLOR_16; - break; - case 24: - case 32: - cmdreg |= CMD_COLOR_32; - break; - } - cmdreg |= (ASTXAAPatternROP[rop] << 8); - if(bg == -1) { - cmdreg |= CMD_FONT_TRANSPARENT; - bg = 0; - } - pAST->ulCMDReg = cmdreg; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); - pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1); - ASTSetupFG_MMIO(fg); - ASTSetupBG_MMIO(bg); - - } - -} - - - -static void -ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int dst_x, int dst_y, int width, int height, - int src_x, int src_y, int offset) -{ - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG srcbase, dstbase, cmdreg; - USHORT srcpitch; - int delta_y = 0; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenColorExpandFill\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - else - cmdreg &= ~CMD_ENABLE_CLIP; - dstbase = 0; - if (dst_y >= pScrn->virtualY) - { - delta_y = dst_y; - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - srcbase = pAST->VideoModeInfo.ScreenPitch*src_y + ((pScrn->bitsPerPixel+1)/8)*src_x; - srcpitch = (pScrn->displayWidth+7)/8; - - if (pAST->EnableClip) - ASTSetHWClipping(pScrn, delta_y); - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6); - - ASTSetupSRCBase(pSingleCMD, srcbase); - pSingleCMD++; - ASTSetupSRCPitch(pSingleCMD,srcpitch); - pSingleCMD++; - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - ASTSetupDSTXY(pSingleCMD, dst_x, dst_y); - pSingleCMD++; - ASTSetupRECTXY(pSingleCMD, width, height); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, cmdreg); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupSRCBase_MMIO(srcbase); - ASTSetupSRCPitch_MMIO(srcpitch); - ASTSetupDSTBase_MMIO(dstbase); - ASTSetupDSTXY_MMIO(dst_x, dst_y); - ASTSetupRECTXY_MMIO(width, height); - ASTSetupCMDReg_MMIO(cmdreg); - - vASTWaitEngIdle(pScrn, pAST); - - } - -} - - -/* Clipping */ -static void -ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y) -{ - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); - - ASTSetupCLIP1(pSingleCMD, pAST->clip_left, pAST->clip_top - delta_y); - pSingleCMD++; - ASTSetupCLIP2(pSingleCMD, pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1); - - /* Update Write Pointer */ - mUpdateWritePointer; - - } - else - { - ASTSetupCLIP1_MMIO(pAST->clip_left, pAST->clip_top - delta_y); - ASTSetupCLIP2_MMIO(pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1); - } - -} - -static void -ASTSetClippingRectangle(ScrnInfoPtr pScrn, - int left, int top, int right, int bottom) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetClippingRectangle\n"); -*/ - pAST->EnableClip = TRUE; - - pAST->clip_left = left; - pAST->clip_top = top; - pAST->clip_right = right; - pAST->clip_bottom = bottom; - -} - -static void -ASTDisableClipping(ScrnInfoPtr pScrn) -{ - ASTRecPtr pAST = ASTPTR(pScrn); -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTDisableClipping\n"); -*/ - pAST->EnableClip = FALSE; -} - -static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG dstbase, ulCommand; - ULONG miny, maxy; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n"); -*/ - - /* Modify Reg. Value */ - ulCommand = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW | CMD_NORMAL_LINE; - if(flags & OMIT_LAST) - ulCommand |= CMD_NOT_DRAW_LAST_PIXEL; - else - ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; - if (pAST->EnableClip) - ulCommand |= CMD_ENABLE_CLIP; - else - ulCommand &= ~CMD_ENABLE_CLIP; - dstbase = 0; - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= pScrn->virtualY) { - dstbase = pAST->VideoModeInfo.ScreenPitch * miny; - y1 -= miny; - y2 -= miny; - } - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - AIPSetupLineXY(pSingleCMD, x1, y1); - pSingleCMD++; - AIPSetupLineXY2(pSingleCMD, x2, y2); - pSingleCMD++; - AIPSetupLineNumber(pSingleCMD, 0); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - - /* Update Write Pointer */ - mUpdateWritePointer; - - /* Patch KDE pass abnormal point, ycchen@052507 */ - vASTWaitEngIdle(pScrn, pAST); - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - AIPSetupLineXY_MMIO(x1, y1); - AIPSetupLineXY2_MMIO(x2, y2); - AIPSetupLineNumber_MMIO(0); - ASTSetupCMDReg_MMIO(ulCommand); - - vASTWaitEngIdle(pScrn, pAST); - - } - - -} /* end of AIPSubsequentSolidTwoPointLine */ - -static void -AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase) -{ - - ASTRecPtr pAST = ASTPTR(pScrn); - PKT_SC *pSingleCMD; - ULONG dstbase, ulCommand; - ULONG miny, maxy; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n"); -*/ - - /* Modify Reg. Value */ - ulCommand = pAST->ulCMDReg | CMD_NORMAL_LINE; - if(flags & OMIT_LAST) - ulCommand |= CMD_NOT_DRAW_LAST_PIXEL; - else - ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL; - if (pAST->EnableClip) - ulCommand |= CMD_ENABLE_CLIP; - else - ulCommand &= ~CMD_ENABLE_CLIP; - dstbase = 0; - miny = (y1 > y2) ? y2 : y1; - maxy = (y1 > y2) ? y1 : y2; - if(maxy >= pScrn->virtualY) { - dstbase = pAST->VideoModeInfo.ScreenPitch * miny; - y1 -= miny; - y2 -= miny; - } - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pASTjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5); - - ASTSetupDSTBase(pSingleCMD, dstbase); - pSingleCMD++; - AIPSetupLineXY(pSingleCMD, x1, y1); - pSingleCMD++; - AIPSetupLineXY2(pSingleCMD, x2, y2); - pSingleCMD++; - AIPSetupLineNumber(pSingleCMD, 0); - pSingleCMD++; - ASTSetupCMDReg(pSingleCMD, ulCommand); - - /* Update Write Pointer */ - mUpdateWritePointer; - - /* Patch KDE pass abnormal point, ycchen@052507 */ - vASTWaitEngIdle(pScrn, pAST); - - } - else - { - ASTSetupDSTBase_MMIO(dstbase); - AIPSetupLineXY_MMIO(x1, y1); - AIPSetupLineXY2_MMIO(x2, y2); - AIPSetupLineNumber_MMIO(0); - ASTSetupCMDReg_MMIO(ulCommand); - - vASTWaitEngIdle(pScrn, pAST); - - } - -} -#endif /* HAVE_XAA_H */ - #ifdef AstVideo /* * Video Part diff --git a/src/ast_driver.c b/src/ast_driver.c index 0f078a2..5eaa2e9 100644 --- a/src/ast_driver.c +++ b/src/ast_driver.c @@ -25,10 +25,6 @@ #endif #include "xf86.h" #include "xf86_OSproc.h" -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 -#include "xf86Resources.h" -#include "xf86RAC.h" -#endif #include "xf86cmap.h" #include "compiler.h" #include "vgaHW.h" @@ -45,12 +41,6 @@ /* framebuffer offscreen manager */ #include "xf86fbman.h" -/* include xaa includes */ -#ifdef HAVE_XAA_H -#include "xaa.h" -#include "xaarop.h" -#endif - /* H/W cursor support */ #include "xf86Cursor.h" @@ -90,11 +80,7 @@ static Bool ASTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void ASTInitVideo(ScreenPtr pScreen); static int ASTPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, - int, unsigned char*, short, short, Bool, RegionPtr, pointer -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 1 - , DrawablePtr pDraw -#endif - ); + int, unsigned char*, short, short, Bool, RegionPtr, pointer, DrawablePtr); #endif /* @@ -281,11 +267,7 @@ ASTProbe(DriverPtr drv, int flags) pPci->device_id, pPci->bus, pPci->domain, pPci->dev, pPci->func); xf86DrvMsg(0, X_ERROR, "ast: This driver cannot operate until it has been unloaded.\n"); - xf86UnclaimPciSlot(pPci -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 13 - , devSections[0] -#endif - ); + xf86UnclaimPciSlot(pPci, devSections[0]); free(devSections); return FALSE; } @@ -541,19 +523,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown ast"); -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12 - /* "Patch" the PIOOffset inside vgaHW in order to force - * the vgaHW module to use our relocated i/o ports. - */ - VGAHWPTR(pScrn)->PIOOffset = - pScrn->domainIOBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380; - - pAST->RelocateIO = pScrn->domainIOBase + - PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO); -#else - pAST->RelocateIO = (PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO)); - -#endif + pAST->RelocateIO = (PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO)); if (pAST->pEnt->device->MemBase != 0) { @@ -745,35 +715,6 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags) pAST->CMDQInfo.pjWritePort = pAST->MMIOVirtualAddr+ 0x8048; pAST->CMDQInfo.pjReadPort = pAST->MMIOVirtualAddr+ 0x804C; pAST->CMDQInfo.pjEngStatePort = pAST->MMIOVirtualAddr+ 0x804C; -#ifdef HAVE_XAA_H - pAST->AccelInfoPtr = NULL; -#ifdef Accel_2D - if (!xf86ReturnOptValBool(pAST->Options, OPTION_NOACCEL, FALSE)) - { - if (xf86LoadSubModule(pScrn, "xaa")) { - - pAST->noAccel = FALSE; - pAST->MMIO2D = TRUE; -#ifndef MMIO_2D - if (!xf86ReturnOptValBool(pAST->Options, OPTION_MMIO2D, FALSE)) { - pAST->CMDQInfo.ulCMDQSize = DEFAULT_CMDQ_SIZE; - pAST->MMIO2D = FALSE; - } -#endif - - pAST->ENGCaps = ENG_CAP_ALL; - if (!xf86GetOptValInteger(pAST->Options, OPTION_ENG_CAPS, &pAST->ENGCaps)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No ENG Capability options found\n"); - } - - pAST->DBGSelect = 0; - if (!xf86GetOptValInteger(pAST->Options, OPTION_DBG_SELECT, &pAST->DBGSelect)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No DBG Seleclt options found\n"); - } - } - } -#endif -#endif /* HAVE_XAA_H */ /* HW Cursor Check */ pAST->noHWC = TRUE; @@ -964,19 +905,6 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL) #endif xf86SetBlackWhitePixels(pScreen); - -#ifdef HAVE_XAA_H -#ifdef Accel_2D - if (!pAST->noAccel) - { - if (!ASTAccelInit(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Hardware acceleration initialization failed\n"); - pAST->noAccel = TRUE; - } - } -#endif /* end of Accel_2D */ -#endif - xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); @@ -1332,12 +1260,6 @@ ASTCloseScreen(CLOSE_SCREEN_ARGS_DECL) vgaHWUnmapMem(pScrn); #endif -#ifdef HAVE_XAA_H - if(pAST->AccelInfoPtr) { - XAADestroyInfoRec(pAST->AccelInfoPtr); - pAST->AccelInfoPtr = NULL; - } -#endif if(pAST->HWCInfoPtr) { xf86DestroyCursorInfoRec(pAST->HWCInfoPtr); pAST->HWCInfoPtr = NULL; @@ -2107,11 +2029,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn, int id, unsigned char* buf, short width, short height, Bool sync, - RegionPtr clipBoxes, pointer data -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 1 - , DrawablePtr pDraw -#endif -) + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw) { ASTPtr pAST = ASTPTR(pScrn); ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data; |