g80_display.c revision fc5a983d
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                const CARD32 r = pNv->reg[0x00610030/4];
195                int i;
196
197                for(i = 0; i < xf86_config->num_crtc; i++)
198                {
199                    xf86CrtcPtr crtc = xf86_config->crtc[i];
200                    G80CrtcPrivPtr pPriv = crtc->driver_private;
201
202                    if(r & (0x200 << pPriv->head))
203                        G80CrtcSetPClk(crtc);
204                }
205            }
206
207            pNv->reg[0x00610024/4] = 8 << super;
208            pNv->reg[0x00610030/4] = 0x80000000;
209        }
210    }
211}
212
213Head
214G80CrtcGetHead(xf86CrtcPtr crtc)
215{
216    G80CrtcPrivPtr pPriv = crtc->driver_private;
217    return pPriv->head;
218}
219
220Bool
221G80DispPreInit(ScrnInfoPtr pScrn)
222{
223    G80Ptr pNv = G80PTR(pScrn);
224
225    pNv->reg[0x00610184/4] = pNv->reg[0x00614004/4];
226    pNv->reg[0x00610190/4] = pNv->reg[0x00616100/4];
227    pNv->reg[0x006101a0/4] = pNv->reg[0x00616900/4];
228    pNv->reg[0x00610194/4] = pNv->reg[0x00616104/4];
229    pNv->reg[0x006101a4/4] = pNv->reg[0x00616904/4];
230    pNv->reg[0x00610198/4] = pNv->reg[0x00616108/4];
231    pNv->reg[0x006101a8/4] = pNv->reg[0x00616908/4];
232    pNv->reg[0x0061019C/4] = pNv->reg[0x0061610C/4];
233    pNv->reg[0x006101ac/4] = pNv->reg[0x0061690c/4];
234    pNv->reg[0x006101D0/4] = pNv->reg[0x0061A000/4];
235    pNv->reg[0x006101D4/4] = pNv->reg[0x0061A800/4];
236    pNv->reg[0x006101D8/4] = pNv->reg[0x0061B000/4];
237    pNv->reg[0x006101E0/4] = pNv->reg[0x0061C000/4];
238    pNv->reg[0x006101E4/4] = pNv->reg[0x0061C800/4];
239    pNv->reg[0x0061A004/4] = 0x80550000;
240    pNv->reg[0x0061A010/4] = 0x00000001;
241    pNv->reg[0x0061A804/4] = 0x80550000;
242    pNv->reg[0x0061A810/4] = 0x00000001;
243    pNv->reg[0x0061B004/4] = 0x80550000;
244    pNv->reg[0x0061B010/4] = 0x00000001;
245
246    return TRUE;
247}
248
249Bool
250G80DispInit(ScrnInfoPtr pScrn)
251{
252    G80Ptr pNv = G80PTR(pScrn);
253    CARD32 val;
254
255    if(pNv->reg[0x00610024/4] & 0x100) {
256        pNv->reg[0x00610024/4] = 0x100;
257        pNv->reg[0x006194E8/4] &= ~1;
258        while(pNv->reg[0x006194E8/4] & 2);
259    }
260
261    pNv->reg[0x00610200/4] = 0x2b00;
262    do {
263        val = pNv->reg[0x00610200/4];
264
265        if ((val & 0x9f0000) == 0x20000)
266            pNv->reg[0x00610200/4] = val | 0x800000;
267
268        if ((val & 0x3f0000) == 0x30000)
269            pNv->reg[0x00610200/4] = val | 0x200000;
270    } while ((val & 0x1e0000) != 0);
271    pNv->reg[0x00610300/4] = 1;
272    pNv->reg[0x00610200/4] = 0x1000b03;
273    while(!(pNv->reg[0x00610200/4] & 0x40000000));
274
275    C(0x00000084, 0);
276    C(0x00000088, 0);
277    C(0x00000874, 0);
278    C(0x00000800, 0);
279    C(0x00000810, 0);
280    C(0x0000082C, 0);
281
282    return TRUE;
283}
284
285void
286G80DispShutdown(ScrnInfoPtr pScrn)
287{
288    G80Ptr pNv = G80PTR(pScrn);
289    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
290    int i;
291
292    for(i = 0; i < xf86_config->num_crtc; i++) {
293        xf86CrtcPtr crtc = xf86_config->crtc[i];
294
295        G80CrtcBlankScreen(crtc, TRUE);
296    }
297
298    C(0x00000080, 0);
299
300    for(i = 0; i < xf86_config->num_crtc; i++) {
301        xf86CrtcPtr crtc = xf86_config->crtc[i];
302
303        if(crtc->enabled) {
304            const CARD32 mask = 4 << G80CrtcGetHead(crtc);
305
306            pNv->reg[0x00610024/4] = mask;
307            while(!(pNv->reg[0x00610024/4] & mask));
308        }
309    }
310
311    pNv->reg[0x00610200/4] = 0;
312    pNv->reg[0x00610300/4] = 0;
313    while((pNv->reg[0x00610200/4] & 0x1e0000) != 0);
314    while((pNv->reg[0x61C030/4] & 0x10000000));
315    while((pNv->reg[0x61C830/4] & 0x10000000));
316}
317
318void
319G80CrtcDoModeFixup(DisplayModePtr dst, const DisplayModePtr src)
320{
321    /* Magic mode timing fudge factor */
322    const int fudge = ((src->Flags & V_INTERLACE) && (src->Flags & V_DBLSCAN)) ? 2 : 1;
323    const int interlaceDiv = (src->Flags & V_INTERLACE) ? 2 : 1;
324
325    /* Stash the src timings in the Crtc fields in dst */
326    dst->CrtcHBlankStart = src->CrtcVTotal << 16 | src->CrtcHTotal;
327    dst->CrtcHSyncEnd = ((src->CrtcVSyncEnd - src->CrtcVSyncStart) / interlaceDiv - 1) << 16 |
328        (src->CrtcHSyncEnd - src->CrtcHSyncStart - 1);
329    dst->CrtcHBlankEnd = ((src->CrtcVBlankEnd - src->CrtcVSyncStart) / interlaceDiv - fudge) << 16 |
330        (src->CrtcHBlankEnd - src->CrtcHSyncStart - 1);
331    dst->CrtcHTotal = ((src->CrtcVTotal - src->CrtcVSyncStart + src->CrtcVBlankStart) / interlaceDiv - fudge) << 16 |
332        (src->CrtcHTotal - src->CrtcHSyncStart + src->CrtcHBlankStart - 1);
333    dst->CrtcHSkew = ((src->CrtcVTotal + src->CrtcVBlankEnd - src->CrtcVSyncStart) / 2 - 2) << 16 |
334        ((2*src->CrtcVTotal - src->CrtcVSyncStart + src->CrtcVBlankStart) / 2 - 2);
335}
336
337static Bool
338G80CrtcModeFixup(xf86CrtcPtr crtc,
339                 DisplayModePtr mode, DisplayModePtr adjusted_mode)
340{
341    G80CrtcPrivPtr pPriv = crtc->driver_private;
342
343    if(pPriv->skipModeFixup)
344        return TRUE;
345
346    G80CrtcDoModeFixup(adjusted_mode, mode);
347    return TRUE;
348}
349
350static void
351G80CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode,
352               DisplayModePtr adjusted_mode, int x, int y)
353{
354    ScrnInfoPtr pScrn = crtc->scrn;
355    G80CrtcPrivPtr pPriv = crtc->driver_private;
356    const int HDisplay = adjusted_mode->HDisplay, VDisplay = adjusted_mode->VDisplay;
357    const int headOff = 0x400 * G80CrtcGetHead(crtc);
358
359    pPriv->pclk = adjusted_mode->Clock;
360
361    C(0x00000804 + headOff, adjusted_mode->Clock | 0x800000);
362    C(0x00000808 + headOff, (adjusted_mode->Flags & V_INTERLACE) ? 2 : 0);
363    C(0x00000810 + headOff, 0);
364    C(0x0000082C + headOff, 0);
365    C(0x00000814 + headOff, adjusted_mode->CrtcHBlankStart);
366    C(0x00000818 + headOff, adjusted_mode->CrtcHSyncEnd);
367    C(0x0000081C + headOff, adjusted_mode->CrtcHBlankEnd);
368    C(0x00000820 + headOff, adjusted_mode->CrtcHTotal);
369    if(adjusted_mode->Flags & V_INTERLACE)
370        C(0x00000824 + headOff, adjusted_mode->CrtcHSkew);
371    C(0x00000868 + headOff, pScrn->virtualY << 16 | pScrn->virtualX);
372    C(0x0000086C + headOff, pScrn->displayWidth * (pScrn->bitsPerPixel / 8) | 0x100000);
373    switch(pScrn->depth) {
374        case  8: C(0x00000870 + headOff, 0x1E00); break;
375        case 15: C(0x00000870 + headOff, 0xE900); break;
376        case 16: C(0x00000870 + headOff, 0xE800); break;
377        case 24: C(0x00000870 + headOff, 0xCF00); break;
378    }
379    G80CrtcSetDither(crtc, pPriv->dither, FALSE);
380    C(0x000008A8 + headOff, 0x40000);
381    C(0x000008C0 + headOff, y << 16 | x);
382    C(0x000008C8 + headOff, VDisplay << 16 | HDisplay);
383    C(0x000008D4 + headOff, 0);
384
385    G80CrtcBlankScreen(crtc, FALSE);
386}
387
388void
389G80CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)
390{
391    ScrnInfoPtr pScrn = crtc->scrn;
392    G80Ptr pNv = G80PTR(pScrn);
393    G80CrtcPrivPtr pPriv = crtc->driver_private;
394    const int headOff = 0x400 * pPriv->head;
395
396    if(blank) {
397        G80CrtcShowHideCursor(crtc, FALSE, FALSE);
398
399        C(0x00000840 + headOff, 0);
400        C(0x00000844 + headOff, 0);
401        if(pNv->architecture != 0x50)
402            C(0x0000085C + headOff, 0);
403        C(0x00000874 + headOff, 0);
404        if(pNv->architecture != 0x50)
405            C(0x0000089C + headOff, 0);
406    } else {
407        C(0x00000860 + headOff, 0);
408        C(0x00000864 + headOff, 0);
409        pNv->reg[0x00610380/4] = 0;
410        pNv->reg[0x00610384/4] = pNv->videoRam * 1024 - 1;
411        pNv->reg[0x00610388/4] = 0x150000;
412        pNv->reg[0x0061038C/4] = 0;
413        C(0x00000884 + headOff, (pNv->videoRam << 2) - 0x40);
414        if(pNv->architecture != 0x50)
415            C(0x0000089C + headOff, 1);
416        if(pPriv->cursorVisible)
417            G80CrtcShowHideCursor(crtc, TRUE, FALSE);
418        C(0x00000840 + headOff, pScrn->depth == 8 ? 0x80000000 : 0xc0000000);
419        C(0x00000844 + headOff, (pNv->videoRam * 1024 - 0x5000) >> 8);
420        if(pNv->architecture != 0x50)
421            C(0x0000085C + headOff, 1);
422        C(0x00000874 + headOff, 1);
423    }
424}
425
426static void
427G80CrtcDPMSSet(xf86CrtcPtr crtc, int mode)
428{
429}
430
431/******************************** Cursor stuff ********************************/
432static void G80CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update)
433{
434    ScrnInfoPtr pScrn = crtc->scrn;
435    G80CrtcPrivPtr pPriv = crtc->driver_private;
436    const int headOff = 0x400 * G80CrtcGetHead(crtc);
437
438    C(0x00000880 + headOff, show ? 0x85000000 : 0x5000000);
439    if(update) {
440        pPriv->cursorVisible = show;
441        C(0x00000080, 0);
442    }
443}
444
445static void G80CrtcShowCursor(xf86CrtcPtr crtc)
446{
447    G80CrtcShowHideCursor(crtc, TRUE, TRUE);
448}
449
450static void G80CrtcHideCursor(xf86CrtcPtr crtc)
451{
452    G80CrtcShowHideCursor(crtc, FALSE, TRUE);
453}
454
455/******************************** CRTC stuff ********************************/
456
457static Bool
458G80CrtcLock(xf86CrtcPtr crtc)
459{
460    return FALSE;
461}
462
463static void
464G80CrtcPrepare(xf86CrtcPtr crtc)
465{
466    ScrnInfoPtr pScrn = crtc->scrn;
467    G80CrtcPrivPtr pPriv = crtc->driver_private;
468    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
469    int i;
470
471    for(i = 0; i < xf86_config->num_output; i++) {
472        xf86OutputPtr output = xf86_config->output[i];
473
474        if(!output->crtc)
475            output->funcs->mode_set(output, NULL, NULL);
476    }
477
478    pPriv->skipModeFixup = FALSE;
479}
480
481void
482G80CrtcSkipModeFixup(xf86CrtcPtr crtc)
483{
484    G80CrtcPrivPtr pPriv = crtc->driver_private;
485    pPriv->skipModeFixup = TRUE;
486}
487
488void
489G80CrtcSetDither(xf86CrtcPtr crtc, Bool dither, Bool update)
490{
491    ScrnInfoPtr pScrn = crtc->scrn;
492    G80CrtcPrivPtr pPriv = crtc->driver_private;
493    const int headOff = 0x400 * G80CrtcGetHead(crtc);
494
495    pPriv->dither = dither;
496
497    C(0x000008A0 + headOff, dither ? 0x11 : 0);
498    if(update) C(0x00000080, 0);
499}
500
501static void ComputeAspectScale(DisplayModePtr mode, int *outX, int *outY)
502{
503    float scaleX, scaleY, scale;
504
505    scaleX = mode->CrtcHDisplay / (float)mode->HDisplay;
506    scaleY = mode->CrtcVDisplay / (float)mode->VDisplay;
507
508    if(scaleX > scaleY)
509        scale = scaleY;
510    else
511        scale = scaleX;
512
513    *outX = mode->HDisplay * scale;
514    *outY = mode->VDisplay * scale;
515}
516
517void G80CrtcSetScale(xf86CrtcPtr crtc, DisplayModePtr mode,
518                     enum G80ScaleMode scale)
519{
520    ScrnInfoPtr pScrn = crtc->scrn;
521    G80CrtcPrivPtr pPriv = crtc->driver_private;
522    const int headOff = 0x400 * pPriv->head;
523    int outX, outY;
524
525    switch(scale) {
526        default:
527        case G80_SCALE_ASPECT:
528            ComputeAspectScale(mode, &outX, &outY);
529            break;
530
531        case G80_SCALE_OFF:
532        case G80_SCALE_FILL:
533            outX = mode->CrtcHDisplay;
534            outY = mode->CrtcVDisplay;
535            break;
536
537        case G80_SCALE_CENTER:
538            outX = mode->HDisplay;
539            outY = mode->VDisplay;
540            break;
541    }
542
543    if((mode->Flags & V_DBLSCAN) || (mode->Flags & V_INTERLACE) ||
544       mode->HDisplay != outX || mode->VDisplay != outY) {
545        C(0x000008A4 + headOff, 9);
546    } else {
547        C(0x000008A4 + headOff, 0);
548    }
549    C(0x000008D8 + headOff, outY << 16 | outX);
550    C(0x000008DC + headOff, outY << 16 | outX);
551}
552
553static void
554G80CrtcCommit(xf86CrtcPtr crtc)
555{
556    ScrnInfoPtr pScrn = crtc->scrn;
557    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
558    int i, crtc_mask = 0;
559
560    /* If any heads are unused, blank them */
561    for(i = 0; i < xf86_config->num_output; i++) {
562        xf86OutputPtr output = xf86_config->output[i];
563
564        if(output->crtc)
565            /* XXXagp: This assumes that xf86_config->crtc[i] is HEADi */
566            crtc_mask |= 1 << G80CrtcGetHead(output->crtc);
567    }
568
569    for(i = 0; i < xf86_config->num_crtc; i++)
570        if(!((1 << i) & crtc_mask))
571            G80CrtcBlankScreen(xf86_config->crtc[i], TRUE);
572
573    C(0x00000080, 0);
574}
575
576static const xf86CrtcFuncsRec g80_crtc_funcs = {
577    .dpms = G80CrtcDPMSSet,
578    .save = NULL,
579    .restore = NULL,
580    .lock = G80CrtcLock,
581    .unlock = NULL,
582    .mode_fixup = G80CrtcModeFixup,
583    .prepare = G80CrtcPrepare,
584    .mode_set = G80CrtcModeSet,
585    // .gamma_set = G80DispGammaSet,
586    .commit = G80CrtcCommit,
587    .shadow_create = NULL,
588    .shadow_destroy = NULL,
589    .set_cursor_position = G80SetCursorPosition,
590    .show_cursor = G80CrtcShowCursor,
591    .hide_cursor = G80CrtcHideCursor,
592    .load_cursor_argb = G80LoadCursorARGB,
593    .destroy = NULL,
594};
595
596void
597G80DispCreateCrtcs(ScrnInfoPtr pScrn)
598{
599    G80Ptr pNv = G80PTR(pScrn);
600    Head head;
601    xf86CrtcPtr crtc;
602    G80CrtcPrivPtr g80_crtc;
603
604    /* Create a "crtc" object for each head */
605    for(head = HEAD0; head <= HEAD1; head++) {
606        crtc = xf86CrtcCreate(pScrn, &g80_crtc_funcs);
607        if(!crtc) return;
608
609        g80_crtc = xnfcalloc(sizeof(*g80_crtc), 1);
610        g80_crtc->head = head;
611        g80_crtc->dither = pNv->Dither;
612        crtc->driver_private = g80_crtc;
613    }
614}
615