Fix several problems.
[nouveau] / src / riva_xaa.c
1  /***************************************************************************\
2 |*                                                                           *|
3 |*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|
4 |*                                                                           *|
5 |*     NOTICE TO USER:   The source code  is copyrighted under  U.S. and     *|
6 |*     international laws.  Users and possessors of this source code are     *|
7 |*     hereby granted a nonexclusive,  royalty-free copyright license to     *|
8 |*     use this code in individual and commercial software.                  *|
9 |*                                                                           *|
10 |*     Any use of this source code must include,  in the user documenta-     *|
11 |*     tion and  internal comments to the code,  notices to the end user     *|
12 |*     as follows:                                                           *|
13 |*                                                                           *|
14 |*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|
15 |*                                                                           *|
16 |*     NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY     *|
17 |*     OF  THIS SOURCE  CODE  FOR ANY PURPOSE.  IT IS  PROVIDED  "AS IS"     *|
18 |*     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  NVIDIA, CORPOR-     *|
19 |*     ATION DISCLAIMS ALL WARRANTIES  WITH REGARD  TO THIS SOURCE CODE,     *|
20 |*     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE-     *|
21 |*     MENT,  AND FITNESS  FOR A PARTICULAR PURPOSE.   IN NO EVENT SHALL     *|
22 |*     NVIDIA, CORPORATION  BE LIABLE FOR ANY SPECIAL,  INDIRECT,  INCI-     *|
23 |*     DENTAL, OR CONSEQUENTIAL DAMAGES,  OR ANY DAMAGES  WHATSOEVER RE-     *|
24 |*     SULTING FROM LOSS OF USE,  DATA OR PROFITS,  WHETHER IN AN ACTION     *|
25 |*     OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  ARISING OUT OF     *|
26 |*     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.     *|
27 |*                                                                           *|
28 |*     U.S. Government  End  Users.   This source code  is a "commercial     *|
29 |*     item,"  as that  term is  defined at  48 C.F.R. 2.101 (OCT 1995),     *|
30 |*     consisting  of "commercial  computer  software"  and  "commercial     *|
31 |*     computer  software  documentation,"  as such  terms  are  used in     *|
32 |*     48 C.F.R. 12.212 (SEPT 1995)  and is provided to the U.S. Govern-     *|
33 |*     ment only as  a commercial end item.   Consistent with  48 C.F.R.     *|
34 |*     12.212 and  48 C.F.R. 227.7202-1 through  227.7202-4 (JUNE 1995),     *|
35 |*     all U.S. Government End Users  acquire the source code  with only     *|
36 |*     those rights set forth herein.                                        *|
37 |*                                                                           *|
38  \***************************************************************************/
39
40 /* Hacked together from mga driver and 3.3.4 NVIDIA driver by
41    Jarno Paananen <jpaana@s2.org> */
42
43 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_xaa.c $ */
44
45 #ifdef HAVE_CONFIG_H
46 #include "config.h"
47 #endif
48
49 #include "riva_include.h"
50 #include "xaalocal.h"
51 #include "xaarop.h"
52
53 #include "miline.h"
54
55 static void
56 RivaSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
57 {
58     int height = y2-y1 + 1;
59     int width  = x2-x1 + 1;
60     RivaPtr pRiva = RivaPTR(pScrn);
61
62     RIVA_FIFO_FREE(pRiva->riva, Clip, 2);
63     pRiva->riva.Clip->TopLeft     = (y1     << 16) | (x1 & 0xffff);
64     pRiva->riva.Clip->WidthHeight = (height << 16) | width;
65 }
66
67
68 static void
69 RivaDisableClipping(ScrnInfoPtr pScrn)
70 {
71     RivaSetClippingRectangle(pScrn, 0, 0, 0x7fff, 0x7fff);
72 }
73
74 /*
75  * Set pattern. Internal routine. The upper bits of the colors
76  * are the ALPHA bits.  0 == transparency.
77  */
78 static void
79 RivaSetPattern(RivaPtr pRiva, int clr0, int clr1, int pat0, int pat1)
80 {
81     RIVA_FIFO_FREE(pRiva->riva, Patt, 4);
82     pRiva->riva.Patt->Color0        = clr0;
83     pRiva->riva.Patt->Color1        = clr1;
84     pRiva->riva.Patt->Monochrome[0] = pat0;
85     pRiva->riva.Patt->Monochrome[1] = pat1;
86 }
87
88 /*
89  * Set ROP.  Translate X rop into ROP3.  Internal routine.
90  */
91 static void
92 RivaSetRopSolid(RivaPtr pRiva, int rop)
93 {    
94     if (pRiva->currentRop != rop) {
95         if (pRiva->currentRop >= 16)
96             RivaSetPattern(pRiva, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
97         pRiva->currentRop = rop;
98         RIVA_FIFO_FREE(pRiva->riva, Rop, 1);
99         pRiva->riva.Rop->Rop3 = XAAGetCopyROP(rop);
100     }
101 }
102
103 static void
104 RivaSetRopPattern(RivaPtr pRiva, int rop)
105 {
106     if (pRiva->currentRop != (rop + 16)) {
107         pRiva->currentRop = rop + 16; /* +16 is important */
108         RIVA_FIFO_FREE(pRiva->riva, Rop, 1);
109         pRiva->riva.Rop->Rop3 = XAAGetPatternROP(rop);
110     }
111 }
112
113 /*
114  * Fill solid rectangles.
115  */
116 static
117 void RivaSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
118                          unsigned planemask)
119 {
120     RivaPtr pRiva = RivaPTR(pScrn);
121
122     RivaSetRopSolid(pRiva, rop);
123     RIVA_FIFO_FREE(pRiva->riva, Bitmap, 1);
124     pRiva->riva.Bitmap->Color1A = color;
125 }
126
127 static void
128 RivaSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
129 {
130     RivaPtr pRiva = RivaPTR(pScrn);
131     
132     RIVA_FIFO_FREE(pRiva->riva, Bitmap, 2);
133     pRiva->riva.Bitmap->UnclippedRectangle[0].TopLeft     = (x << 16) | y; 
134     write_mem_barrier();
135     pRiva->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h;
136     write_mem_barrier();
137 }
138
139 /*
140  * Screen to screen BLTs.
141  */
142 static void
143 RivaSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
144                              unsigned planemask, int transparency_color)
145 {
146     RivaSetRopSolid(RivaPTR(pScrn), rop);
147 }
148
149 static void
150 RivaSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
151                                int x2, int y2, int w, int h)
152 {
153     RivaPtr pRiva = RivaPTR(pScrn);
154
155     RIVA_FIFO_FREE(pRiva->riva, Blt, 3);
156     pRiva->riva.Blt->TopLeftSrc  = (y1 << 16) | x1;
157     pRiva->riva.Blt->TopLeftDst  = (y2 << 16) | x2;
158     write_mem_barrier();
159     pRiva->riva.Blt->WidthHeight = (h  << 16) | w;
160     write_mem_barrier();
161 }
162
163
164 /*
165  * Fill 8x8 monochrome pattern rectangles.  patternx and patterny are
166  * the overloaded pattern bits themselves. The pattern colors don't
167  * support 565, only 555. Hack around it.
168  */
169 static void
170 RivaSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny,
171                              int fg, int bg, int rop, unsigned planemask)
172 {
173     RivaPtr pRiva = RivaPTR(pScrn);
174
175     RivaSetRopPattern(pRiva, rop);
176     if (pScrn->depth == 16)
177     {
178         fg = ((fg & 0x0000F800) << 8)
179            | ((fg & 0x000007E0) << 5)
180            | ((fg & 0x0000001F) << 3)
181            |        0xFF000000;
182         if (bg != -1)
183             bg = ((bg & 0x0000F800) << 8)
184                | ((bg & 0x000007E0) << 5)
185                | ((bg & 0x0000001F) << 3)
186                |        0xFF000000;
187         else
188             bg = 0;
189     }
190     else
191     {
192         fg |= pRiva->opaqueMonochrome;
193         bg  = (bg == -1) ? 0 : bg | pRiva->opaqueMonochrome;
194     };
195     RivaSetPattern(pRiva, bg, fg, patternx, patterny);
196     RIVA_FIFO_FREE(pRiva->riva, Bitmap, 1);
197     pRiva->riva.Bitmap->Color1A = fg;
198 }
199
200 static void
201 RivaSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
202                                    int patternx, int patterny,
203                                    int x, int y, int w, int h)
204 {
205     RivaPtr pRiva = RivaPTR(pScrn);
206
207     RIVA_FIFO_FREE(pRiva->riva, Bitmap, 2);
208     pRiva->riva.Bitmap->UnclippedRectangle[0].TopLeft     = (x << 16) | y;
209     write_mem_barrier();
210     pRiva->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h;
211     write_mem_barrier();
212 }
213
214
215 void
216 RivaResetGraphics(ScrnInfoPtr pScrn)
217 {
218     RivaPtr pRiva = RivaPTR(pScrn);
219
220     if(pRiva->NoAccel) return;
221
222     RIVA_FIFO_FREE(pRiva->riva, Patt, 1);
223     pRiva->riva.Patt->Shape = 0; 
224     RivaDisableClipping(pScrn);
225     pRiva->currentRop = 16;  /* to force RivaSetRopSolid to reset the pattern */
226     RivaSetRopSolid(pRiva, GXcopy);
227 }
228
229
230
231 /*
232  * Synchronise with graphics engine.  Make sure it is idle before returning.
233  * Should attempt to yield CPU if busy for awhile.
234  */
235 void RivaSync(ScrnInfoPtr pScrn)
236 {
237     RivaPtr pRiva = RivaPTR(pScrn);
238     RIVA_BUSY(pRiva->riva);
239 }
240
241 /* Color expansion */
242 static void
243 RivaSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
244                                              int fg, int bg, int rop, 
245                                              unsigned int planemask)
246 {
247     RivaPtr pRiva = RivaPTR(pScrn);
248
249     RivaSetRopSolid(pRiva, rop);
250
251     if ( bg == -1 )
252     {
253         /* Transparent case */
254         bg = 0x80000000;
255         pRiva->expandFifo = (unsigned char*)&pRiva->riva.Bitmap->MonochromeData1C;
256     }
257     else
258     {
259         pRiva->expandFifo = (unsigned char*)&pRiva->riva.Bitmap->MonochromeData01E;
260         if (pScrn->depth == 16)
261         {
262             bg = ((bg & 0x0000F800) << 8)
263                | ((bg & 0x000007E0) << 5)
264                | ((bg & 0x0000001F) << 3)
265                |        0xFF000000;
266         }
267         else
268         {
269             bg  |= pRiva->opaqueMonochrome;
270         };
271     }
272     pRiva->FgColor = fg;
273     pRiva->BgColor = bg;
274 }
275
276 static void
277 RivaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
278 {
279     RivaPtr pRiva = RivaPTR(pScrn);
280
281     int t = pRiva->expandWidth;
282     CARD32 *pbits = (CARD32*)pRiva->expandBuffer;
283     CARD32 *d = (CARD32*)pRiva->expandFifo;
284     
285     while(t >= 16) 
286     {
287         RIVA_FIFO_FREE(pRiva->riva, Bitmap, 16);
288         d[0]  = pbits[0];
289         d[1]  = pbits[1];
290         d[2]  = pbits[2];
291         d[3]  = pbits[3];
292         d[4]  = pbits[4];
293         d[5]  = pbits[5];
294         d[6]  = pbits[6];
295         d[7]  = pbits[7];
296         d[8]  = pbits[8];
297         d[9]  = pbits[9];
298         d[10] = pbits[10];
299         d[11] = pbits[11];
300         d[12] = pbits[12];
301         d[13] = pbits[13];
302         d[14] = pbits[14];
303         d[15] = pbits[15];
304         t -= 16; pbits += 16;
305     }
306     if(t) {
307         RIVA_FIFO_FREE(pRiva->riva, Bitmap, t);
308         while(t >= 4) 
309         {
310             d[0]  = pbits[0];
311             d[1]  = pbits[1];
312             d[2]  = pbits[2];
313             d[3]  = pbits[3];
314             t -= 4; pbits += 4;
315         }
316         while(t--) 
317             *(d++) = *(pbits++); 
318     }
319
320     if (!(--pRiva->expandRows)) { /* hardware bug workaround */
321        RIVA_FIFO_FREE(pRiva->riva, Blt, 1);
322        write_mem_barrier();
323        pRiva->riva.Blt->TopLeftSrc = 0;
324     }
325     write_mem_barrier();
326 }
327
328 static void
329 RivaSubsequentColorExpandScanlineFifo(ScrnInfoPtr pScrn, int bufno)
330 {
331     RivaPtr pRiva = RivaPTR(pScrn);
332
333     if ( --pRiva->expandRows ) {
334        RIVA_FIFO_FREE(pRiva->riva, Bitmap, pRiva->expandWidth);
335     } else { /* hardware bug workaround */
336        RIVA_FIFO_FREE(pRiva->riva, Blt, 1);
337        write_mem_barrier();
338        pRiva->riva.Blt->TopLeftSrc = 0;
339     }
340     write_mem_barrier();
341 }
342
343 static void
344 RivaSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x,
345                                                int y, int w, int h,
346                                                int skipleft)
347 {
348     int bw;
349     RivaPtr pRiva = RivaPTR(pScrn);
350     
351     bw = (w + 31) & ~31;
352     pRiva->expandWidth = bw >> 5;
353
354     if ( pRiva->BgColor == 0x80000000 )
355     {
356         /* Use faster transparent method */
357         RIVA_FIFO_FREE(pRiva->riva, Bitmap, 5);
358         pRiva->riva.Bitmap->ClipC.TopLeft     = (y << 16) | ((x+skipleft)
359                                                            & 0xFFFF);
360         pRiva->riva.Bitmap->ClipC.BottomRight = ((y+h) << 16) | ((x+w)&0xffff);
361         pRiva->riva.Bitmap->Color1C           = pRiva->FgColor;
362         pRiva->riva.Bitmap->WidthHeightC      = (h << 16) | bw;
363         write_mem_barrier();
364         pRiva->riva.Bitmap->PointC            = (y << 16) | (x & 0xFFFF);
365         write_mem_barrier();
366     }
367     else
368     {
369         /* Opaque */
370         RIVA_FIFO_FREE(pRiva->riva, Bitmap, 7);
371         pRiva->riva.Bitmap->ClipE.TopLeft     = (y << 16) | ((x+skipleft)
372                                                            & 0xFFFF);
373         pRiva->riva.Bitmap->ClipE.BottomRight = ((y+h) << 16) | ((x+w)&0xffff);
374         pRiva->riva.Bitmap->Color0E           = pRiva->BgColor;
375         pRiva->riva.Bitmap->Color1E           = pRiva->FgColor;
376         pRiva->riva.Bitmap->WidthHeightInE  = (h << 16) | bw;
377         pRiva->riva.Bitmap->WidthHeightOutE = (h << 16) | bw;
378         write_mem_barrier();
379         pRiva->riva.Bitmap->PointE          = (y << 16) | (x & 0xFFFF);
380         write_mem_barrier();
381     }
382
383     pRiva->expandRows = h;
384
385     if(pRiva->expandWidth > (pRiva->riva.FifoEmptyCount >> 2)) {
386         pRiva->AccelInfoRec->ScanlineColorExpandBuffers = &pRiva->expandBuffer;
387         pRiva->AccelInfoRec->SubsequentColorExpandScanline = 
388                                 RivaSubsequentColorExpandScanline;
389     } else {
390         pRiva->AccelInfoRec->ScanlineColorExpandBuffers = &pRiva->expandFifo;
391         pRiva->AccelInfoRec->SubsequentColorExpandScanline = 
392                                 RivaSubsequentColorExpandScanlineFifo;
393         RIVA_FIFO_FREE(pRiva->riva, Bitmap, pRiva->expandWidth);
394     }
395 }
396
397 static void
398 RivaSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
399 {
400     RivaPtr pRiva = RivaPTR(pScrn);
401
402     RivaSetRopSolid(pRiva, rop);
403     pRiva->FgColor = color;
404 }
405
406 static void 
407 RivaSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
408 {
409     RivaPtr pRiva = RivaPTR(pScrn);
410
411     RIVA_FIFO_FREE(pRiva->riva, Line, 3);
412     pRiva->riva.Line->Color = pRiva->FgColor;
413     pRiva->riva.Line->Lin[0].point0 = ((y << 16) | ( x & 0xffff));
414     write_mem_barrier();
415     if ( dir ==DEGREES_0 )
416         pRiva->riva.Line->Lin[0].point1 = ((y << 16) | (( x + len ) & 0xffff));
417     else
418         pRiva->riva.Line->Lin[0].point1 = (((y + len) << 16) | ( x & 0xffff));
419     write_mem_barrier();
420 }
421
422 static void 
423 RivaSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
424                               int x2, int y2, int flags)
425 {
426     RivaPtr pRiva = RivaPTR(pScrn);
427     Bool  lastPoint = !(flags & OMIT_LAST);
428
429     RIVA_FIFO_FREE(pRiva->riva, Line, lastPoint ? 5 : 3);
430     pRiva->riva.Line->Color = pRiva->FgColor;
431     pRiva->riva.Line->Lin[0].point0 = ((y1 << 16) | (x1 & 0xffff));
432     write_mem_barrier();
433     pRiva->riva.Line->Lin[0].point1 = ((y2 << 16) | (x2 & 0xffff));
434     write_mem_barrier();
435     if (lastPoint)
436     {
437         pRiva->riva.Line->Lin[1].point0 = ((y2 << 16) | (x2 & 0xffff));
438         write_mem_barrier();
439         pRiva->riva.Line->Lin[1].point1 = (((y2 + 1) << 16) | (x2 & 0xffff));
440         write_mem_barrier();
441     }
442 }
443
444 static void
445 RivaValidatePolyArc(
446    GCPtr        pGC,
447    unsigned long changes,
448    DrawablePtr pDraw
449 ){
450    if(pGC->planemask != ~0) return;
451
452    if(!pGC->lineWidth && 
453         ((pGC->alu != GXcopy) || (pGC->lineStyle != LineSolid)))
454    {
455         pGC->ops->PolyArc = miZeroPolyArc;
456    }
457 }
458
459 static void
460 RivaValidatePolyPoint(
461    GCPtr        pGC,
462    unsigned long changes,
463    DrawablePtr pDraw
464 ){
465    pGC->ops->PolyPoint = XAAGetFallbackOps()->PolyPoint;
466
467    if(pGC->planemask != ~0) return;
468
469    if(pGC->alu != GXcopy)
470         pGC->ops->PolyPoint = miPolyPoint;
471 }
472
473 /* Initialize XAA acceleration info */
474 Bool
475 RivaAccelInit(ScreenPtr pScreen) 
476 {
477     XAAInfoRecPtr infoPtr;
478     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
479     RivaPtr pRiva = RivaPTR(pScrn);
480
481     pRiva->AccelInfoRec = infoPtr = XAACreateInfoRec();
482     if(!infoPtr) return FALSE;
483
484     /* fill out infoPtr here */
485     infoPtr->Flags = LINEAR_FRAMEBUFFER | PIXMAP_CACHE | OFFSCREEN_PIXMAPS;
486
487     /* sync */
488     infoPtr->Sync = RivaSync;
489
490     /* solid fills */
491     infoPtr->SolidFillFlags = NO_PLANEMASK;
492     infoPtr->SetupForSolidFill = RivaSetupForSolidFill;
493     infoPtr->SubsequentSolidFillRect = RivaSubsequentSolidFillRect;
494
495     /* screen to screen copy */
496     infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK;
497     infoPtr->SetupForScreenToScreenCopy = RivaSetupForScreenToScreenCopy;
498     infoPtr->SubsequentScreenToScreenCopy = RivaSubsequentScreenToScreenCopy;
499
500     /* 8x8 mono patterns */
501     /*
502      * Set pattern opaque bits based on pixel format.
503      */
504     pRiva->opaqueMonochrome = ~((1 << pScrn->depth) - 1);
505
506     infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_SCREEN_ORIGIN |
507                                        HARDWARE_PATTERN_PROGRAMMED_BITS |
508                                        NO_PLANEMASK;
509     infoPtr->SetupForMono8x8PatternFill = RivaSetupForMono8x8PatternFill;
510     infoPtr->SubsequentMono8x8PatternFillRect =
511         RivaSubsequentMono8x8PatternFillRect;
512
513     /* Color expansion */
514     infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
515                                 BIT_ORDER_IN_BYTE_LSBFIRST | 
516                                 NO_PLANEMASK | 
517                                 CPU_TRANSFER_PAD_DWORD |
518                                 LEFT_EDGE_CLIPPING |            
519                                 LEFT_EDGE_CLIPPING_NEGATIVE_X;
520
521     infoPtr->NumScanlineColorExpandBuffers = 1;
522
523     infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
524         RivaSetupForScanlineCPUToScreenColorExpandFill;
525     infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = 
526         RivaSubsequentScanlineCPUToScreenColorExpandFill;
527
528     pRiva->expandFifo = (unsigned char*)&pRiva->riva.Bitmap->MonochromeData01E;
529     
530     /* Allocate buffer for color expansion and also image writes in the
531        future */
532     pRiva->expandBuffer = xnfalloc(((pScrn->virtualX*pScrn->bitsPerPixel)/8) + 8);
533
534
535     infoPtr->ScanlineColorExpandBuffers = &pRiva->expandBuffer;
536     infoPtr->SubsequentColorExpandScanline = RivaSubsequentColorExpandScanline;
537
538     infoPtr->SolidLineFlags = infoPtr->SolidFillFlags;
539     infoPtr->SetupForSolidLine = RivaSetupForSolidLine;
540     infoPtr->SubsequentSolidHorVertLine =
541                 RivaSubsequentSolidHorVertLine;
542     infoPtr->SubsequentSolidTwoPointLine = 
543                 RivaSubsequentSolidTwoPointLine;
544     infoPtr->SetClippingRectangle = RivaSetClippingRectangle;
545     infoPtr->DisableClipping = RivaDisableClipping;
546     infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE;
547     miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6);
548
549     infoPtr->ValidatePolyArc = RivaValidatePolyArc;
550     infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask;
551     infoPtr->ValidatePolyPoint = RivaValidatePolyPoint;
552     infoPtr->PolyPointMask = GCFunction | GCPlaneMask;
553    
554     RivaResetGraphics(pScrn);
555
556     return(XAAInit(pScreen, infoPtr));
557 }
558