g80_display.c revision f3561b8b
1/*
2 * Copyright (c) 2007 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
25#ifdef HAVE_CONFIG_H
26#include "config.h"
27#endif
28
29#include <float.h>
30#include <math.h>
31#include <strings.h>
32#include <unistd.h>
33
34#include "g80_type.h"
35#include "g80_cursor.h"
36#include "g80_display.h"
37#include "g80_output.h"
38
39typedef struct G80CrtcPrivRec {
40    Head head;
41    int pclk; /* Target pixel clock in kHz */
42    Bool cursorVisible;
43    Bool skipModeFixup;
44    Bool dither;
45} G80CrtcPrivRec, *G80CrtcPrivPtr;
46
47static void G80CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update);
48
49/*
50 * PLL calculation.  pclk is in kHz.
51 */
52static void
53G80CalcPLL(float pclk, int *pNA, int *pMA, int *pNB, int *pMB, int *pP)
54{
55    const float refclk = 27000.0f;
56    const float minVcoA = 100000;
57    const float maxVcoA = 400000;
58    const float minVcoB = 600000;
59    float maxVcoB = 1400000;
60    const float minUA = 2000;
61    const float maxUA = 400000;
62    const float minUB = 50000;
63    const float maxUB = 200000;
64    const int minNA = 1, maxNA = 255;
65    const int minNB = 1, maxNB = 31;
66    const int minMA = 1, maxMA = 255;
67    const int minMB = 1, maxMB = 31;
68    const int minP = 0, maxP = 6;
69    int lowP, highP;
70    float vcoB;
71
72    int na, ma, nb, mb, p;
73    float bestError = FLT_MAX;
74
75    *pNA = *pMA = *pNB = *pMB = *pP = 0;
76
77    if(maxVcoB < pclk + pclk / 200)
78        maxVcoB = pclk + pclk / 200;
79    if(minVcoB / (1 << maxP) > pclk)
80        pclk = minVcoB / (1 << maxP);
81
82    vcoB = maxVcoB - maxVcoB / 200;
83    lowP = minP;
84    vcoB /= 1 << (lowP + 1);
85
86    while(pclk <= vcoB && lowP < maxP)
87    {
88        vcoB /= 2;
89        lowP++;
90    }
91
92    vcoB = maxVcoB + maxVcoB / 200;
93    highP = lowP;
94    vcoB /= 1 << (highP + 1);
95
96    while(pclk <= vcoB && highP < maxP)
97    {
98        vcoB /= 2;
99        highP++;
100    }
101
102    for(p = lowP; p <= highP; p++)
103    {
104        for(ma = minMA; ma <= maxMA; ma++)
105        {
106            if(refclk / ma < minUA)
107                break;
108            else if(refclk / ma > maxUA)
109                continue;
110
111            for(na = minNA; na <= maxNA; na++)
112            {
113                if(refclk * na / ma < minVcoA || refclk * na / ma > maxVcoA)
114                    continue;
115
116                for(mb = minMB; mb <= maxMB; mb++)
117                {
118                    if(refclk * na / ma / mb < minUB)
119                        break;
120                    else if(refclk * na / ma / mb > maxUB)
121                        continue;
122
123                    nb = rint(pclk * (1 << p) * (ma / (float)na) * mb / refclk);
124
125                    if(nb > maxNB)
126                        break;
127                    else if(nb < minNB)
128                        continue;
129                    else
130                    {
131                        float freq = refclk * (na / (float)ma) * (nb / (float)mb) / (1 << p);
132                        float error = fabsf(pclk - freq);
133                        if(error < bestError) {
134                            *pNA = na;
135                            *pMA = ma;
136                            *pNB = nb;
137                            *pMB = mb;
138                            *pP = p;
139                            bestError = error;
140                        }
141                    }
142                }
143            }
144        }
145    }
146}
147
148static void
149G80CrtcSetPClk(xf86CrtcPtr crtc)
150{
151    G80Ptr pNv = G80PTR(crtc->scrn);
152    G80CrtcPrivPtr pPriv = crtc->driver_private;
153    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
154    const int headOff = 0x800 * pPriv->head;
155    int lo_n, lo_m, hi_n, hi_m, p, i;
156    CARD32 lo = pNv->reg[(0x00614104+headOff)/4];
157    CARD32 hi = pNv->reg[(0x00614108+headOff)/4];
158
159    pNv->reg[(0x00614100+headOff)/4] = 0x10000610;
160    lo &= 0xff00ff00;
161    hi &= 0x8000ff00;
162
163    G80CalcPLL(pPriv->pclk, &lo_n, &lo_m, &hi_n, &hi_m, &p);
164
165    lo |= (lo_m << 16) | lo_n;
166    hi |= (p << 28) | (hi_m << 16) | hi_n;
167    pNv->reg[(0x00614104+headOff)/4] = lo;
168    pNv->reg[(0x00614108+headOff)/4] = hi;
169    pNv->reg[(0x00614200+headOff)/4] = 0;
170
171    for(i = 0; i < xf86_config->num_output; i++) {
172        xf86OutputPtr output = xf86_config->output[i];
173
174        if(output->crtc != crtc)
175            continue;
176        G80OutputSetPClk(output, pPriv->pclk);
177    }
178}
179
180void
181G80DispCommand(ScrnInfoPtr pScrn, CARD32 addr, CARD32 data)
182{
183    G80Ptr pNv = G80PTR(pScrn);
184
185    pNv->reg[0x00610304/4] = data;
186    pNv->reg[0x00610300/4] = addr | 0x80010001;
187
188    while(pNv->reg[0x00610300/4] & 0x80000000) {
189        const int super = ffs((pNv->reg[0x00610024/4] >> 4) & 7);
190
191        if(super) {
192            if(super == 2) {
193                xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
194                int i;
195
196                for(i = 0; i < xf86_config->num_crtc; i++)
197                {
198                    xf86CrtcPtr crtc = xf86_config->crtc[i];
199                    const int headOff = 0x800 * G80CrtcGetHead(crtc);
200
201                    if((pNv->reg[(0x00614200+headOff)/4] & 0xc0) == 0x80)
202                        G80CrtcSetPClk(crtc);
203                }
204            }
205
206            pNv->reg[0x00610024/4] = 8 << super;
207            pNv->reg[0x00610030/4] = 0x80000000;
208        }
209    }
210}
211
212Head
213G80CrtcGetHead(xf86CrtcPtr crtc)
214{
215    G80CrtcPrivPtr pPriv = crtc->driver_private;
216    return pPriv->head;
217}
218
219Bool
220G80DispPreInit(ScrnInfoPtr pScrn)
221{
222    G80Ptr pNv = G80PTR(pScrn);
223
224    pNv->reg[0x00610184/4] = pNv->reg[0x00614004/4];
225    pNv->reg[0x00610190/4] = pNv->reg[0x00616100/4];
226    pNv->reg[0x006101a0/4] = pNv->reg[0x00616900/4];
227    pNv->reg[0x00610194/4] = pNv->reg[0x00616104/4];
228    pNv->reg[0x006101a4/4] = pNv->reg[0x00616904/4];
229    pNv->reg[0x00610198/4] = pNv->reg[0x00616108/4];
230    pNv->reg[0x006101a8/4] = pNv->reg[0x00616908/4];
231    pNv->reg[0x0061019C/4] = pNv->reg[0x0061610C/4];
232    pNv->reg[0x006101ac/4] = pNv->reg[0x0061690c/4];
233    pNv->reg[0x006101D0/4] = pNv->reg[0x0061A000/4];
234    pNv->reg[0x006101D4/4] = pNv->reg[0x0061A800/4];
235    pNv->reg[0x006101D8/4] = pNv->reg[0x0061B000/4];
236    pNv->reg[0x006101E0/4] = pNv->reg[0x0061C000/4];
237    pNv->reg[0x006101E4/4] = pNv->reg[0x0061C800/4];
238    pNv->reg[0x0061A004/4] = 0x80550000;
239    pNv->reg[0x0061A010/4] = 0x00000001;
240    pNv->reg[0x0061A804/4] = 0x80550000;
241    pNv->reg[0x0061A810/4] = 0x00000001;
242    pNv->reg[0x0061B004/4] = 0x80550000;
243    pNv->reg[0x0061B010/4] = 0x00000001;
244
245    return TRUE;
246}
247
248Bool
249G80DispInit(ScrnInfoPtr pScrn)
250{
251    G80Ptr pNv = G80PTR(pScrn);
252    CARD32 val;
253
254    if(pNv->reg[0x00610024/4] & 0x100) {
255        pNv->reg[0x00610024/4] = 0x100;
256        pNv->reg[0x006194E8/4] &= ~1;
257        while(pNv->reg[0x006194E8/4] & 2);
258    }
259
260    pNv->reg[0x00610200/4] = 0x2b00;
261    do {
262        val = pNv->reg[0x00610200/4];
263
264        if ((val & 0x9f0000) == 0x20000)
265            pNv->reg[0x00610200/4] = val | 0x800000;
266
267        if ((val & 0x3f0000) == 0x30000)
268            pNv->reg[0x00610200/4] = val | 0x200000;
269    } while ((val & 0x1e0000) != 0);
270    pNv->reg[0x00610300/4] = 1;
271    pNv->reg[0x00610200/4] = 0x1000b03;
272    while(!(pNv->reg[0x00610200/4] & 0x40000000));
273
274    C(0x00000084, 0);
275    C(0x00000088, 0);
276    C(0x00000874, 0);
277    C(0x00000800, 0);
278    C(0x00000810, 0);
279    C(0x0000082C, 0);
280
281    return TRUE;
282}
283
284void
285G80DispShutdown(ScrnInfoPtr pScrn)
286{
287    G80Ptr pNv = G80PTR(pScrn);
288    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
289    int i;
290
291    for(i = 0; i < xf86_config->num_crtc; i++) {
292        xf86CrtcPtr crtc = xf86_config->crtc[i];
293
294        G80CrtcBlankScreen(crtc, TRUE);
295    }
296
297    C(0x00000080, 0);
298
299    for(i = 0; i < xf86_config->num_crtc; i++) {
300        xf86CrtcPtr crtc = xf86_config->crtc[i];
301
302        if(crtc->enabled) {
303            const CARD32 mask = 4 << G80CrtcGetHead(crtc);
304
305            pNv->reg[0x00610024/4] = mask;
306            while(!(pNv->reg[0x00610024/4] & mask));
307        }
308    }
309
310    pNv->reg[0x00610200/4] = 0;
311    pNv->reg[0x00610300/4] = 0;
312    while((pNv->reg[0x00610200/4] & 0x1e0000) != 0);
313    while((pNv->reg[0x61C030/4] & 0x10000000));
314    while((pNv->reg[0x61C830/4] & 0x10000000));
315}
316
317void
318G80CrtcDoModeFixup(DisplayModePtr dst, const DisplayModePtr src)
319{
320    /* Magic mode timing fudge factor */
321    const int fudge = ((src->Flags & V_INTERLACE) && (src->Flags & V_DBLSCAN)) ? 2 : 1;
322    const int interlaceDiv = (src->Flags & V_INTERLACE) ? 2 : 1;
323
324    /* Stash the src timings in the Crtc fields in dst */
325    dst->CrtcHBlankStart = src->CrtcVTotal << 16 | src->CrtcHTotal;
326    dst->CrtcHSyncEnd = ((src->CrtcVSyncEnd - src->CrtcVSyncStart) / interlaceDiv - 1) << 16 |
327        (src->CrtcHSyncEnd - src->CrtcHSyncStart - 1);
328    dst->CrtcHBlankEnd = ((src->CrtcVBlankEnd - src->CrtcVSyncStart) / interlaceDiv - fudge) << 16 |
329        (src->CrtcHBlankEnd - src->CrtcHSyncStart - 1);
330    dst->CrtcHTotal = ((src->CrtcVTotal - src->CrtcVSyncStart + src->CrtcVBlankStart) / interlaceDiv - fudge) << 16 |
331        (src->CrtcHTotal - src->CrtcHSyncStart + src->CrtcHBlankStart - 1);
332    dst->CrtcHSkew = ((src->CrtcVTotal + src->CrtcVBlankEnd - src->CrtcVSyncStart) / 2 - 2) << 16 |
333        ((2*src->CrtcVTotal - src->CrtcVSyncStart + src->CrtcVBlankStart) / 2 - 2);
334}
335
336static Bool
337G80CrtcModeFixup(xf86CrtcPtr crtc,
338                 DisplayModePtr mode, DisplayModePtr adjusted_mode)
339{
340    G80CrtcPrivPtr pPriv = crtc->driver_private;
341
342    if(pPriv->skipModeFixup)
343        return TRUE;
344
345    G80CrtcDoModeFixup(adjusted_mode, mode);
346    return TRUE;
347}
348
349static void
350G80CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode,
351               DisplayModePtr adjusted_mode, int x, int y)
352{
353    ScrnInfoPtr pScrn = crtc->scrn;
354    G80CrtcPrivPtr pPriv = crtc->driver_private;
355    const int HDisplay = adjusted_mode->HDisplay, VDisplay = adjusted_mode->VDisplay;
356    const int headOff = 0x400 * G80CrtcGetHead(crtc);
357
358    pPriv->pclk = adjusted_mode->Clock;
359
360    C(0x00000804 + headOff, adjusted_mode->Clock | 0x800000);
361    C(0x00000808 + headOff, (adjusted_mode->Flags & V_INTERLACE) ? 2 : 0);
362    C(0x00000810 + headOff, 0);
363    C(0x0000082C + headOff, 0);
364    C(0x00000814 + headOff, adjusted_mode->CrtcHBlankStart);
365    C(0x00000818 + headOff, adjusted_mode->CrtcHSyncEnd);
366    C(0x0000081C + headOff, adjusted_mode->CrtcHBlankEnd);
367    C(0x00000820 + headOff, adjusted_mode->CrtcHTotal);
368    if(adjusted_mode->Flags & V_INTERLACE)
369        C(0x00000824 + headOff, adjusted_mode->CrtcHSkew);
370    C(0x00000868 + headOff, pScrn->virtualY << 16 | pScrn->virtualX);
371    C(0x0000086C + headOff, pScrn->displayWidth * (pScrn->bitsPerPixel / 8) | 0x100000);
372    switch(pScrn->depth) {
373        case  8: C(0x00000870 + headOff, 0x1E00); break;
374        case 15: C(0x00000870 + headOff, 0xE900); break;
375        case 16: C(0x00000870 + headOff, 0xE800); break;
376        case 24: C(0x00000870 + headOff, 0xCF00); break;
377    }
378    G80CrtcSetDither(crtc, pPriv->dither, FALSE);
379    C(0x000008A8 + headOff, 0x40000);
380    C(0x000008C0 + headOff, y << 16 | x);
381    C(0x000008C8 + headOff, VDisplay << 16 | HDisplay);
382    C(0x000008D4 + headOff, 0);
383
384    G80CrtcBlankScreen(crtc, FALSE);
385}
386
387void
388G80CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)
389{
390    ScrnInfoPtr pScrn = crtc->scrn;
391    G80Ptr pNv = G80PTR(pScrn);
392    G80CrtcPrivPtr pPriv = crtc->driver_private;
393    const int headOff = 0x400 * pPriv->head;
394
395    if(blank) {
396        G80CrtcShowHideCursor(crtc, FALSE, FALSE);
397
398        C(0x00000840 + headOff, 0);
399        C(0x00000844 + headOff, 0);
400        if(pNv->architecture != 0x50)
401            C(0x0000085C + headOff, 0);
402        C(0x00000874 + headOff, 0);
403        if(pNv->architecture != 0x50)
404            C(0x0000089C + headOff, 0);
405    } else {
406        C(0x00000860 + headOff, 0);
407        C(0x00000864 + headOff, 0);
408        pNv->reg[0x00610380/4] = 0;
409        pNv->reg[0x00610384/4] = pNv->videoRam * 1024 - 1;
410        pNv->reg[0x00610388/4] = 0x150000;
411        pNv->reg[0x0061038C/4] = 0;
412        C(0x00000884 + headOff, (pNv->videoRam << 2) - 0x40);
413        if(pNv->architecture != 0x50)
414            C(0x0000089C + headOff, 1);
415        if(pPriv->cursorVisible)
416            G80CrtcShowHideCursor(crtc, TRUE, FALSE);
417        C(0x00000840 + headOff, pScrn->depth == 8 ? 0x80000000 : 0xc0000000);
418        C(0x00000844 + headOff, (pNv->videoRam * 1024 - 0x5000) >> 8);
419        if(pNv->architecture != 0x50)
420            C(0x0000085C + headOff, 1);
421        C(0x00000874 + headOff, 1);
422    }
423}
424
425static void
426G80CrtcDPMSSet(xf86CrtcPtr crtc, int mode)
427{
428}
429
430/******************************** Cursor stuff ********************************/
431static void G80CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update)
432{
433    ScrnInfoPtr pScrn = crtc->scrn;
434    G80CrtcPrivPtr pPriv = crtc->driver_private;
435    const int headOff = 0x400 * G80CrtcGetHead(crtc);
436
437    C(0x00000880 + headOff, show ? 0x85000000 : 0x5000000);
438    if(update) {
439        pPriv->cursorVisible = show;
440        C(0x00000080, 0);
441    }
442}
443
444static void G80CrtcShowCursor(xf86CrtcPtr crtc)
445{
446    G80CrtcShowHideCursor(crtc, TRUE, TRUE);
447}
448
449static void G80CrtcHideCursor(xf86CrtcPtr crtc)
450{
451    G80CrtcShowHideCursor(crtc, FALSE, TRUE);
452}
453
454/******************************** CRTC stuff ********************************/
455
456static Bool
457G80CrtcLock(xf86CrtcPtr crtc)
458{
459    return FALSE;
460}
461
462static void
463G80CrtcPrepare(xf86CrtcPtr crtc)
464{
465    ScrnInfoPtr pScrn = crtc->scrn;
466    G80CrtcPrivPtr pPriv = crtc->driver_private;
467    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
468    int i;
469
470    for(i = 0; i < xf86_config->num_output; i++) {
471        xf86OutputPtr output = xf86_config->output[i];
472
473        if(!output->crtc)
474            output->funcs->mode_set(output, NULL, NULL);
475    }
476
477    pPriv->skipModeFixup = FALSE;
478}
479
480void
481G80CrtcSkipModeFixup(xf86CrtcPtr crtc)
482{
483    G80CrtcPrivPtr pPriv = crtc->driver_private;
484    pPriv->skipModeFixup = TRUE;
485}
486
487void
488G80CrtcSetDither(xf86CrtcPtr crtc, Bool dither, Bool update)
489{
490    ScrnInfoPtr pScrn = crtc->scrn;
491    G80CrtcPrivPtr pPriv = crtc->driver_private;
492    const int headOff = 0x400 * G80CrtcGetHead(crtc);
493
494    pPriv->dither = dither;
495
496    C(0x000008A0 + headOff, dither ? 0x11 : 0);
497    if(update) C(0x00000080, 0);
498}
499
500static void ComputeAspectScale(DisplayModePtr mode, int *outX, int *outY)
501{
502    float scaleX, scaleY, scale;
503
504    scaleX = mode->CrtcHDisplay / (float)mode->HDisplay;
505    scaleY = mode->CrtcVDisplay / (float)mode->VDisplay;
506
507    if(scaleX > scaleY)
508        scale = scaleY;
509    else
510        scale = scaleX;
511
512    *outX = mode->HDisplay * scale;
513    *outY = mode->VDisplay * scale;
514}
515
516void G80CrtcSetScale(xf86CrtcPtr crtc, DisplayModePtr mode,
517                     enum G80ScaleMode scale)
518{
519    ScrnInfoPtr pScrn = crtc->scrn;
520    G80CrtcPrivPtr pPriv = crtc->driver_private;
521    const int headOff = 0x400 * pPriv->head;
522    int outX, outY;
523
524    switch(scale) {
525        default:
526        case G80_SCALE_ASPECT:
527            ComputeAspectScale(mode, &outX, &outY);
528            break;
529
530        case G80_SCALE_OFF:
531        case G80_SCALE_FILL:
532            outX = mode->CrtcHDisplay;
533            outY = mode->CrtcVDisplay;
534            break;
535
536        case G80_SCALE_CENTER:
537            outX = mode->HDisplay;
538            outY = mode->VDisplay;
539            break;
540    }
541
542    if((mode->Flags & V_DBLSCAN) || (mode->Flags & V_INTERLACE) ||
543       mode->HDisplay != outX || mode->VDisplay != outY) {
544        C(0x000008A4 + headOff, 9);
545    } else {
546        C(0x000008A4 + headOff, 0);
547    }
548    C(0x000008D8 + headOff, outY << 16 | outX);
549    C(0x000008DC + headOff, outY << 16 | outX);
550}
551
552static void
553G80CrtcCommit(xf86CrtcPtr crtc)
554{
555    ScrnInfoPtr pScrn = crtc->scrn;
556    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
557    int i, crtc_mask = 0;
558
559    /* If any heads are unused, blank them */
560    for(i = 0; i < xf86_config->num_output; i++) {
561        xf86OutputPtr output = xf86_config->output[i];
562
563        if(output->crtc)
564            /* XXXagp: This assumes that xf86_config->crtc[i] is HEADi */
565            crtc_mask |= 1 << G80CrtcGetHead(output->crtc);
566    }
567
568    for(i = 0; i < xf86_config->num_crtc; i++)
569        if(!((1 << i) & crtc_mask))
570            G80CrtcBlankScreen(xf86_config->crtc[i], TRUE);
571
572    C(0x00000080, 0);
573}
574
575static const xf86CrtcFuncsRec g80_crtc_funcs = {
576    .dpms = G80CrtcDPMSSet,
577    .save = NULL,
578    .restore = NULL,
579    .lock = G80CrtcLock,
580    .unlock = NULL,
581    .mode_fixup = G80CrtcModeFixup,
582    .prepare = G80CrtcPrepare,
583    .mode_set = G80CrtcModeSet,
584    // .gamma_set = G80DispGammaSet,
585    .commit = G80CrtcCommit,
586    .shadow_create = NULL,
587    .shadow_destroy = NULL,
588    .set_cursor_position = G80SetCursorPosition,
589    .show_cursor = G80CrtcShowCursor,
590    .hide_cursor = G80CrtcHideCursor,
591    .load_cursor_argb = G80LoadCursorARGB,
592    .destroy = NULL,
593};
594
595void
596G80DispCreateCrtcs(ScrnInfoPtr pScrn)
597{
598    G80Ptr pNv = G80PTR(pScrn);
599    Head head;
600    xf86CrtcPtr crtc;
601    G80CrtcPrivPtr g80_crtc;
602
603    /* Create a "crtc" object for each head */
604    for(head = HEAD0; head <= HEAD1; head++) {
605        crtc = xf86CrtcCreate(pScrn, &g80_crtc_funcs);
606        if(!crtc) return;
607
608        g80_crtc = xnfcalloc(sizeof(*g80_crtc), 1);
609        g80_crtc->head = head;
610        g80_crtc->dither = pNv->Dither;
611        crtc->driver_private = g80_crtc;
612    }
613}
614