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