From 245466d4ef8ea4012242a3fa21a217e767f4eac4 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 15 Mar 2006 00:43:18 +0000 Subject: Add the normal trappings of the Xorg modular build system. Replace "Xv.h" with and add #include "config.h" for modular build Strip ^M out of ast_accel.c --- .cvsignore | 19 + COPYING | 19 + ChangeLog | 24 +- Makefile.am | 22 + autogen.sh | 12 + configure.ac | 77 ++ src/.cvsignore | 6 + src/Makefile.am | 44 + src/ast_2dtool.c | 5 +- src/ast_accel.c | 2777 +++++++++++++++++++++++++++-------------------------- src/ast_cursor.c | 5 +- src/ast_driver.c | 5 +- src/ast_mode.c | 5 +- src/ast_tool.c | 5 +- src/ast_vgatool.c | 5 +- 15 files changed, 1636 insertions(+), 1394 deletions(-) create mode 100644 .cvsignore create mode 100644 COPYING create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 src/.cvsignore create mode 100644 src/Makefile.am diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..fb1befd --- /dev/null +++ b/.cvsignore @@ -0,0 +1,19 @@ +Makefile +Makefile.in +*.la +*.lo +aclocal.m4 +autom4te.cache +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +depcomp +install-sh +libtool +ltmain.sh +missing +stamp-h1 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..0d1b2a9 --- /dev/null +++ b/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2005 ASPEED Technology Inc. + +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 the authors not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. The authors makes no representations +about the suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL THE AUTHORS 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. diff --git a/ChangeLog b/ChangeLog index 0509827..dbb2598 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,27 @@ 2006-03-14 Alan Coopersmith + * COPYING: + * autogen.sh: + * configure.ac: + * Makefile.am: + * src/Makefile.am: + * .cvsignore: + * src/.cvsignore: + Add the normal trappings of the Xorg modular build system. + + * ast_2dtool.c: + * ast_accel.c: + * ast_cursor.c: + * ast_driver.c: + * ast_mode.c: + * ast_tool.c: + * ast_vgatool.c: + Replace "Xv.h" with and add + #include "config.h" for modular build + Strip ^M out of ast_accel.c + +2006-03-14 Alan Coopersmith + * src/ast.h: * src/ast_2dtool.c: * src/ast_2dtool.h: @@ -7,7 +29,7 @@ * src/ast_driver.c: * src/ast_vgatool.c: Version 0.80 from ASPEED Technology Inc. - (Fixed get video buffer size incorrect issue) + (Fixed abnormal display if set 2D Acceleration Option as MMIO mode) Bugzilla #4937 Attachment #4932 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..018155e --- /dev/null +++ b/Makefile.am @@ -0,0 +1,22 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +AUTOMAKE_OPTIONS = foreign +SUBDIRS = src \ No newline at end of file diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..904cd67 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? + +$srcdir/configure --enable-maintainer-mode "$@" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..8536e44 --- /dev/null +++ b/configure.ac @@ -0,0 +1,77 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Process this file with autoconf to produce a configure script + +AC_PREREQ(2.57) +AC_INIT([xf86-video-ast], + 0.80, + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], + xf86-video-ast) + +AC_CONFIG_SRCDIR([Makefile.am]) +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_AUX_DIR(.) + +AM_INIT_AUTOMAKE([dist-bzip2]) + +AM_MAINTAINER_MODE + +# Checks for programs. +AC_DISABLE_STATIC +AC_PROG_LIBTOOL +AC_PROG_CC + +AH_TOP([#include "xorg-server.h"]) + +AC_ARG_WITH(xorg-module-dir, + AC_HELP_STRING([--with-xorg-module-dir=DIR], + [Default xorg module directory [[default=$libdir/xorg/modules]]]), + [moduledir="$withval"], + [moduledir="$libdir/xorg/modules"]) + +# Checks for extensions +XORG_DRIVER_CHECK_EXT(RANDR, randrproto) +XORG_DRIVER_CHECK_EXT(RENDER, renderproto) +XORG_DRIVER_CHECK_EXT(XV, videoproto) +XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) + +# Checks for pkg-config packages +PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES]) +sdkdir=$(pkg-config --variable=sdkdir xorg-server) + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC + +AC_SUBST([XORG_CFLAGS]) +AC_SUBST([moduledir]) + +DRIVER_NAME=nv +AC_SUBST([DRIVER_NAME]) + +XORG_MANPAGE_SECTIONS +XORG_RELEASE_VERSION + +AC_OUTPUT([ + Makefile + src/Makefile +]) diff --git a/src/.cvsignore b/src/.cvsignore new file mode 100644 index 0000000..9730646 --- /dev/null +++ b/src/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +Makefile +Makefile.in +*.la +*.lo diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..0396173 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,44 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# this is obnoxious: +# -module lets us name the module exactly how we want +# -avoid-version prevents gratuitous .0.0.0 version numbers on the end +# _ladir passes a dummy rpath to libtool so the thing will actually link +# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. +AM_CFLAGS = @XORG_CFLAGS@ + +ast_drv_la_LTLIBRARIES = ast_drv.la +ast_drv_la_LDFLAGS = -module -avoid-version +ast_drv_ladir = @moduledir@/drivers + +ast_drv_la_SOURCES = \ + ast.h \ + ast_2dtool.c \ + ast_2dtool.h \ + ast_accel.c \ + ast_cursor.c \ + ast_cursor.h \ + ast_driver.c \ + ast_mode.c \ + ast_mode.h \ + ast_tool.c \ + ast_vgatool.c \ + ast_vgatool.h diff --git a/src/ast_2dtool.c b/src/ast_2dtool.c index 22f0b5b..cfdf984 100644 --- a/src/ast_2dtool.c +++ b/src/ast_2dtool.c @@ -20,6 +20,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "xf86.h" #include "xf86_ansic.h" #include "xf86_OSproc.h" @@ -35,7 +38,7 @@ #include "fb.h" #include "regionstr.h" #include "xf86xv.h" -#include "Xv.h" +#include #include "vbe.h" #include "xf86PciInfo.h" diff --git a/src/ast_accel.c b/src/ast_accel.c index 1e327c6..0a31a78 100644 --- a/src/ast_accel.c +++ b/src/ast_accel.c @@ -1,1387 +1,1390 @@ -/* - * Copyright (c) 2005 ASPEED Technology Inc. - * - * 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 the authors not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The authors makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE AUTHORS 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. - */ - -#include "xf86.h" -#include "xf86_ansic.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86RAC.h" -#include "xf86cmap.h" -#include "compiler.h" -#include "mibstore.h" -#include "vgaHW.h" -#include "mipointer.h" -#include "micmap.h" - -#include "fb.h" -#include "regionstr.h" -#include "xf86xv.h" -#include "Xv.h" -#include "vbe.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -/* framebuffer offscreen manager */ -#include "xf86fbman.h" - -/* include xaa includes */ -#include "xaa.h" -#include "xaarop.h" - -/* H/W cursor support */ -#include "xf86Cursor.h" - -/* Driver specific headers */ -#include "ast.h" - -#ifdef Accel_2D -/* 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 -}; - -/* extern function */ -extern void vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST); -extern UCHAR *pjRequestCMDQ(ASTRecPtr pAST, ULONG ulDataLen); -extern Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam); - -/* Prototype type declaration */ -Bool ASTAccelInit(ScreenPtr pScreen); -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); - -Bool -ASTAccelInit(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - 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) - { - infoPtr->SetupForSolidLine = ASTSetupForSolidLine; - infoPtr->SubsequentSolidHorVertLine = ASTSubsequentSolidHorVertLine; - infoPtr->SubsequentSolidTwoPointLine = ASTSubsequentSolidTwoPointLine; - infoPtr->SolidLineFlags = NO_PLANEMASK; - } - - /* Dashed Lines */ - if (pAST->ENGCaps & ENG_CAP_DashedLine) - { - infoPtr->SetupForDashedLine = ASTSetupForDashedLine; - infoPtr->SubsequentDashedTwoPointLine = ASTSubsequentDashedTwoPointLine; - 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_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 */ - vWaitEngIdle(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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); - - ASTSetupSRCPitch(pSingleCMD, pAST->VideoModeInfo.ScreenPitch); - pSingleCMD++; - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - } - 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; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenCopy\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - srcbase = dstbase = 0; - - if (y1 >= MAX_SRC_Y) - { - srcbase=pAST->VideoModeInfo.ScreenPitch*y1; - y1=0; - } - - if (y2 >= pScrn->virtualY) - { - dstbase=pAST->VideoModeInfo.ScreenPitch*y2; - y2=0; - } - - if (x1 < x2) - { - src_x = x1 + width - 1; - dst_x = x2 + width - 1; - cmdreg |= CMD_X_DEC; - } - else - { - src_x = x1; - dst_x = x2; - } - - if (y1 < y2) - { - src_y = y1 + height - 1; - dst_y = y2 + height - 1; - cmdreg |= CMD_Y_DEC; - } - else - { - src_y = y1; - dst_y = y2; - } - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); - - vWaitEngIdle(pScrn, pAST); - } - -} /* 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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, color); - } - 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; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidFillRect\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); - - vWaitEngIdle(pScrn, pAST); - - } - - -} /* 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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, color); - pSingleCMD++; - ASTSetupBG(pSingleCMD, 0); - - } - 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; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidHorVertLine\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT; - if (pAST->EnableClip) - 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) - { - dstbase=pAST->VideoModeInfo.ScreenPitch*y; - y=0; - } - - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); - - vWaitEngIdle(pScrn, pAST); - - } - - -} /* 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; -/* - 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; - 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; - } - - bGetLineTerm(&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->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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; - - } - 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); - - vWaitEngIdle(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 *) pjRequestCMDQ(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)); - - } - 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; -/* - 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; - 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; - } - - bGetLineTerm(&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->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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; - - } - 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); - - vWaitEngIdle(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 *) pjRequestCMDQ(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); - } - 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; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentMonoPatternFill\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); - - vWaitEngIdle(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.ScreenWidth) + (patx * cpp)); - ulPatSize = 8*8*cpp; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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++; - } - } - } - 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; -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentColor8x8PatternFillRect\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); - - vWaitEngIdle(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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); - pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); - - } - 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; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentCPUToScreenColorExpandFill\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - dstbase = 0; - - if (dst_y >= pScrn->virtualY) - { - dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; - dst_y=0; - } - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); - - vWaitEngIdle(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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); - - ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); - pSingleCMD++; - ASTSetupFG(pSingleCMD, fg); - pSingleCMD++; - ASTSetupBG(pSingleCMD, bg); - - } - 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; - -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenColorExpandFill\n"); -*/ - - /* Modify Reg. Value */ - cmdreg = pAST->ulCMDReg; - if (pAST->EnableClip) - cmdreg |= CMD_ENABLE_CLIP; - dstbase = 0; - if (dst_y >= pScrn->virtualY) - { - 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->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); - - vWaitEngIdle(pScrn, pAST); - - } - -} - - -/* Clipping */ -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; - - if (!pAST->MMIO2D) - { - /* Write to CMDQ */ - pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); - - ASTSetupCLIP1(pSingleCMD, left, top); - pSingleCMD++; - ASTSetupCLIP2(pSingleCMD, right, bottom); - } - else - { - ASTSetupCLIP1_MMIO(left, top); - ASTSetupCLIP2_MMIO(right, bottom); - } - -} - -static void -ASTDisableClipping(ScrnInfoPtr pScrn) -{ - ASTRecPtr pAST = ASTPTR(pScrn); -/* - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTDisableClipping\n"); -*/ - pAST->EnableClip = FALSE; -} - - -#endif /* end of Accel_2D */ +/* + * Copyright (c) 2005 ASPEED Technology Inc. + * + * 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 the authors not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The authors makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE AUTHORS 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "xf86.h" +#include "xf86_ansic.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86RAC.h" +#include "xf86cmap.h" +#include "compiler.h" +#include "mibstore.h" +#include "vgaHW.h" +#include "mipointer.h" +#include "micmap.h" + +#include "fb.h" +#include "regionstr.h" +#include "xf86xv.h" +#include +#include "vbe.h" + +#include "xf86PciInfo.h" +#include "xf86Pci.h" + +/* framebuffer offscreen manager */ +#include "xf86fbman.h" + +/* include xaa includes */ +#include "xaa.h" +#include "xaarop.h" + +/* H/W cursor support */ +#include "xf86Cursor.h" + +/* Driver specific headers */ +#include "ast.h" + +#ifdef Accel_2D +/* 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 +}; + +/* extern function */ +extern void vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST); +extern UCHAR *pjRequestCMDQ(ASTRecPtr pAST, ULONG ulDataLen); +extern Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam); + +/* Prototype type declaration */ +Bool ASTAccelInit(ScreenPtr pScreen); +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); + +Bool +ASTAccelInit(ScreenPtr pScreen) +{ + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + 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) + { + infoPtr->SetupForSolidLine = ASTSetupForSolidLine; + infoPtr->SubsequentSolidHorVertLine = ASTSubsequentSolidHorVertLine; + infoPtr->SubsequentSolidTwoPointLine = ASTSubsequentSolidTwoPointLine; + infoPtr->SolidLineFlags = NO_PLANEMASK; + } + + /* Dashed Lines */ + if (pAST->ENGCaps & ENG_CAP_DashedLine) + { + infoPtr->SetupForDashedLine = ASTSetupForDashedLine; + infoPtr->SubsequentDashedTwoPointLine = ASTSubsequentDashedTwoPointLine; + 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_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 */ + vWaitEngIdle(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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); + + ASTSetupSRCPitch(pSingleCMD, pAST->VideoModeInfo.ScreenPitch); + pSingleCMD++; + ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); + } + 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; +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenCopy\n"); +*/ + + /* Modify Reg. Value */ + cmdreg = pAST->ulCMDReg; + if (pAST->EnableClip) + cmdreg |= CMD_ENABLE_CLIP; + srcbase = dstbase = 0; + + if (y1 >= MAX_SRC_Y) + { + srcbase=pAST->VideoModeInfo.ScreenPitch*y1; + y1=0; + } + + if (y2 >= pScrn->virtualY) + { + dstbase=pAST->VideoModeInfo.ScreenPitch*y2; + y2=0; + } + + if (x1 < x2) + { + src_x = x1 + width - 1; + dst_x = x2 + width - 1; + cmdreg |= CMD_X_DEC; + } + else + { + src_x = x1; + dst_x = x2; + } + + if (y1 < y2) + { + src_y = y1 + height - 1; + dst_y = y2 + height - 1; + cmdreg |= CMD_Y_DEC; + } + else + { + src_y = y1; + dst_y = y2; + } + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); + + vWaitEngIdle(pScrn, pAST); + } + +} /* 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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); + + ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); + pSingleCMD++; + ASTSetupFG(pSingleCMD, color); + } + 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; +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidFillRect\n"); +*/ + + /* Modify Reg. Value */ + cmdreg = pAST->ulCMDReg; + if (pAST->EnableClip) + cmdreg |= CMD_ENABLE_CLIP; + dstbase = 0; + + if (dst_y >= pScrn->virtualY) + { + dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; + dst_y=0; + } + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); + + vWaitEngIdle(pScrn, pAST); + + } + + +} /* 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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); + + ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); + pSingleCMD++; + ASTSetupFG(pSingleCMD, color); + pSingleCMD++; + ASTSetupBG(pSingleCMD, 0); + + } + 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; +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidHorVertLine\n"); +*/ + + /* Modify Reg. Value */ + cmdreg = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT; + if (pAST->EnableClip) + 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) + { + dstbase=pAST->VideoModeInfo.ScreenPitch*y; + y=0; + } + + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); + + vWaitEngIdle(pScrn, pAST); + + } + + +} /* 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; +/* + 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; + 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; + } + + bGetLineTerm(&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->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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; + + } + 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); + + vWaitEngIdle(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 *) pjRequestCMDQ(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)); + + } + 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; +/* + 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; + 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; + } + + bGetLineTerm(&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->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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; + + } + 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); + + vWaitEngIdle(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 *) pjRequestCMDQ(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); + } + 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; +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentMonoPatternFill\n"); +*/ + + /* Modify Reg. Value */ + cmdreg = pAST->ulCMDReg; + if (pAST->EnableClip) + cmdreg |= CMD_ENABLE_CLIP; + dstbase = 0; + + if (dst_y >= pScrn->virtualY) + { + dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; + dst_y=0; + } + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); + + vWaitEngIdle(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.ScreenWidth) + (patx * cpp)); + ulPatSize = 8*8*cpp; + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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++; + } + } + } + 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; +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentColor8x8PatternFillRect\n"); +*/ + + /* Modify Reg. Value */ + cmdreg = pAST->ulCMDReg; + if (pAST->EnableClip) + cmdreg |= CMD_ENABLE_CLIP; + dstbase = 0; + + if (dst_y >= pScrn->virtualY) + { + dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; + dst_y=0; + } + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); + + vWaitEngIdle(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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); + + ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); + pSingleCMD++; + ASTSetupFG(pSingleCMD, fg); + pSingleCMD++; + ASTSetupBG(pSingleCMD, bg); + + } + 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; + +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentCPUToScreenColorExpandFill\n"); +*/ + + /* Modify Reg. Value */ + cmdreg = pAST->ulCMDReg; + if (pAST->EnableClip) + cmdreg |= CMD_ENABLE_CLIP; + dstbase = 0; + + if (dst_y >= pScrn->virtualY) + { + dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y; + dst_y=0; + } + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); + + vWaitEngIdle(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 *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3); + + ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1); + pSingleCMD++; + ASTSetupFG(pSingleCMD, fg); + pSingleCMD++; + ASTSetupBG(pSingleCMD, bg); + + } + 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; + +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenColorExpandFill\n"); +*/ + + /* Modify Reg. Value */ + cmdreg = pAST->ulCMDReg; + if (pAST->EnableClip) + cmdreg |= CMD_ENABLE_CLIP; + dstbase = 0; + if (dst_y >= pScrn->virtualY) + { + 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->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(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); + + vWaitEngIdle(pScrn, pAST); + + } + +} + + +/* Clipping */ +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; + + if (!pAST->MMIO2D) + { + /* Write to CMDQ */ + pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2); + + ASTSetupCLIP1(pSingleCMD, left, top); + pSingleCMD++; + ASTSetupCLIP2(pSingleCMD, right, bottom); + } + else + { + ASTSetupCLIP1_MMIO(left, top); + ASTSetupCLIP2_MMIO(right, bottom); + } + +} + +static void +ASTDisableClipping(ScrnInfoPtr pScrn) +{ + ASTRecPtr pAST = ASTPTR(pScrn); +/* + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTDisableClipping\n"); +*/ + pAST->EnableClip = FALSE; +} + + +#endif /* end of Accel_2D */ diff --git a/src/ast_cursor.c b/src/ast_cursor.c index e870331..93075e7 100644 --- a/src/ast_cursor.c +++ b/src/ast_cursor.c @@ -20,6 +20,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "xf86.h" #include "xf86_ansic.h" #include "xf86_OSproc.h" @@ -35,7 +38,7 @@ #include "fb.h" #include "regionstr.h" #include "xf86xv.h" -#include "Xv.h" +#include #include "vbe.h" #include "xf86PciInfo.h" diff --git a/src/ast_driver.c b/src/ast_driver.c index ac4c453..3438f96 100644 --- a/src/ast_driver.c +++ b/src/ast_driver.c @@ -20,6 +20,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "xf86.h" #include "xf86_ansic.h" #include "xf86_OSproc.h" @@ -35,7 +38,7 @@ #include "fb.h" #include "regionstr.h" #include "xf86xv.h" -#include "Xv.h" +#include #include "vbe.h" #include "xf86PciInfo.h" diff --git a/src/ast_mode.c b/src/ast_mode.c index 94d2ef5..0f2ce34 100644 --- a/src/ast_mode.c +++ b/src/ast_mode.c @@ -20,6 +20,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "xf86.h" #include "xf86_ansic.h" #include "xf86_OSproc.h" @@ -35,7 +38,7 @@ #include "fb.h" #include "regionstr.h" #include "xf86xv.h" -#include "Xv.h" +#include #include "vbe.h" #include "xf86PciInfo.h" diff --git a/src/ast_tool.c b/src/ast_tool.c index 61e9861..f9c02c1 100644 --- a/src/ast_tool.c +++ b/src/ast_tool.c @@ -20,6 +20,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "xf86.h" #include "xf86_ansic.h" #include "xf86_OSproc.h" @@ -35,7 +38,7 @@ #include "fb.h" #include "regionstr.h" #include "xf86xv.h" -#include "Xv.h" +#include #include "vbe.h" #include "xf86PciInfo.h" diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c index fc761ab..1831f27 100644 --- a/src/ast_vgatool.c +++ b/src/ast_vgatool.c @@ -20,6 +20,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "xf86.h" #include "xf86_ansic.h" #include "xf86_OSproc.h" @@ -35,7 +38,7 @@ #include "fb.h" #include "regionstr.h" #include "xf86xv.h" -#include "Xv.h" +#include #include "vbe.h" #include "xf86PciInfo.h" -- cgit v1.2.3