nv_xaa.c revision fc5a983d
1/*
2 * Copyright (c) 2003 NVIDIA, Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
28#include "nv_include.h"
29#include "xaalocal.h"
30#include "miline.h"
31#include "nv_dma.h"
32
33static const int NVCopyROP[16] =
34{
35   0x00,            /* GXclear */
36   0x88,            /* GXand */
37   0x44,            /* GXandReverse */
38   0xCC,            /* GXcopy */
39   0x22,            /* GXandInverted */
40   0xAA,            /* GXnoop */
41   0x66,            /* GXxor */
42   0xEE,            /* GXor */
43   0x11,            /* GXnor */
44   0x99,            /* GXequiv */
45   0x55,            /* GXinvert*/
46   0xDD,            /* GXorReverse */
47   0x33,            /* GXcopyInverted */
48   0xBB,            /* GXorInverted */
49   0x77,            /* GXnand */
50   0xFF             /* GXset */
51};
52
53static const int NVCopyROP_PM[16] =
54{
55   0x0A,            /* GXclear */
56   0x8A,            /* GXand */
57   0x4A,            /* GXandReverse */
58   0xCA,            /* GXcopy */
59   0x2A,            /* GXandInverted */
60   0xAA,            /* GXnoop */
61   0x6A,            /* GXxor */
62   0xEA,            /* GXor */
63   0x1A,            /* GXnor */
64   0x9A,            /* GXequiv */
65   0x5A,            /* GXinvert*/
66   0xDA,            /* GXorReverse */
67   0x3A,            /* GXcopyInverted */
68   0xBA,            /* GXorInverted */
69   0x7A,            /* GXnand */
70   0xFA             /* GXset */
71};
72
73static const int NVPatternROP[16] =
74{
75   0x00,
76   0xA0,
77   0x50,
78   0xF0,
79   0x0A,
80   0xAA,
81   0x5A,
82   0xFA,
83   0x05,
84   0xA5,
85   0x55,
86   0xF5,
87   0x0F,
88   0xAF,
89   0x5F,
90   0xFF
91};
92
93void
94NVDmaKickoff(NVPtr pNv)
95{
96    if(pNv->dmaCurrent != pNv->dmaPut) {
97        pNv->dmaPut = pNv->dmaCurrent;
98        WRITE_PUT(pNv,  pNv->dmaPut);
99    }
100}
101
102
103/* There is a HW race condition with videoram command buffers.
104   You can't jump to the location of your put offset.  We write put
105   at the jump offset + SKIPS dwords with noop padding in between
106   to solve this problem */
107#define SKIPS  8
108
109void
110NVDmaWait (
111   NVPtr pNv,
112   int size
113){
114    int dmaGet;
115
116    size++;
117
118    while(pNv->dmaFree < size) {
119       dmaGet = READ_GET(pNv);
120
121       if(pNv->dmaPut >= dmaGet) {
122           pNv->dmaFree = pNv->dmaMax - pNv->dmaCurrent;
123           if(pNv->dmaFree < size) {
124               NVDmaNext(pNv, 0x20000000);
125               if(dmaGet <= SKIPS) {
126                   if(pNv->dmaPut <= SKIPS) /* corner case - will be idle */
127                      WRITE_PUT(pNv, SKIPS + 1);
128                   do { dmaGet = READ_GET(pNv); }
129                   while(dmaGet <= SKIPS);
130               }
131               WRITE_PUT(pNv, SKIPS);
132               pNv->dmaCurrent = pNv->dmaPut = SKIPS;
133               pNv->dmaFree = dmaGet - (SKIPS + 1);
134           }
135       } else
136           pNv->dmaFree = dmaGet - pNv->dmaCurrent - 1;
137    }
138}
139
140void
141NVWaitVSync(NVPtr pNv)
142{
143    NVDmaStart(pNv, 0x0000A12C, 1);
144    NVDmaNext (pNv, 0);
145    NVDmaStart(pNv, 0x0000A134, 1);
146    NVDmaNext (pNv, pNv->CRTCnumber);
147    NVDmaStart(pNv, 0x0000A100, 1);
148    NVDmaNext (pNv, 0);
149    NVDmaStart(pNv, 0x0000A130, 1);
150    NVDmaNext (pNv, 0);
151}
152
153/*
154  currentRop =  0-15  solid fill
155               16-31  8x8 pattern fill
156               32-47  solid fill with planemask
157*/
158
159static void
160NVSetPattern(
161   ScrnInfoPtr pScrn,
162   CARD32 clr0,
163   CARD32 clr1,
164   CARD32 pat0,
165   CARD32 pat1
166)
167{
168    NVPtr pNv = NVPTR(pScrn);
169
170    NVDmaStart(pNv, PATTERN_COLOR_0, 4);
171    NVDmaNext (pNv, clr0);
172    NVDmaNext (pNv, clr1);
173    NVDmaNext (pNv, pat0);
174    NVDmaNext (pNv, pat1);
175}
176
177static void
178NVSetRopSolid(ScrnInfoPtr pScrn, CARD32 rop, CARD32 planemask)
179{
180    NVPtr pNv = NVPTR(pScrn);
181
182    if(planemask != ~0) {
183        NVSetPattern(pScrn, 0, planemask, ~0, ~0);
184        if(pNv->currentRop != (rop + 32)) {
185           NVDmaStart(pNv, ROP_SET, 1);
186           NVDmaNext (pNv, NVCopyROP_PM[rop]);
187           pNv->currentRop = rop + 32;
188        }
189    } else
190    if (pNv->currentRop != rop) {
191        if(pNv->currentRop >= 16)
192             NVSetPattern(pScrn, ~0, ~0, ~0, ~0);
193        NVDmaStart(pNv, ROP_SET, 1);
194        NVDmaNext (pNv, NVCopyROP[rop]);
195        pNv->currentRop = rop;
196    }
197}
198
199void NVResetGraphics(ScrnInfoPtr pScrn)
200{
201    NVPtr pNv = NVPTR(pScrn);
202    CARD32 surfaceFormat, patternFormat, rectFormat, lineFormat;
203    int pitch, i;
204
205    if(pNv->NoAccel) return;
206
207    pitch = pNv->CurrentLayout.displayWidth *
208            (pNv->CurrentLayout.bitsPerPixel >> 3);
209
210    pNv->dmaBase = (CARD32*)(&pNv->FbStart[pNv->FbUsableSize]);
211
212    for(i = 0; i < SKIPS; i++)
213      pNv->dmaBase[i] = 0x00000000;
214
215    pNv->dmaBase[0x0 + SKIPS] = 0x00040000;
216    pNv->dmaBase[0x1 + SKIPS] = 0x80000010;
217    pNv->dmaBase[0x2 + SKIPS] = 0x00042000;
218    pNv->dmaBase[0x3 + SKIPS] = 0x80000011;
219    pNv->dmaBase[0x4 + SKIPS] = 0x00044000;
220    pNv->dmaBase[0x5 + SKIPS] = 0x80000012;
221    pNv->dmaBase[0x6 + SKIPS] = 0x00046000;
222    pNv->dmaBase[0x7 + SKIPS] = 0x80000013;
223    pNv->dmaBase[0x8 + SKIPS] = 0x00048000;
224    pNv->dmaBase[0x9 + SKIPS] = 0x80000014;
225    pNv->dmaBase[0xA + SKIPS] = 0x0004A000;
226    pNv->dmaBase[0xB + SKIPS] = 0x80000015;
227    pNv->dmaBase[0xC + SKIPS] = 0x0004C000;
228    pNv->dmaBase[0xD + SKIPS] = 0x80000016;
229    pNv->dmaBase[0xE + SKIPS] = 0x0004E000;
230    pNv->dmaBase[0xF + SKIPS] = 0x80000017;
231
232    pNv->dmaPut = 0;
233    pNv->dmaCurrent = 16 + SKIPS;
234    pNv->dmaMax = 8191;
235    pNv->dmaFree = pNv->dmaMax - pNv->dmaCurrent;
236
237    switch(pNv->CurrentLayout.depth) {
238    case 24:
239       surfaceFormat = SURFACE_FORMAT_DEPTH24;
240       patternFormat = PATTERN_FORMAT_DEPTH24;
241       rectFormat    = RECT_FORMAT_DEPTH24;
242       lineFormat    = LINE_FORMAT_DEPTH24;
243       break;
244    case 16:
245    case 15:
246       surfaceFormat = SURFACE_FORMAT_DEPTH16;
247       patternFormat = PATTERN_FORMAT_DEPTH16;
248       rectFormat    = RECT_FORMAT_DEPTH16;
249       lineFormat    = LINE_FORMAT_DEPTH16;
250       break;
251    default:
252       surfaceFormat = SURFACE_FORMAT_DEPTH8;
253       patternFormat = PATTERN_FORMAT_DEPTH8;
254       rectFormat    = RECT_FORMAT_DEPTH8;
255       lineFormat    = LINE_FORMAT_DEPTH8;
256       break;
257    }
258
259    NVDmaStart(pNv, SURFACE_FORMAT, 4);
260    NVDmaNext (pNv, surfaceFormat);
261    NVDmaNext (pNv, pitch | (pitch << 16));
262    NVDmaNext (pNv, 0);
263    NVDmaNext (pNv, 0);
264
265    NVDmaStart(pNv, PATTERN_FORMAT, 1);
266    NVDmaNext (pNv, patternFormat);
267
268    NVDmaStart(pNv, RECT_FORMAT, 1);
269    NVDmaNext (pNv, rectFormat);
270
271    NVDmaStart(pNv, LINE_FORMAT, 1);
272    NVDmaNext (pNv, lineFormat);
273
274    pNv->currentRop = ~0;  /* set to something invalid */
275    NVSetRopSolid(pScrn, GXcopy, ~0);
276
277    NVDmaKickoff(pNv);
278}
279
280void NVSync(ScrnInfoPtr pScrn)
281{
282    NVPtr pNv = NVPTR(pScrn);
283
284    if(pNv->DMAKickoffCallback)
285       (*pNv->DMAKickoffCallback)(pScrn);
286
287    while(READ_GET(pNv) != pNv->dmaPut);
288
289    while(pNv->PGRAPH[0x0700/4]);
290}
291
292static void
293NVDMAKickoffCallback (ScrnInfoPtr pScrn)
294{
295   NVPtr pNv = NVPTR(pScrn);
296
297   NVDmaKickoff(pNv);
298   pNv->DMAKickoffCallback = NULL;
299}
300
301
302static void
303NVSetupForScreenToScreenCopy(
304   ScrnInfoPtr pScrn,
305   int xdir, int ydir,
306   int rop,
307   unsigned planemask,
308   int transparency_color
309)
310{
311    NVPtr pNv = NVPTR(pScrn);
312
313    planemask |= ~0 << pNv->CurrentLayout.depth;
314
315    NVSetRopSolid(pScrn, rop, planemask);
316
317    pNv->DMAKickoffCallback = NVDMAKickoffCallback;
318}
319
320static void
321NVSubsequentScreenToScreenCopy(
322   ScrnInfoPtr pScrn,
323   int x1, int y1,
324   int x2, int y2,
325   int w, int h
326)
327{
328    NVPtr pNv = NVPTR(pScrn);
329
330    NVDmaStart(pNv, BLIT_POINT_SRC, 3);
331    NVDmaNext (pNv, (y1 << 16) | x1);
332    NVDmaNext (pNv, (y2 << 16) | x2);
333    NVDmaNext (pNv, (h  << 16) | w);
334
335    if((w * h) >= 512)
336       NVDmaKickoff(pNv);
337}
338
339static void
340NVSetupForSolidFill(
341   ScrnInfoPtr pScrn,
342   int color,
343   int rop,
344   unsigned planemask
345)
346{
347   NVPtr pNv = NVPTR(pScrn);
348
349   planemask |= ~0 << pNv->CurrentLayout.depth;
350
351   NVSetRopSolid(pScrn, rop, planemask);
352   NVDmaStart(pNv, RECT_SOLID_COLOR, 1);
353   NVDmaNext (pNv, color);
354
355   pNv->DMAKickoffCallback = NVDMAKickoffCallback;
356}
357
358static void
359NVSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
360{
361   NVPtr pNv = NVPTR(pScrn);
362
363   NVDmaStart(pNv, RECT_SOLID_RECTS(0), 2);
364   NVDmaNext (pNv, (x << 16) | y);
365   NVDmaNext (pNv, (w << 16) | h);
366
367   if((w * h) >= 512)
368      NVDmaKickoff(pNv);
369}
370
371static void
372NVSetupForMono8x8PatternFill (
373   ScrnInfoPtr pScrn,
374   int patternx, int patterny,
375   int fg, int bg,
376   int rop,
377   unsigned planemask
378)
379{
380   NVPtr pNv = NVPTR(pScrn);
381
382   planemask = ~0 << pNv->CurrentLayout.depth;
383
384   fg |= planemask;
385   if(bg == -1) bg = 0;
386   else bg |= planemask;
387
388   if (pNv->currentRop != (rop + 16)) {
389       NVDmaStart(pNv, ROP_SET, 1);
390       NVDmaNext (pNv, NVPatternROP[rop]);
391       pNv->currentRop = rop + 16;
392   }
393
394   NVSetPattern(pScrn, bg, fg, patternx, patterny);
395   NVDmaStart(pNv, RECT_SOLID_COLOR, 1);
396   NVDmaNext (pNv, fg);
397
398   pNv->DMAKickoffCallback = NVDMAKickoffCallback;
399}
400
401static void
402NVSubsequentMono8x8PatternFillRect(
403   ScrnInfoPtr pScrn,
404   int patternx, int patterny,
405   int x, int y,
406   int w, int h
407)
408{
409   NVPtr pNv = NVPTR(pScrn);
410
411   NVDmaStart(pNv, RECT_SOLID_RECTS(0), 2);
412   NVDmaNext (pNv, (x << 16) | y);
413   NVDmaNext (pNv, (w << 16) | h);
414
415   if((w * h) >= 512)
416      NVDmaKickoff(pNv);
417}
418
419static CARD32 _bg_pixel;
420static CARD32 _fg_pixel;
421static Bool _transparent;
422static CARD32 _color_expand_dwords;
423static CARD32 _color_expand_offset;
424static int _remaining;
425static unsigned char *_storage_buffer[1];
426
427static void
428NVSetupForScanlineCPUToScreenColorExpandFill (
429   ScrnInfoPtr pScrn,
430   int fg, int bg,
431   int rop,
432   unsigned int planemask
433)
434{
435   NVPtr pNv = NVPTR(pScrn);
436
437   CARD32 mask = ~0 << pNv->CurrentLayout.depth;
438
439   planemask |= mask;
440   _fg_pixel = fg | mask;
441
442   if(bg == -1) {
443      _transparent = TRUE;
444   } else {
445      _transparent = FALSE;
446      _bg_pixel = bg | mask;
447   }
448
449   NVSetRopSolid (pScrn, rop, planemask);
450}
451
452static void
453NVSubsequentScanlineCPUToScreenColorExpandFill (
454    ScrnInfoPtr pScrn,
455    int x, int y,
456    int w, int h,
457    int skipleft
458)
459{
460   NVPtr pNv = NVPTR(pScrn);
461   int bw = (w + 31) & ~31;
462
463   _color_expand_dwords = bw >> 5;
464   _remaining = h;
465
466   if(_transparent) {
467      NVDmaStart(pNv, RECT_EXPAND_ONE_COLOR_CLIP, 5);
468      NVDmaNext (pNv, (y << 16) | ((x + skipleft) & 0xFFFF));
469      NVDmaNext (pNv, ((y + h) << 16) | ((x + w) & 0xFFFF));
470      NVDmaNext (pNv, _fg_pixel);
471      NVDmaNext (pNv, (h << 16) | bw);
472      NVDmaNext (pNv, (y << 16) | (x & 0xFFFF));
473      _color_expand_offset = RECT_EXPAND_ONE_COLOR_DATA(0);
474   } else {
475      NVDmaStart(pNv, RECT_EXPAND_TWO_COLOR_CLIP, 7);
476      NVDmaNext (pNv, (y << 16) | ((x + skipleft) & 0xFFFF));
477      NVDmaNext (pNv, ((y + h) << 16) | ((x + w) & 0xFFFF));
478      NVDmaNext (pNv, _bg_pixel);
479      NVDmaNext (pNv, _fg_pixel);
480      NVDmaNext (pNv, (h << 16) | bw);
481      NVDmaNext (pNv, (h << 16) | bw);
482      NVDmaNext (pNv, (y << 16) | (x & 0xFFFF));
483      _color_expand_offset = RECT_EXPAND_TWO_COLOR_DATA(0);
484   }
485
486   NVDmaStart(pNv, _color_expand_offset, _color_expand_dwords);
487   _storage_buffer[0] = (unsigned char*)&pNv->dmaBase[pNv->dmaCurrent];
488}
489
490static void
491NVSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
492{
493   NVPtr pNv = NVPTR(pScrn);
494
495   pNv->dmaCurrent += _color_expand_dwords;
496
497   if(--_remaining) {
498       NVDmaStart(pNv, _color_expand_offset, _color_expand_dwords);
499       _storage_buffer[0] = (unsigned char*)&pNv->dmaBase[pNv->dmaCurrent];
500   } else {
501       /* hardware bug workaround */
502       NVDmaStart(pNv, BLIT_POINT_SRC, 1);
503       NVDmaNext (pNv, 0);
504       NVDmaKickoff(pNv);
505   }
506}
507
508static void
509NVSetupForScanlineImageWrite(
510   ScrnInfoPtr pScrn, int rop,
511   unsigned int planemask,
512   int trans_color,
513   int bpp, int depth
514)
515{
516   NVPtr pNv = NVPTR(pScrn);
517
518   planemask |= ~0 << pNv->CurrentLayout.depth;
519
520   NVSetRopSolid (pScrn, rop, planemask);
521}
522
523static CARD32 _image_size;
524static CARD32 _image_srcpoint;
525static CARD32 _image_dstpoint;
526static CARD32 _image_dstpitch;
527
528static void
529NVSubsequentScanlineImageWriteRect(
530   ScrnInfoPtr pScrn,
531   int x, int y,
532   int w, int h,
533   int skipleft
534)
535{
536   NVPtr pNv = NVPTR(pScrn);
537   int Bpp = pNv->CurrentLayout.bitsPerPixel >> 3;
538   int image_srcpitch;
539
540   _image_size = (1 << 16) | (w - skipleft);
541   _image_srcpoint = skipleft;
542   _image_dstpoint = (y << 16) | (x + skipleft);
543   _remaining = h;
544   _image_dstpitch = pNv->CurrentLayout.displayWidth * Bpp;
545   image_srcpitch =  ((w * Bpp) + 63) & ~63;
546   _storage_buffer[0] = pNv->FbStart + pNv->ScratchBufferStart;
547
548   NVSync(pScrn);
549
550   NVDmaStart(pNv, SURFACE_PITCH, 2);
551   NVDmaNext (pNv, (_image_dstpitch << 16) | image_srcpitch);
552   NVDmaNext (pNv, pNv->ScratchBufferStart);
553}
554
555static void NVSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
556{
557   NVPtr pNv = NVPTR(pScrn);
558
559   NVDmaStart(pNv, BLIT_POINT_SRC, 3);
560   NVDmaNext (pNv, _image_srcpoint);
561   NVDmaNext (pNv, _image_dstpoint);
562   NVDmaNext (pNv, _image_size);
563   NVDmaKickoff(pNv);
564
565   if(--_remaining) {
566      _image_dstpoint += (1 << 16);
567      NVSync(pScrn);
568   } else {
569      NVDmaStart(pNv, SURFACE_PITCH, 2);
570      NVDmaNext (pNv, _image_dstpitch | (_image_dstpitch << 16));
571      NVDmaNext (pNv, 0);
572   }
573}
574
575static void
576NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
577{
578    NVPtr pNv = NVPTR(pScrn);
579
580    planemask |= ~0 << pNv->CurrentLayout.depth;
581
582    NVSetRopSolid(pScrn, rop, planemask);
583
584    _fg_pixel = color;
585
586    pNv->DMAKickoffCallback = NVDMAKickoffCallback;
587}
588
589static void
590NVSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
591{
592    NVPtr pNv = NVPTR(pScrn);
593
594    NVDmaStart(pNv, LINE_COLOR, 1);
595    NVDmaNext (pNv, _fg_pixel);
596    NVDmaStart(pNv, LINE_LINES(0), 2);
597    NVDmaNext (pNv, (y << 16) | ( x & 0xffff));
598    if(dir == DEGREES_0) {
599       NVDmaNext (pNv, (y << 16) | ((x + len) & 0xffff));
600    } else {
601       NVDmaNext (pNv, ((y + len) << 16) | (x & 0xffff));
602    }
603}
604
605static void
606NVSubsequentSolidTwoPointLine(
607   ScrnInfoPtr pScrn,
608   int x1, int y1,
609   int x2, int y2,
610   int flags
611)
612{
613    NVPtr pNv = NVPTR(pScrn);
614    Bool drawLast = !(flags & OMIT_LAST);
615
616    NVDmaStart(pNv, LINE_COLOR, 1);
617    NVDmaNext (pNv, _fg_pixel);
618    NVDmaStart(pNv, LINE_LINES(0), drawLast ? 4 : 2);
619    NVDmaNext (pNv, (y1 << 16) | (x1 & 0xffff));
620    NVDmaNext (pNv, (y2 << 16) | (x2 & 0xffff));
621    if(drawLast) {
622        NVDmaNext (pNv, (y2 << 16) | (x2 & 0xffff));
623        NVDmaNext (pNv, ((y2 + 1) << 16) | (x2 & 0xffff));
624    }
625}
626
627static void
628NVSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
629{
630    NVPtr pNv = NVPTR(pScrn);
631    int h = y2 - y1 + 1;
632    int w = x2 - x1 + 1;
633
634    NVDmaStart(pNv, CLIP_POINT, 2);
635    NVDmaNext (pNv, (y1 << 16) | x1);
636    NVDmaNext (pNv, (h << 16) | w);
637}
638
639static void
640NVDisableClipping(ScrnInfoPtr pScrn)
641{
642    NVPtr pNv = NVPTR(pScrn);
643
644    NVDmaStart(pNv, CLIP_POINT, 2);
645    NVDmaNext (pNv, 0);
646    NVDmaNext (pNv, 0x7FFF7FFF);
647}
648
649
650/* Initialize XAA acceleration info */
651Bool
652NVAccelInit(ScreenPtr pScreen)
653{
654   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
655   NVPtr pNv = NVPTR(pScrn);
656   XAAInfoRecPtr accel;
657
658   accel = pNv->AccelInfoRec = XAACreateInfoRec();
659   if(!accel) return FALSE;
660
661   accel->Flags = LINEAR_FRAMEBUFFER | PIXMAP_CACHE | OFFSCREEN_PIXMAPS;
662   accel->Sync = NVSync;
663
664   accel->ScreenToScreenCopyFlags = NO_TRANSPARENCY;
665   accel->SetupForScreenToScreenCopy = NVSetupForScreenToScreenCopy;
666   accel->SubsequentScreenToScreenCopy = NVSubsequentScreenToScreenCopy;
667
668   accel->SolidFillFlags = 0;
669   accel->SetupForSolidFill = NVSetupForSolidFill;
670   accel->SubsequentSolidFillRect = NVSubsequentSolidFillRect;
671
672   accel->Mono8x8PatternFillFlags = HARDWARE_PATTERN_SCREEN_ORIGIN |
673                                    HARDWARE_PATTERN_PROGRAMMED_BITS |
674                                    NO_PLANEMASK;
675   accel->SetupForMono8x8PatternFill = NVSetupForMono8x8PatternFill;
676   accel->SubsequentMono8x8PatternFillRect = NVSubsequentMono8x8PatternFillRect;
677
678   accel->ScanlineCPUToScreenColorExpandFillFlags =
679                                    BIT_ORDER_IN_BYTE_LSBFIRST |
680                                    CPU_TRANSFER_PAD_DWORD |
681                                    LEFT_EDGE_CLIPPING |
682                                    LEFT_EDGE_CLIPPING_NEGATIVE_X;
683   accel->NumScanlineColorExpandBuffers = 1;
684   accel->SetupForScanlineCPUToScreenColorExpandFill =
685            NVSetupForScanlineCPUToScreenColorExpandFill;
686   accel->SubsequentScanlineCPUToScreenColorExpandFill =
687            NVSubsequentScanlineCPUToScreenColorExpandFill;
688   accel->SubsequentColorExpandScanline =
689            NVSubsequentColorExpandScanline;
690   accel->ScanlineColorExpandBuffers = _storage_buffer;
691
692   accel->ScanlineImageWriteFlags = NO_GXCOPY |
693                                    NO_TRANSPARENCY |
694                                    LEFT_EDGE_CLIPPING |
695                                    LEFT_EDGE_CLIPPING_NEGATIVE_X;
696   accel->NumScanlineImageWriteBuffers = 1;
697   accel->SetupForScanlineImageWrite = NVSetupForScanlineImageWrite;
698   accel->SubsequentScanlineImageWriteRect = NVSubsequentScanlineImageWriteRect;
699   accel->SubsequentImageWriteScanline = NVSubsequentImageWriteScanline;
700   accel->ScanlineImageWriteBuffers = _storage_buffer;
701
702   accel->SolidLineFlags = 0;
703   accel->SetupForSolidLine = NVSetupForSolidLine;
704   accel->SubsequentSolidHorVertLine = NVSubsequentSolidHorVertLine;
705   accel->SubsequentSolidTwoPointLine = NVSubsequentSolidTwoPointLine;
706   accel->SetClippingRectangle = NVSetClippingRectangle;
707   accel->DisableClipping = NVDisableClipping;
708   accel->ClippingFlags = HARDWARE_CLIP_SOLID_LINE;
709
710   miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6);
711
712   return (XAAInit(pScreen, accel));
713}
714