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