ast_accel.c revision b4d38c65
1/*
2 * Copyright (c) 2005 ASPEED Technology Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the authors not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission.  The authors makes no representations
11 * about the suitability of this software for any purpose.  It is provided
12 * "as is" without express or implied warranty.
13 *
14 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 */
22
23#ifdef HAVE_CONFIG_H
24#include <config.h>
25#endif
26#include "xf86.h"
27#include "xf86_OSproc.h"
28#include "xf86cmap.h"
29#include "compiler.h"
30#include "mibstore.h"
31#include "vgaHW.h"
32#include "mipointer.h"
33#include "micmap.h"
34
35#include "fb.h"
36#include "regionstr.h"
37#include "xf86xv.h"
38#include <X11/extensions/Xv.h>
39#include "vbe.h"
40
41#include "xf86PciInfo.h"
42#include "xf86Pci.h"
43
44/* framebuffer offscreen manager */
45#include "xf86fbman.h"
46
47/* include xaa includes */
48#ifdef HAVE_XAA_H
49#include "xaa.h"
50#endif
51#include "xaarop.h"
52
53/* H/W cursor support */
54#include "xf86Cursor.h"
55
56/* Driver specific headers */
57#include "ast.h"
58
59#ifdef	Accel_2D
60/* ROP Translation Table */
61int ASTXAACopyROP[16] =
62{
63   ROP_0,               /* GXclear */
64   ROP_DSa,             /* GXand */
65   ROP_SDna,            /* GXandReverse */
66   ROP_S,               /* GXcopy */
67   ROP_DSna,            /* GXandInverted */
68   ROP_D,               /* GXnoop */
69   ROP_DSx,             /* GXxor */
70   ROP_DSo,             /* GXor */
71   ROP_DSon,            /* GXnor */
72   ROP_DSxn,            /* GXequiv */
73   ROP_Dn,              /* GXinvert*/
74   ROP_SDno,            /* GXorReverse */
75   ROP_Sn,              /* GXcopyInverted */
76   ROP_DSno,            /* GXorInverted */
77   ROP_DSan,            /* GXnand */
78   ROP_1                /* GXset */
79};
80
81int ASTXAAPatternROP[16]=
82{
83   ROP_0,
84   ROP_DPa,
85   ROP_PDna,
86   ROP_P,
87   ROP_DPna,
88   ROP_D,
89   ROP_DPx,
90   ROP_DPo,
91   ROP_DPon,
92   ROP_PDxn,
93   ROP_Dn,
94   ROP_PDno,
95   ROP_Pn,
96   ROP_DPno,
97   ROP_DPan,
98   ROP_1
99};
100
101/* extern function */
102extern void vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST);
103extern UCHAR *pjRequestCMDQ(ASTRecPtr pAST, ULONG ulDataLen);
104extern Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam);
105
106/* Prototype type declaration */
107Bool ASTAccelInit(ScreenPtr pScreen);
108#ifdef HAVE_XAA_H
109static void ASTSync(ScrnInfoPtr pScrn);
110static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
111                                          int xdir, int ydir, int rop,
112                                          unsigned int planemask, int trans_color);
113static void ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
114                                            int y2, int w, int h);
115static void ASTSetupForSolidFill(ScrnInfoPtr pScrn,
116                                 int color, int rop, unsigned int planemask);
117static void ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn,
118                                       int dst_x, int dst_y, int width, int height);
119static void ASTSetupForSolidLine(ScrnInfoPtr pScrn,
120                                 int color, int rop, unsigned int planemask);
121static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
122                                          int x, int y, int len, int dir);
123static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
124                                           int x1, int y1, int x2, int y2, int flags);
125static void ASTSetupForDashedLine(ScrnInfoPtr pScrn,
126                                  int fg, int bg, int rop, unsigned int planemask,
127                                  int length, UCHAR *pattern);
128static void ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
129                                            int x1, int y1, int x2, int y2,
130                                            int flags, int phase);
131static void ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn,
132                                       int patx, int paty, int fg, int bg,
133                                       int rop, unsigned int planemask);
134static void ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
135                                         int patx, int paty,
136                                         int x, int y, int w, int h);
137static void ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
138			                   int rop, unsigned int planemask, int trans_col);
139static void ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
140                                                 int x, int y, int w, int h);
141static void ASTSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
142                                                  int fg, int bg,
143                                                  int rop, unsigned int planemask);
144static void ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
145                                                    int x, int y,
146                                                    int width, int height, int skipleft);
147static void ASTSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
148                                                     int fg, int bg,
149                                                     int rop, unsigned int planemask);
150static void ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
151                                                       int x, int y, int width, int height,
152                                                       int src_x, int src_y, int offset);
153static void ASTSetClippingRectangle(ScrnInfoPtr pScrn,
154                                    int left, int top, int right, int bottom);
155static void ASTDisableClipping(ScrnInfoPtr pScrn);
156static void ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y);
157
158static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
159                                           int x1, int y1, int x2, int y2, int flags);
160static void AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
161                                            int x1, int y1, int x2, int y2,
162                                            int flags, int phase);
163#endif
164
165Bool
166ASTAccelInit(ScreenPtr pScreen)
167{
168#ifdef HAVE_XAA_H
169    XAAInfoRecPtr  infoPtr;
170    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
171    ASTRecPtr      pAST = ASTPTR(pScrn);
172
173    pAST->AccelInfoPtr = infoPtr = XAACreateInfoRec();
174    if (!infoPtr)  return FALSE;
175
176    infoPtr->Flags = LINEAR_FRAMEBUFFER |
177  		     OFFSCREEN_PIXMAPS |
178  		     PIXMAP_CACHE;
179
180    /* Sync */
181    if (pAST->ENGCaps & ENG_CAP_Sync)
182        infoPtr->Sync = ASTSync;
183
184    /* Screen To Screen copy */
185    if (pAST->ENGCaps & ENG_CAP_ScreenToScreenCopy)
186    {
187        infoPtr->SetupForScreenToScreenCopy =  ASTSetupForScreenToScreenCopy;
188        infoPtr->SubsequentScreenToScreenCopy = ASTSubsequentScreenToScreenCopy;
189        infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK;
190    }
191
192    /* Solid fill */
193    if (pAST->ENGCaps & ENG_CAP_SolidFill)
194    {
195        infoPtr->SetupForSolidFill = ASTSetupForSolidFill;
196        infoPtr->SubsequentSolidFillRect = ASTSubsequentSolidFillRect;
197        infoPtr->SolidFillFlags = NO_PLANEMASK;
198    }
199
200    /* Solid Lines */
201    if (pAST->ENGCaps & ENG_CAP_SolidLine)
202    {
203        if ( (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180) )
204    	{
205            infoPtr->SubsequentSolidTwoPointLine = AIPSubsequentSolidTwoPointLine;
206        }
207        else
208    	{
209            infoPtr->SubsequentSolidTwoPointLine = ASTSubsequentSolidTwoPointLine;
210        }
211
212        infoPtr->SetupForSolidLine = ASTSetupForSolidLine;
213        infoPtr->SubsequentSolidHorVertLine = ASTSubsequentSolidHorVertLine;
214        infoPtr->SolidLineFlags = NO_PLANEMASK;
215    }
216
217    /* Dashed Lines */
218    if (pAST->ENGCaps & ENG_CAP_DashedLine)
219    {
220        if ( (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180) )
221        {
222            infoPtr->SubsequentDashedTwoPointLine = AIPSubsequentDashedTwoPointLine;
223        }
224        else
225        {
226            infoPtr->SubsequentDashedTwoPointLine = ASTSubsequentDashedTwoPointLine;
227        }
228
229        infoPtr->SetupForDashedLine = ASTSetupForDashedLine;
230        infoPtr->DashPatternMaxLength = 64;
231        infoPtr->DashedLineFlags = NO_PLANEMASK |
232			           LINE_PATTERN_MSBFIRST_LSBJUSTIFIED;
233    }
234
235    /* 8x8 mono pattern fill */
236    if (pAST->ENGCaps & ENG_CAP_Mono8x8PatternFill)
237    {
238        infoPtr->SetupForMono8x8PatternFill = ASTSetupForMonoPatternFill;
239        infoPtr->SubsequentMono8x8PatternFillRect = ASTSubsequentMonoPatternFill;
240        infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK |
241                                           NO_TRANSPARENCY |
242				           HARDWARE_PATTERN_SCREEN_ORIGIN |
243				           HARDWARE_PATTERN_PROGRAMMED_BITS |
244				           BIT_ORDER_IN_BYTE_MSBFIRST;
245    }
246
247    /* 8x8 color pattern fill */
248    if (pAST->ENGCaps & ENG_CAP_Color8x8PatternFill)
249    {
250        infoPtr->SetupForColor8x8PatternFill = ASTSetupForColor8x8PatternFill;
251        infoPtr->SubsequentColor8x8PatternFillRect = ASTSubsequentColor8x8PatternFillRect;
252        infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK |
253					    NO_TRANSPARENCY |
254	 				    HARDWARE_PATTERN_SCREEN_ORIGIN;
255    }
256
257    /* CPU To Screen Color Expand */
258    if (pAST->ENGCaps & ENG_CAP_CPUToScreenColorExpand)
259    {
260        infoPtr->SetupForCPUToScreenColorExpandFill = ASTSetupForCPUToScreenColorExpandFill;
261        infoPtr->SubsequentCPUToScreenColorExpandFill = ASTSubsequentCPUToScreenColorExpandFill;
262        infoPtr->ColorExpandRange = MAX_PATReg_Size;
263        infoPtr->ColorExpandBase = MMIOREG_PAT;
264        infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK |
265	   				           BIT_ORDER_IN_BYTE_MSBFIRST;
266    }
267
268    /* Screen To Screen Color Expand */
269    if (pAST->ENGCaps & ENG_CAP_ScreenToScreenColorExpand)
270    {
271        infoPtr->SetupForScreenToScreenColorExpandFill = ASTSetupForScreenToScreenColorExpandFill;
272        infoPtr->SubsequentScreenToScreenColorExpandFill = ASTSubsequentScreenToScreenColorExpandFill;
273        infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK |
274	                                              BIT_ORDER_IN_BYTE_MSBFIRST;
275    }
276
277    /* Clipping */
278    if (pAST->ENGCaps & ENG_CAP_Clipping)
279    {
280        infoPtr->SetClippingRectangle = ASTSetClippingRectangle;
281        infoPtr->DisableClipping = ASTDisableClipping;
282        infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY 	|
283                		 HARDWARE_CLIP_MONO_8x8_FILL		|
284                		 HARDWARE_CLIP_COLOR_8x8_FILL	 	|
285                		 HARDWARE_CLIP_SOLID_LINE 		|
286                		 HARDWARE_CLIP_DASHED_LINE 		|
287                		 HARDWARE_CLIP_SOLID_LINE;
288    }
289
290    return(XAAInit(pScreen, infoPtr));
291#else
292    return TRUE;
293#endif
294} /* end of ASTAccelInit */
295
296#ifdef HAVE_XAA_H
297static void
298ASTSync(ScrnInfoPtr pScrn)
299{
300    ASTRecPtr pAST = ASTPTR(pScrn);
301
302    /* wait engle idle */
303    vWaitEngIdle(pScrn, pAST);
304
305} /* end of ASTSync */
306
307
308static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
309                                          int xdir, int ydir, int rop,
310                                          unsigned int planemask, int trans_color)
311{
312
313    ASTRecPtr pAST = ASTPTR(pScrn);
314    PKT_SC *pSingleCMD;
315    ULONG  cmdreg;
316
317/*
318    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForScreenToScreenCopy\n");
319*/
320    /* Modify Reg. Value */
321    cmdreg = CMD_BITBLT;
322    switch (pAST->VideoModeInfo.bitsPerPixel)
323    {
324    case 8:
325        cmdreg |= CMD_COLOR_08;
326        break;
327    case 15:
328    case 16:
329        cmdreg |= CMD_COLOR_16;
330        break;
331    case 24:
332    case 32:
333        cmdreg |= CMD_COLOR_32;
334        break;
335    }
336    cmdreg |= (ASTXAACopyROP[rop] << 8);
337    pAST->ulCMDReg = cmdreg;
338
339    if (!pAST->MMIO2D)
340    {
341        /* Write to CMDQ */
342        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2);
343
344        ASTSetupSRCPitch(pSingleCMD, pAST->VideoModeInfo.ScreenPitch);
345        pSingleCMD++;
346        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
347
348        /* Update Write Pointer */
349        mUpdateWritePointer;
350
351    }
352    else
353    {
354        /* Write to MMIO */
355        ASTSetupSRCPitch_MMIO(pAST->VideoModeInfo.ScreenPitch);
356        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
357    }
358
359} /* end of ASTSetupForScreenToScreenCopy */
360
361static void
362ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
363                                int y2, int width, int height)
364{
365    ASTRecPtr pAST = ASTPTR(pScrn);
366    PKT_SC *pSingleCMD;
367    int src_x, src_y, dst_x, dst_y;
368    ULONG srcbase, dstbase, cmdreg;
369    int delta_y = 0;
370/*
371    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenCopy\n");
372*/
373
374    if ((width != 0) && (height != 0))
375    {
376        /* Modify Reg. Value */
377        cmdreg = pAST->ulCMDReg;
378        if (pAST->EnableClip)
379            cmdreg |= CMD_ENABLE_CLIP;
380        else
381            cmdreg &= ~CMD_ENABLE_CLIP;
382        srcbase = dstbase = 0;
383
384        if (x1 < x2)
385            cmdreg |= CMD_X_DEC;
386
387        if (y1 < y2)
388            cmdreg |= CMD_Y_DEC;
389
390        if ((y1 + height) >= MAX_SRC_Y)
391        {
392            srcbase=pAST->VideoModeInfo.ScreenPitch*y1;
393            y1 = 0;
394        }
395
396        if ((y2 + height) >= pScrn->virtualY)
397        {
398            delta_y = y2;
399            dstbase=pAST->VideoModeInfo.ScreenPitch*y2;
400            y2 = 0;
401        }
402
403        if (cmdreg & CMD_X_DEC)
404        {
405            src_x = x1 + width - 1;
406            dst_x = x2 + width - 1;
407        }
408        else
409        {
410            src_x = x1;
411            dst_x = x2;
412        }
413
414        if (cmdreg & CMD_Y_DEC)
415        {
416            src_y = y1 + height - 1;
417            dst_y = y2 + height - 1;
418        }
419        else
420        {
421            src_y = y1;
422            dst_y = y2;
423        }
424
425        if (pAST->EnableClip)
426            ASTSetHWClipping(pScrn, delta_y);
427
428        if (!pAST->MMIO2D)
429        {
430            /* Write to CMDQ */
431            pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6);
432
433            ASTSetupSRCBase(pSingleCMD, srcbase);
434            pSingleCMD++;
435            ASTSetupDSTBase(pSingleCMD, dstbase);
436            pSingleCMD++;
437            ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
438            pSingleCMD++;
439            ASTSetupSRCXY(pSingleCMD, src_x, src_y);
440            pSingleCMD++;
441            ASTSetupRECTXY(pSingleCMD, width, height);
442            pSingleCMD++;
443            ASTSetupCMDReg(pSingleCMD, cmdreg);
444
445            /* Update Write Pointer */
446            mUpdateWritePointer;
447
448        }
449        else
450        {
451            ASTSetupSRCBase_MMIO(srcbase);
452            ASTSetupDSTBase_MMIO(dstbase);
453            ASTSetupDSTXY_MMIO(dst_x, dst_y);
454            ASTSetupSRCXY_MMIO(src_x, src_y);
455            ASTSetupRECTXY_MMIO(width, height);
456            ASTSetupCMDReg_MMIO(cmdreg);
457
458            vWaitEngIdle(pScrn, pAST);
459        }
460
461    } /* width & height check */
462
463} /* end of ASTSubsequentScreenToScreenCopy */
464
465static void
466ASTSetupForSolidFill(ScrnInfoPtr pScrn,
467                     int color, int rop, unsigned int planemask)
468{
469
470    ASTRecPtr pAST = ASTPTR(pScrn);
471    PKT_SC *pSingleCMD;
472    ULONG cmdreg;
473
474/*
475    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForSolidFill\n");
476*/
477    /* Modify Reg. Value */
478    cmdreg = CMD_BITBLT | CMD_PAT_FGCOLOR;
479    switch (pAST->VideoModeInfo.bitsPerPixel)
480    {
481    case 8:
482        cmdreg |= CMD_COLOR_08;
483        break;
484    case 15:
485    case 16:
486        cmdreg |= CMD_COLOR_16;
487        break;
488    case 24:
489    case 32:
490        cmdreg |= CMD_COLOR_32;
491        break;
492    }
493    cmdreg |= (ASTXAAPatternROP[rop] << 8);
494    pAST->ulCMDReg = cmdreg;
495
496    if (!pAST->MMIO2D)
497    {
498        /* Write to CMDQ */
499        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2);
500
501        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
502        pSingleCMD++;
503        ASTSetupFG(pSingleCMD, color);
504
505        /* Update Write Pointer */
506        mUpdateWritePointer;
507
508    }
509    else
510    {
511        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
512        ASTSetupFG_MMIO(color);
513    }
514
515} /* end of ASTSetupForSolidFill */
516
517
518static void
519ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn,
520                           int dst_x, int dst_y, int width, int height)
521{
522    ASTRecPtr pAST = ASTPTR(pScrn);
523    PKT_SC *pSingleCMD;
524    ULONG dstbase, cmdreg;
525    int delta_y = 0;
526
527/*
528    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidFillRect\n");
529*/
530
531    if ((width != 0) && (height != 0))
532    {
533        /* Modify Reg. Value */
534        cmdreg = pAST->ulCMDReg;
535        if (pAST->EnableClip)
536            cmdreg |= CMD_ENABLE_CLIP;
537        else
538            cmdreg &= ~CMD_ENABLE_CLIP;
539        dstbase = 0;
540
541        if (dst_y >= pScrn->virtualY)
542        {
543            delta_y = dst_y;
544            dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
545            dst_y=0;
546        }
547
548        if (pAST->EnableClip)
549            ASTSetHWClipping(pScrn, delta_y);
550
551        if (!pAST->MMIO2D)
552        {
553            /* Write to CMDQ */
554            pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
555
556            ASTSetupDSTBase(pSingleCMD, dstbase);
557            pSingleCMD++;
558            ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
559            pSingleCMD++;
560            ASTSetupRECTXY(pSingleCMD, width, height);
561            pSingleCMD++;
562            ASTSetupCMDReg(pSingleCMD, cmdreg);
563
564            /* Update Write Pointer */
565            mUpdateWritePointer;
566
567        }
568        else
569        {
570            ASTSetupDSTBase_MMIO(dstbase);
571            ASTSetupDSTXY_MMIO(dst_x, dst_y);
572            ASTSetupRECTXY_MMIO(width, height);
573            ASTSetupCMDReg_MMIO(cmdreg);
574
575            vWaitEngIdle(pScrn, pAST);
576
577        }
578
579    } /* width & height check */
580
581
582} /* end of ASTSubsequentSolidFillRect */
583
584/* Line */
585static void ASTSetupForSolidLine(ScrnInfoPtr pScrn,
586                                 int color, int rop, unsigned int planemask)
587{
588
589    ASTRecPtr pAST = ASTPTR(pScrn);
590    PKT_SC *pSingleCMD;
591    ULONG  cmdreg;
592/*
593    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForSolidLine\n");
594*/
595    /* Modify Reg. Value */
596    cmdreg = CMD_BITBLT;
597    switch (pAST->VideoModeInfo.bitsPerPixel)
598    {
599    case 8:
600        cmdreg |= CMD_COLOR_08;
601        break;
602    case 15:
603    case 16:
604        cmdreg |= CMD_COLOR_16;
605        break;
606    case 24:
607    case 32:
608        cmdreg |= CMD_COLOR_32;
609        break;
610    }
611    cmdreg |= (ASTXAAPatternROP[rop] << 8);
612    pAST->ulCMDReg = cmdreg;
613
614    if (!pAST->MMIO2D)
615    {
616        /* Write to CMDQ */
617        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3);
618
619        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
620        pSingleCMD++;
621        ASTSetupFG(pSingleCMD, color);
622        pSingleCMD++;
623        ASTSetupBG(pSingleCMD, 0);
624
625        /* Update Write Pointer */
626        mUpdateWritePointer;
627
628    }
629    else
630    {
631        /* Write to MMIO */
632        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
633        ASTSetupFG_MMIO(color);
634        ASTSetupBG_MMIO(0);
635    }
636
637} /* end of ASTSetupForSolidLine */
638
639
640static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
641                                          int x, int y, int len, int dir)
642{
643
644    ASTRecPtr pAST = ASTPTR(pScrn);
645    PKT_SC *pSingleCMD;
646    ULONG dstbase, cmdreg;
647    int width, height;
648    int delta_y = 0;
649/*
650    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidHorVertLine\n");
651*/
652
653    if (len != 0)
654    {
655        /* Modify Reg. Value */
656        cmdreg = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT;
657        if (pAST->EnableClip)
658            cmdreg |= CMD_ENABLE_CLIP;
659        else
660            cmdreg &= ~CMD_ENABLE_CLIP;
661        dstbase = 0;
662
663        if(dir == DEGREES_0) {			/* horizontal */
664            width  = len;
665            height = 1;
666        } else {					/* vertical */
667            width  = 1;
668            height = len;
669        }
670
671        if ((y + height) >= pScrn->virtualY)
672        {
673            delta_y = y;
674            dstbase=pAST->VideoModeInfo.ScreenPitch*y;
675            y=0;
676        }
677
678        if (pAST->EnableClip)
679            ASTSetHWClipping(pScrn, delta_y);
680
681        if (!pAST->MMIO2D)
682        {
683            /* Write to CMDQ */
684            pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
685
686            ASTSetupDSTBase(pSingleCMD, dstbase);
687            pSingleCMD++;
688            ASTSetupDSTXY(pSingleCMD, x, y);
689            pSingleCMD++;
690            ASTSetupRECTXY(pSingleCMD, width, height);
691            pSingleCMD++;
692            ASTSetupCMDReg(pSingleCMD, cmdreg);
693
694            /* Update Write Pointer */
695            mUpdateWritePointer;
696
697        }
698        else
699        {
700            ASTSetupDSTBase_MMIO(dstbase);
701            ASTSetupDSTXY_MMIO(x, y);
702            ASTSetupRECTXY_MMIO(width, height);
703            ASTSetupCMDReg_MMIO(cmdreg);
704
705            vWaitEngIdle(pScrn, pAST);
706
707        }
708
709    } /* len check */
710
711} /* end of ASTSubsequentSolidHorVertLine */
712
713static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
714                                           int x1, int y1, int x2, int y2, int flags)
715{
716
717    ASTRecPtr 	pAST = ASTPTR(pScrn);
718    PKT_SC 	*pSingleCMD;
719    LINEPARAM   dsLineParam;
720    _LINEInfo   LineInfo;
721    ULONG 	dstbase, ulCommand;
722    ULONG	miny, maxy;
723    USHORT      usXM;
724    int delta_y = 0;
725
726/*
727    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n");
728*/
729
730    /* Modify Reg. Value */
731    ulCommand = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW;
732    if(flags & OMIT_LAST)
733        ulCommand |= CMD_NOT_DRAW_LAST_PIXEL;
734    else
735        ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL;
736    if (pAST->EnableClip)
737        ulCommand |= CMD_ENABLE_CLIP;
738    else
739        ulCommand &= ~CMD_ENABLE_CLIP;
740    dstbase = 0;
741    miny = (y1 > y2) ? y2 : y1;
742    maxy = (y1 > y2) ? y1 : y2;
743    if(maxy >= pScrn->virtualY) {
744    	delta_y = miny;
745        dstbase = pAST->VideoModeInfo.ScreenPitch * miny;
746        y1 -= miny;
747        y2 -= miny;
748    }
749
750    LineInfo.X1 = x1;
751    LineInfo.Y1 = y1;
752    LineInfo.X2 = x2;
753    LineInfo.Y2 = y2;
754
755    bGetLineTerm(&LineInfo, &dsLineParam);		/* Get Line Parameter */
756
757    if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC)
758        ulCommand |= CMD_X_DEC;
759    if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC)
760        ulCommand |= CMD_Y_DEC;
761
762    usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0;
763
764    if (pAST->EnableClip)
765        ASTSetHWClipping(pScrn, delta_y);
766
767    if (!pAST->MMIO2D)
768    {
769        /* Write to CMDQ */
770        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*7);
771
772        ASTSetupDSTBase(pSingleCMD, dstbase);
773        pSingleCMD++;
774        ASTSetupLineXY(pSingleCMD, dsLineParam.dsLineX, dsLineParam.dsLineY);
775        pSingleCMD++;
776        ASTSetupLineXMErrTerm(pSingleCMD, usXM , dsLineParam.dwErrorTerm);
777        pSingleCMD++;
778        ASTSetupLineWidth(pSingleCMD, dsLineParam.dsLineWidth);
779        pSingleCMD++;
780        ASTSetupLineK1Term(pSingleCMD, dsLineParam.dwK1Term);
781        pSingleCMD++;
782        ASTSetupLineK2Term(pSingleCMD, dsLineParam.dwK2Term);
783        pSingleCMD++;
784        ASTSetupCMDReg(pSingleCMD, ulCommand);
785
786        /* Update Write Pointer */
787        mUpdateWritePointer;
788
789        /* Patch KDE pass abnormal point, ycchen@052507 */
790        vWaitEngIdle(pScrn, pAST);
791
792    }
793    else
794    {
795        ASTSetupDSTBase_MMIO(dstbase);
796        ASTSetupLineXY_MMIO(dsLineParam.dsLineX, dsLineParam.dsLineY);
797        ASTSetupLineXMErrTerm_MMIO( usXM , dsLineParam.dwErrorTerm);
798        ASTSetupLineWidth_MMIO(dsLineParam.dsLineWidth);
799        ASTSetupLineK1Term_MMIO(dsLineParam.dwK1Term);
800        ASTSetupLineK2Term_MMIO(dsLineParam.dwK2Term);
801        ASTSetupCMDReg_MMIO(ulCommand);
802
803        vWaitEngIdle(pScrn, pAST);
804
805    }
806
807
808} /* end of ASTSubsequentSolidTwoPointLine */
809
810/* Dash Line */
811static void
812ASTSetupForDashedLine(ScrnInfoPtr pScrn,
813                      int fg, int bg, int rop, unsigned int planemask,
814                      int length, UCHAR *pattern)
815{
816
817    ASTRecPtr pAST = ASTPTR(pScrn);
818    PKT_SC *pSingleCMD;
819    ULONG  cmdreg;
820/*
821    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForDashedLine\n");
822*/
823    /* Modify Reg. Value */
824    cmdreg = CMD_LINEDRAW | CMD_RESET_STYLE_COUNTER | CMD_ENABLE_LINE_STYLE;
825
826    switch (pAST->VideoModeInfo.bitsPerPixel)
827    {
828    case 8:
829        cmdreg |= CMD_COLOR_08;
830        break;
831    case 15:
832    case 16:
833        cmdreg |= CMD_COLOR_16;
834        break;
835    case 24:
836    case 32:
837        cmdreg |= CMD_COLOR_32;
838        break;
839    }
840    cmdreg |= (ASTXAAPatternROP[rop] << 8);
841    if(bg == -1) {
842        cmdreg |= CMD_TRANSPARENT;
843        bg = 0;
844    }
845    cmdreg |= (((length-1) & 0x3F) << 24);		/* line period */
846    pAST->ulCMDReg = cmdreg;
847
848    if (!pAST->MMIO2D)
849    {
850        /* Write to CMDQ */
851        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5);
852
853        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
854        pSingleCMD++;
855        ASTSetupFG(pSingleCMD, fg);
856        pSingleCMD++;
857        ASTSetupBG(pSingleCMD, bg);
858        pSingleCMD++;
859        ASTSetupLineStyle1(pSingleCMD, *pattern);
860        pSingleCMD++;
861        ASTSetupLineStyle2(pSingleCMD, *(pattern+4));
862
863        /* Update Write Pointer */
864        mUpdateWritePointer;
865
866    }
867    else
868    {
869        /* Write to MMIO */
870        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
871        ASTSetupFG_MMIO(fg);
872        ASTSetupBG_MMIO(bg);
873        ASTSetupLineStyle1_MMIO(*pattern);
874        ASTSetupLineStyle2_MMIO(*(pattern+4));
875
876    }
877
878}
879
880static void
881ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
882                                int x1, int y1, int x2, int y2,
883                                int flags, int phase)
884{
885
886    ASTRecPtr 	pAST = ASTPTR(pScrn);
887    PKT_SC 	*pSingleCMD;
888    LINEPARAM   dsLineParam;
889    _LINEInfo   LineInfo;
890    ULONG 	dstbase, ulCommand;
891    ULONG	miny, maxy;
892    USHORT      usXM;
893    int delta_y = 0;
894
895/*
896    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n");
897*/
898
899    /* Modify Reg. Value */
900    ulCommand = pAST->ulCMDReg;
901    if(flags & OMIT_LAST)
902        ulCommand |= CMD_NOT_DRAW_LAST_PIXEL;
903    else
904        ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL;
905    if (pAST->EnableClip)
906        ulCommand |= CMD_ENABLE_CLIP;
907    else
908        ulCommand &= ~CMD_ENABLE_CLIP;
909    dstbase = 0;
910    miny = (y1 > y2) ? y2 : y1;
911    maxy = (y1 > y2) ? y1 : y2;
912    if(maxy >= pScrn->virtualY) {
913    	delta_y = miny;
914        dstbase = pAST->VideoModeInfo.ScreenPitch * miny;
915        y1 -= miny;
916        y2 -= miny;
917    }
918
919    LineInfo.X1 = x1;
920    LineInfo.Y1 = y1;
921    LineInfo.X2 = x2;
922    LineInfo.Y2 = y2;
923
924    bGetLineTerm(&LineInfo, &dsLineParam);		/* Get Line Parameter */
925
926    if (dsLineParam.dwLineAttributes & LINEPARAM_X_DEC)
927        ulCommand |= CMD_X_DEC;
928    if (dsLineParam.dwLineAttributes & LINEPARAM_Y_DEC)
929        ulCommand |= CMD_Y_DEC;
930
931    usXM = (dsLineParam.dwLineAttributes & LINEPARAM_XM) ? 1:0;
932
933    if (pAST->EnableClip)
934        ASTSetHWClipping(pScrn, delta_y);
935
936    if (!pAST->MMIO2D)
937    {
938        /* Write to CMDQ */
939        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*7);
940
941        ASTSetupDSTBase(pSingleCMD, dstbase);
942        pSingleCMD++;
943        ASTSetupLineXY(pSingleCMD, dsLineParam.dsLineX, dsLineParam.dsLineY);
944        pSingleCMD++;
945        ASTSetupLineXMErrTerm(pSingleCMD, usXM , dsLineParam.dwErrorTerm);
946        pSingleCMD++;
947        ASTSetupLineWidth(pSingleCMD, dsLineParam.dsLineWidth);
948        pSingleCMD++;
949        ASTSetupLineK1Term(pSingleCMD, dsLineParam.dwK1Term);
950        pSingleCMD++;
951        ASTSetupLineK2Term(pSingleCMD, dsLineParam.dwK2Term);
952        pSingleCMD++;
953        ASTSetupCMDReg(pSingleCMD, ulCommand);
954
955        /* Update Write Pointer */
956        mUpdateWritePointer;
957
958        /* Patch KDE pass abnormal point, ycchen@052507 */
959        vWaitEngIdle(pScrn, pAST);
960
961    }
962    else
963    {
964        ASTSetupDSTBase_MMIO(dstbase);
965        ASTSetupLineXY_MMIO(dsLineParam.dsLineX, dsLineParam.dsLineY);
966        ASTSetupLineXMErrTerm_MMIO( usXM , dsLineParam.dwErrorTerm);
967        ASTSetupLineWidth_MMIO(dsLineParam.dsLineWidth);
968        ASTSetupLineK1Term_MMIO(dsLineParam.dwK1Term);
969        ASTSetupLineK2Term_MMIO(dsLineParam.dwK2Term);
970        ASTSetupCMDReg_MMIO(ulCommand);
971
972        vWaitEngIdle(pScrn, pAST);
973
974    }
975
976}
977
978/* Mono Pattern Fill */
979static void
980ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn,
981                           int patx, int paty, int fg, int bg,
982                           int rop, unsigned int planemask)
983{
984
985    ASTRecPtr pAST = ASTPTR(pScrn);
986    PKT_SC *pSingleCMD;
987    ULONG cmdreg;
988
989/*
990    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForMonoPatternFill\n");
991*/
992    /* Modify Reg. Value */
993    cmdreg = CMD_BITBLT | CMD_PAT_MONOMASK;
994    switch (pAST->VideoModeInfo.bitsPerPixel)
995    {
996    case 8:
997        cmdreg |= CMD_COLOR_08;
998        break;
999    case 15:
1000    case 16:
1001        cmdreg |= CMD_COLOR_16;
1002        break;
1003    case 24:
1004    case 32:
1005        cmdreg |= CMD_COLOR_32;
1006        break;
1007    }
1008    cmdreg |= (ASTXAAPatternROP[rop] << 8);
1009    pAST->ulCMDReg = cmdreg;
1010
1011    if (!pAST->MMIO2D)
1012    {
1013        /* Write to CMDQ */
1014        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5);
1015
1016        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
1017        pSingleCMD++;
1018        ASTSetupFG(pSingleCMD, fg);
1019        pSingleCMD++;
1020        ASTSetupBG(pSingleCMD, bg);
1021        pSingleCMD++;
1022        ASTSetupMONO1(pSingleCMD, patx);
1023        pSingleCMD++;
1024        ASTSetupMONO2(pSingleCMD, paty);
1025
1026        /* Update Write Pointer */
1027        mUpdateWritePointer;
1028
1029    }
1030    else
1031    {
1032        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
1033        ASTSetupFG_MMIO(fg);
1034        ASTSetupBG_MMIO(bg);
1035        ASTSetupMONO1_MMIO(patx);
1036        ASTSetupMONO2_MMIO(paty);
1037    }
1038
1039} /* end of ASTSetupForMonoPatternFill */
1040
1041
1042static void
1043ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
1044                             int patx, int paty,
1045                             int dst_x, int dst_y, int width, int height)
1046{
1047    ASTRecPtr pAST = ASTPTR(pScrn);
1048    PKT_SC *pSingleCMD;
1049    ULONG dstbase, cmdreg;
1050    int delta_y = 0;
1051
1052/*
1053    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentMonoPatternFill\n");
1054*/
1055
1056    /* Modify Reg. Value */
1057    cmdreg = pAST->ulCMDReg;
1058    if (pAST->EnableClip)
1059        cmdreg |= CMD_ENABLE_CLIP;
1060    else
1061        cmdreg &= ~CMD_ENABLE_CLIP;
1062    dstbase = 0;
1063
1064    if (dst_y >= pScrn->virtualY)
1065    {
1066    	delta_y = dst_y;
1067        dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
1068        dst_y=0;
1069    }
1070
1071    if (pAST->EnableClip)
1072        ASTSetHWClipping(pScrn, delta_y);
1073
1074    if (!pAST->MMIO2D)
1075    {
1076        /* Write to CMDQ */
1077        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
1078
1079        ASTSetupDSTBase(pSingleCMD, dstbase);
1080        pSingleCMD++;
1081        ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
1082        pSingleCMD++;
1083        ASTSetupRECTXY(pSingleCMD, width, height);
1084        pSingleCMD++;
1085        ASTSetupCMDReg(pSingleCMD, cmdreg);
1086
1087        /* Update Write Pointer */
1088        mUpdateWritePointer;
1089
1090    }
1091    else
1092    {
1093        ASTSetupDSTBase_MMIO(dstbase);
1094        ASTSetupDSTXY_MMIO(dst_x, dst_y);
1095        ASTSetupRECTXY_MMIO(width, height);
1096        ASTSetupCMDReg_MMIO(cmdreg);
1097
1098        vWaitEngIdle(pScrn, pAST);
1099    }
1100
1101} /* end of ASTSubsequentMonoPatternFill */
1102
1103static void
1104ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
1105			       int rop, unsigned int planemask, int trans_col)
1106{
1107
1108    ASTRecPtr pAST = ASTPTR(pScrn);
1109    PKT_SC *pSingleCMD;
1110    ULONG cmdreg;
1111    CARD32 *pataddr;
1112    ULONG ulPatSize;
1113    int i, j, cpp;
1114/*
1115    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForColor8x8PatternFill\n");
1116*/
1117    /* Modify Reg. Value */
1118    cmdreg = CMD_BITBLT | CMD_PAT_PATREG;
1119    switch (pAST->VideoModeInfo.bitsPerPixel)
1120    {
1121    case 8:
1122        cmdreg |= CMD_COLOR_08;
1123        break;
1124    case 15:
1125    case 16:
1126        cmdreg |= CMD_COLOR_16;
1127        break;
1128    case 24:
1129    case 32:
1130        cmdreg |= CMD_COLOR_32;
1131        break;
1132    }
1133    cmdreg |= (ASTXAAPatternROP[rop] << 8);
1134    pAST->ulCMDReg = cmdreg;
1135    cpp = (pScrn->bitsPerPixel + 1) / 8;
1136    pataddr = (CARD32 *)(pAST->FBVirtualAddr +
1137                        (paty * pAST->VideoModeInfo.ScreenPitch) + (patx * cpp));
1138    ulPatSize = 8*8*cpp;
1139
1140    if (!pAST->MMIO2D)
1141    {
1142        /* Write to CMDQ */
1143        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*(1 + ulPatSize/4));
1144        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
1145        pSingleCMD++;
1146        for (i=0; i<8; i++)
1147        {
1148            for (j=0; j<8*cpp/4; j++)
1149            {
1150                ASTSetupPatReg(pSingleCMD, (i*j + j) , (*(CARD32 *) (pataddr++)));
1151                pSingleCMD++;
1152            }
1153        }
1154
1155        /* Update Write Pointer */
1156        mUpdateWritePointer;
1157
1158    }
1159    else
1160    {
1161        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
1162        for (i=0; i<8; i++)
1163        {
1164            for (j=0; j<8*cpp/4; j++)
1165            {
1166                ASTSetupPatReg_MMIO((i*j + j) , (*(CARD32 *) (pataddr++)));
1167            }
1168        }
1169
1170    }
1171
1172} /* end of ASTSetupForColor8x8PatternFill */
1173
1174static void
1175ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
1176                                     int dst_x, int dst_y, int width, int height)
1177{
1178    ASTRecPtr pAST = ASTPTR(pScrn);
1179    PKT_SC *pSingleCMD;
1180    ULONG dstbase, cmdreg;
1181    int delta_y = 0;
1182
1183/*
1184    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentColor8x8PatternFillRect\n");
1185*/
1186
1187    /* Modify Reg. Value */
1188    cmdreg = pAST->ulCMDReg;
1189    if (pAST->EnableClip)
1190        cmdreg |= CMD_ENABLE_CLIP;
1191    else
1192        cmdreg &= ~CMD_ENABLE_CLIP;
1193    dstbase = 0;
1194
1195    if (dst_y >= pScrn->virtualY)
1196    {
1197    	delta_y = dst_y;
1198        dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
1199        dst_y=0;
1200    }
1201
1202    if (pAST->EnableClip)
1203        ASTSetHWClipping(pScrn, delta_y);
1204
1205    if (!pAST->MMIO2D)
1206    {
1207        /* Write to CMDQ */
1208        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
1209
1210        ASTSetupDSTBase(pSingleCMD, dstbase);
1211        pSingleCMD++;
1212        ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
1213        pSingleCMD++;
1214        ASTSetupRECTXY(pSingleCMD, width, height);
1215        pSingleCMD++;
1216        ASTSetupCMDReg(pSingleCMD, cmdreg);
1217
1218        /* Update Write Pointer */
1219        mUpdateWritePointer;
1220
1221    }
1222    else
1223    {
1224        ASTSetupDSTBase_MMIO(dstbase);
1225        ASTSetupDSTXY_MMIO(dst_x, dst_y);
1226        ASTSetupRECTXY_MMIO(width, height);
1227        ASTSetupCMDReg_MMIO(cmdreg);
1228
1229        vWaitEngIdle(pScrn, pAST);
1230    }
1231
1232} /* ASTSubsequentColor8x8PatternFillRect */
1233
1234/* CPU to Screen Expand */
1235static void
1236ASTSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
1237                                      int fg, int bg,
1238                                      int rop, unsigned int planemask)
1239{
1240
1241    ASTRecPtr pAST = ASTPTR(pScrn);
1242    PKT_SC *pSingleCMD;
1243    ULONG cmdreg;
1244
1245/*
1246    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForCPUToScreenColorExpandFill\n");
1247*/
1248    /* Modify Reg. Value */
1249    cmdreg = CMD_COLOREXP;
1250    switch (pAST->VideoModeInfo.bitsPerPixel)
1251    {
1252    case 8:
1253        cmdreg |= CMD_COLOR_08;
1254        break;
1255    case 15:
1256    case 16:
1257        cmdreg |= CMD_COLOR_16;
1258        break;
1259    case 24:
1260    case 32:
1261        cmdreg |= CMD_COLOR_32;
1262        break;
1263    }
1264    cmdreg |= (ASTXAAPatternROP[rop] << 8);
1265    if(bg == -1) {
1266        cmdreg |= CMD_FONT_TRANSPARENT;
1267        bg = 0;
1268    }
1269    pAST->ulCMDReg = cmdreg;
1270
1271    if (!pAST->MMIO2D)
1272    {
1273        /* Write to CMDQ */
1274        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3);
1275
1276        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
1277        pSingleCMD++;
1278        ASTSetupFG(pSingleCMD, fg);
1279        pSingleCMD++;
1280        ASTSetupBG(pSingleCMD, bg);
1281
1282        /* Update Write Pointer */
1283        mUpdateWritePointer;
1284
1285    }
1286    else
1287    {
1288        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
1289        ASTSetupFG_MMIO(fg);
1290        ASTSetupBG_MMIO(bg);
1291
1292    }
1293
1294}
1295
1296static void
1297ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
1298                                        int dst_x, int dst_y,
1299                                        int width, int height, int offset)
1300{
1301
1302    ASTRecPtr pAST = ASTPTR(pScrn);
1303    PKT_SC *pSingleCMD;
1304    ULONG dstbase, cmdreg;
1305    int delta_y = 0;
1306
1307/*
1308    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentCPUToScreenColorExpandFill\n");
1309*/
1310
1311    /* Modify Reg. Value */
1312    cmdreg = pAST->ulCMDReg;
1313    if (pAST->EnableClip)
1314        cmdreg |= CMD_ENABLE_CLIP;
1315    else
1316        cmdreg &= ~CMD_ENABLE_CLIP;
1317    dstbase = 0;
1318
1319    if (dst_y >= pScrn->virtualY)
1320    {
1321    	delta_y = dst_y;
1322        dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
1323        dst_y=0;
1324    }
1325
1326    if (pAST->EnableClip)
1327        ASTSetHWClipping(pScrn, delta_y);
1328
1329    if (!pAST->MMIO2D)
1330    {
1331        /* Write to CMDQ */
1332        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5);
1333
1334        ASTSetupSRCPitch(pSingleCMD, ((width+7)/8));
1335        pSingleCMD++;
1336        ASTSetupDSTBase(pSingleCMD, dstbase);
1337        pSingleCMD++;
1338        ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
1339        pSingleCMD++;
1340        ASTSetupRECTXY(pSingleCMD, width, height);
1341        pSingleCMD++;
1342        ASTSetupCMDReg(pSingleCMD, cmdreg);
1343
1344        /* Update Write Pointer */
1345        mUpdateWritePointer;
1346
1347    }
1348    else
1349    {
1350        ASTSetupSRCPitch_MMIO((width+7)/8);
1351        ASTSetupDSTBase_MMIO(dstbase);
1352        ASTSetupDSTXY_MMIO(dst_x, dst_y);
1353        ASTSetupSRCXY_MMIO(0, 0);
1354
1355        ASTSetupRECTXY_MMIO(width, height);
1356        ASTSetupCMDReg_MMIO(cmdreg);
1357
1358        vWaitEngIdle(pScrn, pAST);
1359
1360    }
1361
1362}
1363
1364
1365/* Screen to Screen Color Expand */
1366static void
1367ASTSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
1368                                         int fg, int bg,
1369                                         int rop, unsigned int planemask)
1370{
1371
1372    ASTRecPtr pAST = ASTPTR(pScrn);
1373    PKT_SC *pSingleCMD;
1374    ULONG cmdreg;
1375
1376/*
1377    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetupForScreenToScreenColorExpandFill\n");
1378*/
1379
1380    /* Modify Reg. Value */
1381    cmdreg = CMD_ENHCOLOREXP;
1382    switch (pAST->VideoModeInfo.bitsPerPixel)
1383    {
1384    case 8:
1385        cmdreg |= CMD_COLOR_08;
1386        break;
1387    case 15:
1388    case 16:
1389        cmdreg |= CMD_COLOR_16;
1390        break;
1391    case 24:
1392    case 32:
1393        cmdreg |= CMD_COLOR_32;
1394        break;
1395    }
1396    cmdreg |= (ASTXAAPatternROP[rop] << 8);
1397    if(bg == -1) {
1398        cmdreg |= CMD_FONT_TRANSPARENT;
1399        bg = 0;
1400    }
1401    pAST->ulCMDReg = cmdreg;
1402
1403    if (!pAST->MMIO2D)
1404    {
1405        /* Write to CMDQ */
1406        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*3);
1407
1408        ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
1409        pSingleCMD++;
1410        ASTSetupFG(pSingleCMD, fg);
1411        pSingleCMD++;
1412        ASTSetupBG(pSingleCMD, bg);
1413
1414        /* Update Write Pointer */
1415        mUpdateWritePointer;
1416
1417    }
1418    else
1419    {
1420        ASTSetupDSTPitchHeight_MMIO(pAST->VideoModeInfo.ScreenPitch, -1);
1421        ASTSetupFG_MMIO(fg);
1422        ASTSetupBG_MMIO(bg);
1423
1424    }
1425
1426}
1427
1428
1429
1430static void
1431ASTSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
1432                                           int dst_x, int dst_y, int width, int height,
1433                                           int src_x, int src_y, int offset)
1434{
1435   ASTRecPtr pAST = ASTPTR(pScrn);
1436    PKT_SC *pSingleCMD;
1437    ULONG srcbase, dstbase, cmdreg;
1438    USHORT srcpitch;
1439    int delta_y = 0;
1440
1441/*
1442    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenColorExpandFill\n");
1443*/
1444
1445    /* Modify Reg. Value */
1446    cmdreg = pAST->ulCMDReg;
1447    if (pAST->EnableClip)
1448        cmdreg |= CMD_ENABLE_CLIP;
1449    else
1450        cmdreg &= ~CMD_ENABLE_CLIP;
1451    dstbase = 0;
1452    if (dst_y >= pScrn->virtualY)
1453    {
1454    	delta_y = dst_y;
1455        dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
1456        dst_y=0;
1457    }
1458    srcbase = pAST->VideoModeInfo.ScreenPitch*src_y + ((pScrn->bitsPerPixel+1)/8)*src_x;
1459    srcpitch = (pScrn->displayWidth+7)/8;
1460
1461    if (pAST->EnableClip)
1462        ASTSetHWClipping(pScrn, delta_y);
1463
1464    if (!pAST->MMIO2D)
1465    {
1466        /* Write to CMDQ */
1467        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6);
1468
1469        ASTSetupSRCBase(pSingleCMD, srcbase);
1470        pSingleCMD++;
1471        ASTSetupSRCPitch(pSingleCMD,srcpitch);
1472        pSingleCMD++;
1473        ASTSetupDSTBase(pSingleCMD, dstbase);
1474        pSingleCMD++;
1475        ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
1476        pSingleCMD++;
1477        ASTSetupRECTXY(pSingleCMD, width, height);
1478        pSingleCMD++;
1479        ASTSetupCMDReg(pSingleCMD, cmdreg);
1480
1481        /* Update Write Pointer */
1482        mUpdateWritePointer;
1483
1484    }
1485    else
1486    {
1487        ASTSetupSRCBase_MMIO(srcbase);
1488        ASTSetupSRCPitch_MMIO(srcpitch);
1489        ASTSetupDSTBase_MMIO(dstbase);
1490        ASTSetupDSTXY_MMIO(dst_x, dst_y);
1491        ASTSetupRECTXY_MMIO(width, height);
1492        ASTSetupCMDReg_MMIO(cmdreg);
1493
1494        vWaitEngIdle(pScrn, pAST);
1495
1496    }
1497
1498}
1499
1500
1501/* Clipping */
1502static void
1503ASTSetHWClipping(ScrnInfoPtr pScrn, int delta_y)
1504{
1505    ASTRecPtr pAST = ASTPTR(pScrn);
1506    PKT_SC *pSingleCMD;
1507
1508    if (!pAST->MMIO2D)
1509    {
1510        /* Write to CMDQ */
1511        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*2);
1512
1513        ASTSetupCLIP1(pSingleCMD, pAST->clip_left, pAST->clip_top - delta_y);
1514        pSingleCMD++;
1515        ASTSetupCLIP2(pSingleCMD, pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1);
1516
1517        /* Update Write Pointer */
1518        mUpdateWritePointer;
1519
1520    }
1521    else
1522    {
1523        ASTSetupCLIP1_MMIO(pAST->clip_left, pAST->clip_top - delta_y);
1524        ASTSetupCLIP2_MMIO(pAST->clip_right + 1, pAST->clip_bottom - delta_y + 1);
1525    }
1526
1527}
1528
1529static void
1530ASTSetClippingRectangle(ScrnInfoPtr pScrn,
1531                        int left, int top, int right, int bottom)
1532{
1533
1534    ASTRecPtr pAST = ASTPTR(pScrn);
1535    PKT_SC *pSingleCMD;
1536/*
1537    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSetClippingRectangle\n");
1538*/
1539    pAST->EnableClip = TRUE;
1540
1541    pAST->clip_left   = left;
1542    pAST->clip_top    = top;
1543    pAST->clip_right  = right;
1544    pAST->clip_bottom = bottom;
1545
1546}
1547
1548static void
1549ASTDisableClipping(ScrnInfoPtr pScrn)
1550{
1551    ASTRecPtr pAST = ASTPTR(pScrn);
1552/*
1553    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTDisableClipping\n");
1554*/
1555    pAST->EnableClip = FALSE;
1556}
1557
1558static void AIPSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
1559                                           int x1, int y1, int x2, int y2, int flags)
1560{
1561
1562    ASTRecPtr 	pAST = ASTPTR(pScrn);
1563    PKT_SC 	*pSingleCMD;
1564    ULONG 	dstbase, ulCommand;
1565    ULONG	miny, maxy;
1566/*
1567    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidTwoPointLine\n");
1568*/
1569
1570    /* Modify Reg. Value */
1571    ulCommand = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_LINEDRAW | CMD_NORMAL_LINE;
1572    if(flags & OMIT_LAST)
1573        ulCommand |= CMD_NOT_DRAW_LAST_PIXEL;
1574    else
1575        ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL;
1576    if (pAST->EnableClip)
1577        ulCommand |= CMD_ENABLE_CLIP;
1578    else
1579        ulCommand &= ~CMD_ENABLE_CLIP;
1580    dstbase = 0;
1581    miny = (y1 > y2) ? y2 : y1;
1582    maxy = (y1 > y2) ? y1 : y2;
1583    if(maxy >= pScrn->virtualY) {
1584        dstbase = pAST->VideoModeInfo.ScreenPitch * miny;
1585        y1 -= miny;
1586        y2 -= miny;
1587    }
1588
1589    if (!pAST->MMIO2D)
1590    {
1591        /* Write to CMDQ */
1592        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5);
1593
1594        ASTSetupDSTBase(pSingleCMD, dstbase);
1595        pSingleCMD++;
1596        AIPSetupLineXY(pSingleCMD, x1, y1);
1597        pSingleCMD++;
1598        AIPSetupLineXY2(pSingleCMD, x2, y2);
1599        pSingleCMD++;
1600        AIPSetupLineNumber(pSingleCMD, 0);
1601        pSingleCMD++;
1602        ASTSetupCMDReg(pSingleCMD, ulCommand);
1603
1604        /* Update Write Pointer */
1605        mUpdateWritePointer;
1606
1607        /* Patch KDE pass abnormal point, ycchen@052507 */
1608        vWaitEngIdle(pScrn, pAST);
1609
1610    }
1611    else
1612    {
1613        ASTSetupDSTBase_MMIO(dstbase);
1614        AIPSetupLineXY_MMIO(x1, y1);
1615        AIPSetupLineXY2_MMIO(x2, y2);
1616        AIPSetupLineNumber_MMIO(0);
1617        ASTSetupCMDReg_MMIO(ulCommand);
1618
1619        vWaitEngIdle(pScrn, pAST);
1620
1621    }
1622
1623
1624} /* end of AIPSubsequentSolidTwoPointLine */
1625
1626static void
1627AIPSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
1628                                int x1, int y1, int x2, int y2,
1629                                int flags, int phase)
1630{
1631
1632    ASTRecPtr 	pAST = ASTPTR(pScrn);
1633    PKT_SC 	*pSingleCMD;
1634    ULONG 	dstbase, ulCommand;
1635    ULONG	miny, maxy;
1636/*
1637    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentDashedTwoPointLine\n");
1638*/
1639
1640    /* Modify Reg. Value */
1641    ulCommand = pAST->ulCMDReg | CMD_NORMAL_LINE;
1642    if(flags & OMIT_LAST)
1643        ulCommand |= CMD_NOT_DRAW_LAST_PIXEL;
1644    else
1645        ulCommand &= ~CMD_NOT_DRAW_LAST_PIXEL;
1646    if (pAST->EnableClip)
1647        ulCommand |= CMD_ENABLE_CLIP;
1648    else
1649        ulCommand &= ~CMD_ENABLE_CLIP;
1650    dstbase = 0;
1651    miny = (y1 > y2) ? y2 : y1;
1652    maxy = (y1 > y2) ? y1 : y2;
1653    if(maxy >= pScrn->virtualY) {
1654        dstbase = pAST->VideoModeInfo.ScreenPitch * miny;
1655        y1 -= miny;
1656        y2 -= miny;
1657    }
1658
1659    if (!pAST->MMIO2D)
1660    {
1661        /* Write to CMDQ */
1662        pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*5);
1663
1664        ASTSetupDSTBase(pSingleCMD, dstbase);
1665        pSingleCMD++;
1666        AIPSetupLineXY(pSingleCMD, x1, y1);
1667        pSingleCMD++;
1668        AIPSetupLineXY2(pSingleCMD, x2, y2);
1669        pSingleCMD++;
1670        AIPSetupLineNumber(pSingleCMD, 0);
1671        pSingleCMD++;
1672        ASTSetupCMDReg(pSingleCMD, ulCommand);
1673
1674        /* Update Write Pointer */
1675        mUpdateWritePointer;
1676
1677        /* Patch KDE pass abnormal point, ycchen@052507 */
1678        vWaitEngIdle(pScrn, pAST);
1679
1680    }
1681    else
1682    {
1683        ASTSetupDSTBase_MMIO(dstbase);
1684        AIPSetupLineXY_MMIO(x1, y1);
1685        AIPSetupLineXY2_MMIO(x2, y2);
1686        AIPSetupLineNumber_MMIO(0);
1687        ASTSetupCMDReg_MMIO(ulCommand);
1688
1689        vWaitEngIdle(pScrn, pAST);
1690
1691    }
1692
1693}
1694#endif
1695
1696#ifdef	AstVideo
1697/*
1698 * Video Part
1699 * by ic_yang
1700 */
1701#include "fourcc.h"
1702
1703void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr clipBoxes, int id)
1704{
1705    ASTPtr              pAST = ASTPTR(pScrn);
1706    int                 nBoxs;
1707    int                 ScaleFactorH, ScaleFactorV;
1708    ULONG               InitScaleFactorH, InitScaleFactorV;
1709    BURSTSCALECMD       CopyCmd = {0};
1710    PBURSTSCALECMD      pCopyCmd = NULL;
1711    float               fScaleX = 0, fScaleY = 0;
1712    xRectangle          rect;
1713    BoxPtr              pBox = NULL;
1714    short               lSrcX, lSrcY;
1715    ULONG               dwCmd = 0;
1716    int                 i;
1717
1718    pBox = REGION_RECTS(clipBoxes);
1719    nBoxs = REGION_NUM_RECTS(clipBoxes);
1720
1721    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MMIO=%x,pBox=%x, nBoxs=%x\n", pAST->MMIO2D, pBox, nBoxs);
1722
1723    if(0==pPriv->drw_w || 0==pPriv->drw_h)
1724    {
1725        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "drwx=%x, drwy=%x\n", pPriv->drw_w, pPriv->drw_h);
1726        return;
1727    }
1728
1729    /* calc scaling factor */
1730    fScaleX = (float)pPriv->src_w /(float)pPriv->drw_w;
1731    fScaleY = (float)pPriv->src_h /(float)pPriv->drw_h;
1732
1733    if (pPriv->src_w == pPriv->drw_w)
1734        ScaleFactorH = 0x8000;
1735    else
1736        ScaleFactorH = (ULONG)((pPriv->src_w-1)*0x8000)/pPriv->drw_w;
1737
1738    if (pPriv->src_h == pPriv->drw_h)
1739    {
1740        ScaleFactorV = 0x8000;
1741		dwCmd |= SCALE_EQUAL_VER; /* Setting it save the bandwidtch */
1742   	}
1743    else
1744   	{
1745        ScaleFactorV = (ULONG)((pPriv->src_h-1)*0x8000)/pPriv->drw_h;
1746    }
1747
1748    if (pPriv->drw_w >= pPriv->src_w)
1749        InitScaleFactorH = 0;
1750    else
1751        InitScaleFactorH = 0x4000;
1752
1753    if (pPriv->drw_h >= pPriv->src_h)
1754        InitScaleFactorV = 0;
1755    else
1756        InitScaleFactorV = 0x4000;
1757
1758    switch(pScrn->bitsPerPixel)
1759    {
1760    case 32:
1761        dwCmd   = CMD_COLOR_32;
1762        break;
1763    case 16:
1764        dwCmd   = CMD_COLOR_16;
1765        break;
1766    case  8:
1767        dwCmd   = CMD_COLOR_08;
1768        break;
1769    }
1770
1771    dwCmd |= CMD_TYPE_SCALE;
1772    if (pPriv->drw_w >= pPriv->src_w)
1773        dwCmd |= SCALE_SEG_NUM_1;
1774    else
1775        dwCmd |= SCALE_SEG_NUM_2;
1776
1777    dwCmd |= SCALE_FORMAT_YUV2RGB;
1778    switch(id)
1779    {
1780    case PIXEL_FMT_YUY2:
1781        dwCmd |= YUV_FORMAT_YUYV;
1782        break;
1783    case PIXEL_FMT_UYVY:
1784        dwCmd |= YUV_FORMAT_UYVY;
1785        break;
1786    default:
1787        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Other pix format:%x\n", id);
1788        break;
1789    }
1790
1791    for(i = 0; i < nBoxs; i++, pBox++)
1792    {
1793        rect.x = pBox->x1 - pPriv->drw_x;
1794        rect.y = pBox->y1 - pPriv->drw_y;
1795        rect.width = pBox->x2 - pBox->x1;
1796        rect.height = pBox->y2 - pBox->y1;
1797
1798        lSrcX = (ULONG)((float)rect.x * fScaleX + pPriv->src_x + 0.5f);
1799        lSrcY = (ULONG)((float)rect.y * fScaleY + pPriv->src_y + 0.5f);
1800
1801        pCopyCmd = (BURSTSCALECMD*)pjRequestCMDQ(pAST, PKT_TYPESCALE_LENGTH);
1802
1803        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pCopyCmd=%p, pBox=%x,%x,%x,%x\n", pCopyCmd, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
1804
1805        CopyCmd.dwHeader0        = (ULONG)  PKT_BURST_CMD_HEADER0 |
1806                                             PKT_TYPESCALE_DATALENGTH |
1807                                             PKT_TYPESCALE_ADDRSTART  |
1808                                             BURST_FORCE_CMD;
1809
1810        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CopyCmd.dwHeader0=%x\n", CopyCmd.dwHeader0);
1811
1812        CopyCmd.dwSrcPitch       = (ULONG)(pPriv->srcPitch << 16);
1813
1814        CopyCmd.dwDstHeightPitch = (ULONG)  ((pAST->VideoModeInfo.ScreenPitch << 16) | 0xFFFF);
1815
1816        CopyCmd.dwDstXY          = (ULONG) ((pBox->x1 << 16) | (pBox->y1 & 0xFFFF));
1817        CopyCmd.dwSrcXY          = (ULONG) ((lSrcX << 16) | (lSrcY & 0xFFFF));
1818        CopyCmd.dwRecHeightWidth = (ULONG) ((rect.width << 16) | rect.height);
1819
1820        CopyCmd.dwInitScaleFactorH = InitScaleFactorH;
1821        CopyCmd.dwInitScaleFactorV = InitScaleFactorV;
1822        CopyCmd.dwScaleFactorH   = ScaleFactorH;
1823        CopyCmd.dwScaleFactorV   = ScaleFactorV;
1824
1825        CopyCmd.dwSrcBaseAddr = pPriv->bufAddr[pPriv->currentBuf];
1826        CopyCmd.dwDstBaseAddr = 0;
1827        CopyCmd.dwCmd = dwCmd;
1828        CopyCmd.NullData[0] = 0;    /* for alignment */
1829        memcpy(pCopyCmd, &CopyCmd, sizeof(CopyCmd));
1830
1831        mUpdateWritePointer;
1832
1833#if 0
1834        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%08x, %08x, %08x, %08x\n",
1835                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8000),
1836                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8004),
1837                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8008),
1838                        *(ULONG *)(pAST->MMIOVirtualAddr+0x800C));
1839        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%08x, %08x, %08x, %08x\n",
1840                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8010),
1841                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8014),
1842                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8018),
1843                        *(ULONG *)(pAST->MMIOVirtualAddr+0x801C));
1844        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%08x, %08x, %08x, %08x\n",
1845                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8020),
1846                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8024),
1847                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8028),
1848                        *(ULONG *)(pAST->MMIOVirtualAddr+0x802C));
1849        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%08x, %08x, %08x, %08x\n",
1850                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8030),
1851                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8034),
1852                        *(ULONG *)(pAST->MMIOVirtualAddr+0x8038),
1853                        *(ULONG *)(pAST->MMIOVirtualAddr+0x803C));
1854#endif
1855
1856    } /* End of for-loop */
1857
1858} /* ASTDisplayVideo */
1859#endif	/* AstVideo */
1860
1861#endif	/* end of Accel_2D */
1862