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