1 /***************************************************************************\
3 |* Copyright 2003 NVIDIA, Corporation. All rights reserved. *|
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. *|
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 *|
14 |* Copyright 2003 NVIDIA, Corporation. All rights reserved. *|
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. *|
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. *|
38 \***************************************************************************/
40 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.48 2005/09/14 02:28:03 mvojkovi Exp $ */
42 #include "nv_include.h"
46 * Override VGA I/O routines.
48 static void NVWriteCrtc(vgaHWPtr pVga, CARD8 index, CARD8 value)
50 NVPtr pNv = (NVPtr)pVga->MMIOBase;
51 VGA_WR08(pNv->PCIO, pVga->IOBase + VGA_CRTC_INDEX_OFFSET, index);
52 VGA_WR08(pNv->PCIO, pVga->IOBase + VGA_CRTC_DATA_OFFSET, value);
54 static CARD8 NVReadCrtc(vgaHWPtr pVga, CARD8 index)
56 NVPtr pNv = (NVPtr)pVga->MMIOBase;
57 VGA_WR08(pNv->PCIO, pVga->IOBase + VGA_CRTC_INDEX_OFFSET, index);
58 return (VGA_RD08(pNv->PCIO, pVga->IOBase + VGA_CRTC_DATA_OFFSET));
60 static void NVWriteGr(vgaHWPtr pVga, CARD8 index, CARD8 value)
62 NVPtr pNv = (NVPtr)pVga->MMIOBase;
63 VGA_WR08(pNv->PVIO, VGA_GRAPH_INDEX, index);
64 VGA_WR08(pNv->PVIO, VGA_GRAPH_DATA, value);
66 static CARD8 NVReadGr(vgaHWPtr pVga, CARD8 index)
68 NVPtr pNv = (NVPtr)pVga->MMIOBase;
69 VGA_WR08(pNv->PVIO, VGA_GRAPH_INDEX, index);
70 return (VGA_RD08(pNv->PVIO, VGA_GRAPH_DATA));
72 static void NVWriteSeq(vgaHWPtr pVga, CARD8 index, CARD8 value)
74 NVPtr pNv = (NVPtr)pVga->MMIOBase;
75 VGA_WR08(pNv->PVIO, VGA_SEQ_INDEX, index);
76 VGA_WR08(pNv->PVIO, VGA_SEQ_DATA, value);
78 static CARD8 NVReadSeq(vgaHWPtr pVga, CARD8 index)
80 NVPtr pNv = (NVPtr)pVga->MMIOBase;
81 VGA_WR08(pNv->PVIO, VGA_SEQ_INDEX, index);
82 return (VGA_RD08(pNv->PVIO, VGA_SEQ_DATA));
84 static void NVWriteAttr(vgaHWPtr pVga, CARD8 index, CARD8 value)
86 NVPtr pNv = (NVPtr)pVga->MMIOBase;
89 tmp = VGA_RD08(pNv->PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET);
90 if (pVga->paletteEnabled)
94 VGA_WR08(pNv->PCIO, VGA_ATTR_INDEX, index);
95 VGA_WR08(pNv->PCIO, VGA_ATTR_DATA_W, value);
97 static CARD8 NVReadAttr(vgaHWPtr pVga, CARD8 index)
99 NVPtr pNv = (NVPtr)pVga->MMIOBase;
102 tmp = VGA_RD08(pNv->PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET);
103 if (pVga->paletteEnabled)
107 VGA_WR08(pNv->PCIO, VGA_ATTR_INDEX, index);
108 return (VGA_RD08(pNv->PCIO, VGA_ATTR_DATA_R));
110 static void NVWriteMiscOut(vgaHWPtr pVga, CARD8 value)
112 NVPtr pNv = (NVPtr)pVga->MMIOBase;
113 VGA_WR08(pNv->PVIO, VGA_MISC_OUT_W, value);
115 static CARD8 NVReadMiscOut(vgaHWPtr pVga)
117 NVPtr pNv = (NVPtr)pVga->MMIOBase;
118 return (VGA_RD08(pNv->PVIO, VGA_MISC_OUT_R));
120 static void NVEnablePalette(vgaHWPtr pVga)
122 NVPtr pNv = (NVPtr)pVga->MMIOBase;
125 tmp = VGA_RD08(pNv->PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET);
126 VGA_WR08(pNv->PCIO, VGA_ATTR_INDEX, 0x00);
127 pVga->paletteEnabled = TRUE;
129 static void NVDisablePalette(vgaHWPtr pVga)
131 NVPtr pNv = (NVPtr)pVga->MMIOBase;
134 tmp = VGA_RD08(pNv->PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET);
135 VGA_WR08(pNv->PCIO, VGA_ATTR_INDEX, 0x20);
136 pVga->paletteEnabled = FALSE;
138 static void NVWriteDacMask(vgaHWPtr pVga, CARD8 value)
140 NVPtr pNv = (NVPtr)pVga->MMIOBase;
141 VGA_WR08(pNv->PDIO, VGA_DAC_MASK, value);
143 static CARD8 NVReadDacMask(vgaHWPtr pVga)
145 NVPtr pNv = (NVPtr)pVga->MMIOBase;
146 return (VGA_RD08(pNv->PDIO, VGA_DAC_MASK));
148 static void NVWriteDacReadAddr(vgaHWPtr pVga, CARD8 value)
150 NVPtr pNv = (NVPtr)pVga->MMIOBase;
151 VGA_WR08(pNv->PDIO, VGA_DAC_READ_ADDR, value);
153 static void NVWriteDacWriteAddr(vgaHWPtr pVga, CARD8 value)
155 NVPtr pNv = (NVPtr)pVga->MMIOBase;
156 VGA_WR08(pNv->PDIO, VGA_DAC_WRITE_ADDR, value);
158 static void NVWriteDacData(vgaHWPtr pVga, CARD8 value)
160 NVPtr pNv = (NVPtr)pVga->MMIOBase;
161 VGA_WR08(pNv->PDIO, VGA_DAC_DATA, value);
163 static CARD8 NVReadDacData(vgaHWPtr pVga)
165 NVPtr pNv = (NVPtr)pVga->MMIOBase;
166 return (VGA_RD08(pNv->PDIO, VGA_DAC_DATA));
170 NVIsConnected (ScrnInfoPtr pScrn, int output)
172 NVPtr pNv = NVPTR(pScrn);
173 CARD32 reg52C, reg608, temp;
176 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
177 "Probing for analog device on output %s...\n",
180 reg52C = nvReadRAMDAC(pNv, output, 0x052C);
181 reg608 = nvReadRAMDAC(pNv, output, 0x0608);
183 nvWriteRAMDAC(pNv, output, 0x608, (reg608 & ~0x00010000));
185 nvWriteRAMDAC(pNv, output, 0x52C, (reg52C & 0x0000FEEE));
188 temp = nvReadRAMDAC(pNv, output, 0x52C);
189 nvWriteRAMDAC(pNv, output, 0x52C, temp | 1);
191 nvWriteRAMDAC(pNv, output, 0x610, 0x94050140);
192 temp = nvReadRAMDAC(pNv, output, 0x608);
193 nvWriteRAMDAC(pNv, output, 0x608, temp | 0x1000);
197 present = (nvReadRAMDAC(pNv, output, 0x608) & (1 << 28)) ? TRUE : FALSE;
200 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, " ...found one\n");
202 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, " ...can't find one\n");
204 temp = nvReadRAMDAC(pNv, output, 0x608);
205 nvWriteRAMDAC(pNv, output, 0x608, temp & 0x000EFFF);
207 nvWriteRAMDAC(pNv, output, 0x52C, reg52C);
208 nvWriteRAMDAC(pNv, output, 0x608, reg608);
214 NVSelectHeadRegisters(ScrnInfoPtr pScrn, int head)
216 NVPtr pNv = NVPTR(pScrn);
218 pNv->cur_head = head;
221 pNv->PCIO = pNv->PCIO1;
222 pNv->PCRTC = pNv->PCRTC1;
223 pNv->PRAMDAC = pNv->PRAMDAC1;
224 pNv->PDIO = pNv->PDIO1;
226 pNv->PCIO = pNv->PCIO0;
227 pNv->PCRTC = pNv->PCRTC0;
228 pNv->PRAMDAC = pNv->PRAMDAC0;
229 pNv->PDIO = pNv->PDIO0;
234 NVProbeDDC (ScrnInfoPtr pScrn, int bus)
236 NVPtr pNv = NVPTR(pScrn);
237 xf86MonPtr MonInfo = NULL;
239 if(!pNv->I2C) return NULL;
241 pNv->DDCBase = bus ? 0x36 : 0x3e;
243 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
244 "Probing for EDID on I2C bus %s...\n", bus ? "B" : "A");
246 if ((MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, pNv->I2C))) {
247 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
248 "DDC detected a %s:\n", MonInfo->features.input_type ?
250 xf86PrintEDID( MonInfo );
252 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
253 " ... none found\n");
259 static void nv4GetConfig (NVPtr pNv)
261 CARD32 reg_FB0 = nvReadFB(pNv, 0x0);
262 if (reg_FB0 & 0x00000100) {
263 pNv->RamAmountKBytes = ((reg_FB0 >> 12) & 0x0F) * 1024 * 2
266 switch (reg_FB0 & 0x00000003) {
268 pNv->RamAmountKBytes = 1024 * 32;
271 pNv->RamAmountKBytes = 1024 * 4;
274 pNv->RamAmountKBytes = 1024 * 8;
278 pNv->RamAmountKBytes = 1024 * 16;
282 pNv->CrystalFreqKHz = (nvReadEXTDEV(pNv, 0x0000) & 0x00000040) ? 14318 : 13500;
283 pNv->CURSOR = &(pNv->PRAMIN[0x1E00]);
284 pNv->MinVClockFreqKHz = 12000;
285 pNv->MaxVClockFreqKHz = 350000;
288 static void nv10GetConfig (NVPtr pNv)
290 CARD32 implementation = pNv->Chipset & 0x0ff0;
292 #if X_BYTE_ORDER == X_BIG_ENDIAN
293 /* turn on big endian register access */
294 if(!(nvReadMC(pNv, 0x0004) & 0x01000001)) {
295 nvWriteMC(pNv, 0x0004, 0x01000001);
300 if(implementation == CHIPSET_NFORCE) {
301 int amt = pciReadLong(pciTag(0, 0, 1), 0x7C);
302 pNv->RamAmountKBytes = (((amt >> 6) & 31) + 1) * 1024;
303 } else if(implementation == CHIPSET_NFORCE2) {
304 int amt = pciReadLong(pciTag(0, 0, 1), 0x84);
305 pNv->RamAmountKBytes = (((amt >> 4) & 127) + 1) * 1024;
307 pNv->RamAmountKBytes = (nvReadFB(pNv, 0x020C) & 0xFFF00000) >> 10;
310 if(pNv->RamAmountKBytes > 256*1024)
311 pNv->RamAmountKBytes = 256*1024;
313 pNv->CrystalFreqKHz = (nvReadEXTDEV(pNv, 0x0000) & (1 << 6)) ? 14318 : 13500;
315 if(pNv->twoHeads && (implementation != CHIPSET_NV11))
317 if(nvReadEXTDEV(pNv, 0x0000) & (1 << 22))
318 pNv->CrystalFreqKHz = 27000;
321 pNv->CURSOR = NULL; /* can't set this here */
322 pNv->MinVClockFreqKHz = 12000;
323 pNv->MaxVClockFreqKHz = pNv->twoStagePLL ? 400000 : 350000;
327 NVCommonSetup(ScrnInfoPtr pScrn)
329 NVPtr pNv = NVPTR(pScrn);
330 vgaHWPtr pVga = VGAHWPTR(pScrn);
331 CARD16 implementation = pNv->Chipset & 0x0ff0;
332 xf86MonPtr monitorA, monitorB;
336 int FlatPanel = -1; /* really means the CRTC is slaved */
337 Bool Television = FALSE;
340 * Override VGA I/O routines.
342 pVga->writeCrtc = NVWriteCrtc;
343 pVga->readCrtc = NVReadCrtc;
344 pVga->writeGr = NVWriteGr;
345 pVga->readGr = NVReadGr;
346 pVga->writeAttr = NVWriteAttr;
347 pVga->readAttr = NVReadAttr;
348 pVga->writeSeq = NVWriteSeq;
349 pVga->readSeq = NVReadSeq;
350 pVga->writeMiscOut = NVWriteMiscOut;
351 pVga->readMiscOut = NVReadMiscOut;
352 pVga->enablePalette = NVEnablePalette;
353 pVga->disablePalette = NVDisablePalette;
354 pVga->writeDacMask = NVWriteDacMask;
355 pVga->readDacMask = NVReadDacMask;
356 pVga->writeDacWriteAddr = NVWriteDacWriteAddr;
357 pVga->writeDacReadAddr = NVWriteDacReadAddr;
358 pVga->writeDacData = NVWriteDacData;
359 pVga->readDacData = NVReadDacData;
361 * Note: There are different pointers to the CRTC/AR and GR/SEQ registers.
362 * Bastardize the intended uses of these to make it work.
364 pVga->MMIOBase = (CARD8 *)pNv;
365 pVga->MMIOOffset = 0;
367 pNv->REGS = xf86MapPciMem(pScrn->scrnIndex,
368 VIDMEM_MMIO | VIDMEM_READSIDEEFFECT,
369 pNv->PciTag, pNv->IOAddress, 0x01000000);
371 pNv->PRAMIN = pNv->REGS + (NV_PRAMIN_OFFSET/4);
372 pNv->PCRTC0 = pNv->REGS + (NV_PCRTC0_OFFSET/4);
373 pNv->PRAMDAC0 = pNv->REGS + (NV_PRAMDAC0_OFFSET/4);
374 pNv->PFB = pNv->REGS + (NV_PFB_OFFSET/4);
375 pNv->PFIFO = pNv->REGS + (NV_PFIFO_OFFSET/4);
376 pNv->PGRAPH = pNv->REGS + (NV_PGRAPH_OFFSET/4);
377 pNv->PEXTDEV = pNv->REGS + (NV_PEXTDEV_OFFSET/4);
378 pNv->PTIMER = pNv->REGS + (NV_PTIMER_OFFSET/4);
379 pNv->PMC = pNv->REGS + (NV_PMC_OFFSET/4);
381 /* 8 bit registers */
382 pNv->PCIO0 = (CARD8*)pNv->REGS + NV_PCIO0_OFFSET;
383 pNv->PDIO0 = (CARD8*)pNv->REGS + NV_PDIO0_OFFSET;
384 pNv->PVIO = (CARD8*)pNv->REGS + NV_PVIO_OFFSET;
385 pNv->PROM = (CARD8*)pNv->REGS + NV_PROM_OFFSET;
387 pNv->PCRTC1 = pNv->PCRTC0 + 0x800;
388 pNv->PRAMDAC1 = pNv->PRAMDAC0 + 0x800;
389 pNv->PCIO1 = pNv->PCIO0 + 0x2000;
390 pNv->PDIO1 = pNv->PDIO0 + 0x2000;
392 pNv->twoHeads = (pNv->Architecture >= NV_ARCH_10) &&
393 (implementation != CHIPSET_NV10) &&
394 (implementation != CHIPSET_NV15) &&
395 (implementation != CHIPSET_NFORCE) &&
396 (implementation != CHIPSET_NV20);
398 pNv->fpScaler = (pNv->FpScale && pNv->twoHeads && (implementation!=CHIPSET_NV11));
400 pNv->twoStagePLL = (implementation == CHIPSET_NV31) ||
401 (implementation == CHIPSET_NV36) ||
402 (pNv->Architecture >= NV_ARCH_40);
404 pNv->WaitVSyncPossible = (pNv->Architecture >= NV_ARCH_10) &&
405 (implementation != CHIPSET_NV10);
407 pNv->BlendingPossible = ((pNv->Chipset & 0xffff) != CHIPSET_NV04);
409 /* look for known laptop chips */
410 /* FIXME we could add some ids here (0x0164,0x0167,0x0168,0x01D6,0x01D7,0x01D8,0x0298,0x0299,0x0398) */
411 switch(pNv->Chipset & 0xffff) {
464 /* Parse the bios to initialize the card */
465 NVSelectHeadRegisters(pScrn, 0);
467 /* reset PFIFO and PGRAPH, then power up all the card units */
468 /* nvWriteMC(pNv, 0x800, 0x17110013);
470 nvWriteMC(pNv, 0x800, 0x17111113);
472 if(pNv->Architecture == NV_ARCH_04)
477 NVSelectHeadRegisters(pScrn, 0);
479 NVLockUnlock(pNv, 0);
483 pNv->Television = FALSE;
487 if((monitorA = NVProbeDDC(pScrn, 0))) {
488 FlatPanel = monitorA->features.input_type ? 1 : 0;
490 /* NV4 doesn't support FlatPanels */
491 if((pNv->Chipset & 0x0fff) <= CHIPSET_NV04)
494 if(nvReadVGA(pNv, 0x28) & 0x80) {
495 if(!(nvReadVGA(pNv, 0x33) & 0x01))
501 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
502 "HW is currently programmed for %s\n",
503 FlatPanel ? (Television ? "TV" : "DFP") : "CRT");
506 if(pNv->FlatPanel == -1) {
507 pNv->FlatPanel = FlatPanel;
508 pNv->Television = Television;
510 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
511 "Forcing display type to %s as specified\n",
512 pNv->FlatPanel ? "DFP" : "CRT");
515 CARD8 outputAfromCRTC, outputBfromCRTC;
517 CARD8 slaved_on_A, slaved_on_B;
518 Bool analog_on_A, analog_on_B;
522 if(implementation != CHIPSET_NV11) {
523 if(nvReadRAMDAC0(pNv, 0x52c) & 0x100)
527 if(nvReadRAMDAC(pNv, 1, 0x52C) & 0x100)
531 analog_on_A = NVIsConnected(pScrn, 0);
532 analog_on_B = NVIsConnected(pScrn, 1);
540 cr44 = nvReadVGA(pNv, 0x44);
543 nvWriteVGA(pNv, 0x44, 3);
544 NVSelectHeadRegisters(pScrn, 1);
545 NVLockUnlock(pNv, 0);
547 slaved_on_B = nvReadVGA(pNv, 0x28) & 0x80;
549 tvB = !(nvReadVGA(pNv, 0x33) & 0x01);
552 nvWriteVGA(pNv, 0x44, 0);
553 NVSelectHeadRegisters(pScrn, 0);
554 NVLockUnlock(pNv, 0);
556 slaved_on_A = nvReadVGA(pNv, 0x28) & 0x80;
558 tvA = !(nvReadVGA(pNv, 0x33) & 0x01);
561 oldhead = nvReadCRTC0(pNv, 0x0860);
562 nvWriteCRTC0(pNv, 0x0860, oldhead | 0x00000010);
564 monitorA = NVProbeDDC(pScrn, 0);
565 monitorB = NVProbeDDC(pScrn, 1);
567 if(slaved_on_A && !tvA) {
570 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
571 "CRTC 0 is currently programmed for DFP\n");
573 if(slaved_on_B && !tvB) {
576 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
577 "CRTC 1 is currently programmed for DFP\n");
580 CRTCnumber = outputAfromCRTC;
582 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
583 "CRTC %i appears to have a CRT attached\n", CRTCnumber);
586 CRTCnumber = outputBfromCRTC;
588 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
589 "CRTC %i appears to have a CRT attached\n", CRTCnumber);
595 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
596 "CRTC 0 is currently programmed for TV\n");
602 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
603 "CRTC 1 is currently programmed for TV\n");
606 FlatPanel = monitorA->features.input_type ? 1 : 0;
609 FlatPanel = monitorB->features.input_type ? 1 : 0;
612 if(pNv->FlatPanel == -1) {
613 if(FlatPanel != -1) {
614 pNv->FlatPanel = FlatPanel;
615 pNv->Television = Television;
617 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
618 "Unable to detect display type...\n");
620 xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
621 "...On a laptop, assuming DFP\n");
624 xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
625 "...Using default of CRT\n");
630 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
631 "Forcing display type to %s as specified\n",
632 pNv->FlatPanel ? "DFP" : "CRT");
635 if(pNv->CRTCnumber == -1) {
636 if(CRTCnumber != -1) pNv->CRTCnumber = CRTCnumber;
638 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
639 "Unable to detect which CRTCNumber...\n");
640 if(pNv->FlatPanel) pNv->CRTCnumber = 1;
641 else pNv->CRTCnumber = 0;
642 xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
643 "...Defaulting to CRTCNumber %i\n", pNv->CRTCnumber);
646 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
647 "Forcing CRTCNumber %i as specified\n", pNv->CRTCnumber);
651 if((monitorA->features.input_type && pNv->FlatPanel) ||
652 (!monitorA->features.input_type && !pNv->FlatPanel))
665 if((monitorB->features.input_type && !pNv->FlatPanel) ||
666 (!monitorB->features.input_type && pNv->FlatPanel))
675 if(implementation == CHIPSET_NV11)
676 cr44 = pNv->CRTCnumber * 0x3;
678 nvWriteCRTC0(pNv, 0x0860, oldhead);
680 nvWriteVGA(pNv, 0x44, cr44);
681 NVSelectHeadRegisters(pScrn, pNv->CRTCnumber);
684 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
685 "Using %s on CRTC %i\n",
686 pNv->FlatPanel ? (pNv->Television ? "TV" : "DFP") : "CRT",
689 if(pNv->FlatPanel && !pNv->Television) {
690 pNv->fpWidth = nvReadCurRAMDAC(pNv, 0x820) + 1;
691 pNv->fpHeight = nvReadCurRAMDAC(pNv, 0x800) + 1;
692 pNv->fpSyncs = nvReadCurRAMDAC(pNv, 0x0848) & 0x30000033;
693 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Panel size is %i x %i\n",
694 pNv->fpWidth, pNv->fpHeight);
698 xf86SetDDCproperties(pScrn, monitorA);
700 if(!pNv->FlatPanel || (pScrn->depth != 24) || !pNv->twoHeads)
701 pNv->FPDither = FALSE;
704 if(pNv->FlatPanel && pNv->twoHeads) {
705 nvWriteRAMDAC0(pNv, 0x8b0, 0x00010004);
706 if(nvReadRAMDAC0(pNv, 0x08B4) & 1)
708 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel is %s\n",
709 pNv->LVDS ? "LVDS" : "TMDS");