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