This needs a FAQ... the driver does not detects the digital monitor.
There's a patch available but it's very rough. I tried it, it did
initialized the monitor but there was an awful lot of artifacts. Wait
for 4.3.1 , I'd say...
If you feel adventurous, here's the patch.
On Tue, 2003-03-11 at 04:07, Jose M. Alcaide wrote:
> Hello,
>
> I have a machine running FreeBSD 4.7-RELEASE and XFree86 4.3.0 equipped
> with an ATI Radeon 9700 (R300), which is attached to a Dell 1702FP flat
> panel monitor via DVI. Console text mode works fine (and graphic mode
> under Windows), but I cannot get XFree86 working using the DVI output.
> Just after firing up X, the DVI output is disabled; if I attach the
> monitor to the VGA output, however, I can see the image.
>
> These are the relevant lines from the scanpci output:
>
> pci bus 0x0001 cardnum 0x00 function 0x00: vendor 0x1002 device 0x4e45
> ATI Technologies Inc Radeon R300 NE [Radeon 9700]
>
> pci bus 0x0001 cardnum 0x00 function 0x01: vendor 0x1002 device 0x4e65
> ATI Technologies Inc Radeon R300 [Radeon 9700] (Secondary)
>
> I found something strange in /var/log/XFree86.0.log (attached):
>
> (II) Primary Device is: PCI 01:00:0
> (II) ATI: Candidate "Device" section "Card0".
> (WW) ATI: PCI/AGP Mach64 in slot 1:0:1 could not be detected!
> (WW) RADEON: No matching Device section for instance (BusID PCI:1:0:1) found
> (--) Chipset ATI Radeon 9700/9500Pro NE (AGP) found
>
> I tried to add another Device section named "Card1", with BusID
> PCI:1:0:1 and same driver, to no avail. Also, I am wondering about
> these messages:
>
> (II) RADEON(0): CloneDisplay option not set -- defaulting to auto-detect
> (II) RADEON(0): Primary Display == Type 3
>
> I also tried to set CloneDisplay to "0" and "2". No change.
>
> Any ideas?
>
> Thanks,
> JMA
> --
> ***** Jose M. Alcaide // [EMAIL PROTECTED] // [EMAIL PROTECTED] *****
> ***** "Go ahead... make my day" -- Harry Callahan *****
> _______________________________________________
> XFree86 mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/xfree86
Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v
retrieving revision 1.34
diff -p -u -r1.34 radeon.h
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 5 Dec 2002 18:00:41 -0000 1.34
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h 6 Jan 2003 20:52:33 -0000
@@ -171,6 +173,7 @@ typedef struct {
CARD32 lvds_gen_cntl;
CARD32 lvds_pll_cntl;
CARD32 tmds_pll_cntl;
+ CARD32 tmds_transmitter_cntl;
/* Computed values for PLL */
CARD32 dot_clock_freq;
@@ -291,8 +294,6 @@ typedef struct {
Bool HasCRTC2; /* All cards except original Radeon */
Bool IsSecondary; /* Second Screen */
Bool IsSwitching; /* Flag for switching mode */
- Bool IsDell; /* Dell OEM VE card */
- int DellType;
Bool Clone; /* Force second head to clone primary*/
RADEONMonitorType CloneType;
RADEONDDCType CloneDDCType;
Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c,v
retrieving revision 1.5
diff -p -u -r1.5 radeon_accelfuncs.c
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c 5 Nov 2002 21:30:33 -0000 1.5
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accelfuncs.c 6 Jan 2003 20:52:34 -0000
@@ -190,13 +192,7 @@ FUNC_NAME(RADEONRestoreAccelState)(ScrnI
pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex);
pRADEONEnt = pPriv->ptr;
-#if 0
- /* Not working yet */
- if (pRADEONEnt->IsDRIEnabled) {
- RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn);
- RADEONCP_TO_MMIO(pRADEONEnt->pPrimaryScrn, info0);
- }
-#endif
+
pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6;
OUTREG(RADEON_DEFAULT_OFFSET, ((pScrn->fbOffset>>10) |
@@ -1305,7 +1344,7 @@ FUNC_NAME(RADEONAccelInit)(ScreenPtr pSc
* disabled
*/
#ifdef ACCEL_MMIO
- if (pRADEONEnt->HasSecondary || pRADEONEnt->BypassSecondary)
+ if (pRADEONEnt->HasSecondary)
#else /* ACCEL_CP */
if (!info->IsSecondary && xf86IsEntityShared(pScrn->entityList[0]))
#endif
Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v
retrieving revision 1.52
diff -p -u -r1.52 radeon_driver.c
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 5 Dec 2002 19:07:53 -0000 1.52
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 6 Jan 2003 20:52:37 -0000
@@ -132,7 +132,9 @@ typedef enum {
#endif
OPTION_PANEL_OFF,
OPTION_DDC_MODE,
- OPTION_CLONE_DISPLAY,
+ OPTION_MONITOR_LAYOUT,
+ OPTION_IGNORE_EDID,
+ OPTION_CRTC2_OVERLAY,
OPTION_CLONE_MODE,
OPTION_CLONE_HSYNC,
OPTION_CLONE_VREFRESH,
@@ -161,7 +166,9 @@ const OptionInfoRec RADEONOptions[] = {
#endif
{ OPTION_PANEL_OFF, "PanelOff", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DDC_MODE, "DDCMode", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CLONE_DISPLAY, "CloneDisplay", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_MONITOR_LAYOUT, "MonitorLayout", OPTV_ANYSTR, {0}, FALSE },
+ { OPTION_IGNORE_EDID, "IgnoreEDID", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CRTC2_OVERLAY , "OverlayOnCRTC2", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_CLONE_MODE, "CloneMode", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_CLONE_HSYNC, "CloneHSync", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_CLONE_VREFRESH, "CloneVRefresh", OPTV_ANYSTR, {0}, FALSE },
@@ -756,14 +766,335 @@ static int RADEONDiv(int n, int d)
return (n + (d / 2)) / d;
}
-/* Read the Video BIOS block and the FP registers (if applicable) */
-static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
+static RADEONMonitorType RADEONDisplayDDCConnected(ScrnInfoPtr pScrn, RADEONDDCType DDCType, xf86MonPtr* MonInfo)
{
- RADEONInfoPtr info = RADEONPTR(pScrn);
- unsigned long tmp, i;
+ RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO;
- Bool BypassSecondary = FALSE;
- int CloneDispOption;
+ unsigned long DDCReg;
+ RADEONMonitorType MonType = MT_NONE;
+ int i, j;
+
+ RADEONMapMMIO(pScrn);
+ RADEONMMIO = info->MMIO;
+
+ DDCReg = info->DDCReg;
+ switch(DDCType)
+ {
+ case DDC_MONID:
+ info->DDCReg = RADEON_GPIO_MONID;
+ break;
+ case DDC_DVI:
+ info->DDCReg = RADEON_GPIO_DVI_DDC;
+ break;
+ case DDC_VGA:
+ info->DDCReg = RADEON_GPIO_VGA_DDC;
+ break;
+ case DDC_CRT2:
+ info->DDCReg = RADEON_GPIO_CRT2_DDC;
+ break;
+ default:
+ info->DDCReg = DDCReg;
+ return MT_NONE;
+ }
+
+ /* Read and output monitor info using DDC2 over I2C bus */
+ if (info->pI2CBus && info->ddc2) {
+ OUTREG(info->DDCReg, INREG(info->DDCReg) &
+ (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1));
+
+ /* For some old monitors (like Compaq Presario FP500), we need
+ * following process to initialize/stop DDC
+ */
+ OUTREG(info->DDCReg, INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1));
+ for (j = 0; j < 1; j++) {
+ OUTREG(info->DDCReg,
+ INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0));
+ usleep(13000);
+
+ OUTREG(info->DDCReg,
+ INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1));
+ for (i = 0; i < 2; i++) {
+ usleep(15000);
+ if (INREG(info->DDCReg) & RADEON_GPIO_Y_1)
+ break;
+ }
+ if (i == 2) continue;
+
+ usleep(15000);
+
+ OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0);
+ usleep(15000);
+
+ OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1);
+ usleep(15000);
+ OUTREG(info->DDCReg,
+ INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0));
+ usleep(15000);
+ *MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, info->pI2CBus);
+
+ OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1);
+ OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0);
+ usleep(15000);
+ OUTREG(info->DDCReg,
+ INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1));
+ for (i = 0; i < 5; i++) {
+ usleep(15000);
+ if (INREG(info->DDCReg) & RADEON_GPIO_Y_1)
+ break;
+ }
+ usleep(15000);
+ OUTREG(info->DDCReg,
+ INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0));
+ usleep(15000);
+
+ OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1);
+ OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0);
+ usleep(15000);
+ if(*MonInfo) break;
+ }
+ } else {
+ MonType = MT_NONE;
+ }
+
+ if (*MonInfo) {
+ if ((*MonInfo)->rawData[0x14] & 0x80) {
+ if ((INREG(RADEON_LVDS_GEN_CNTL) & RADEON_LVDS_ON) && (DDCType == DDC_DVI)) MonType = MT_LCD;
+ else MonType = MT_DFP;
+ } else MonType = MT_CRT;
+ } else MonType = MT_NONE;
+
+ info->DDCReg = DDCReg;
+ return MonType;
+}
+
+static RADEONMonitorType
+RADEONCrtIsPhysicallyConnected(ScrnInfoPtr pScrn, int IsCrtDac)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int bConnected = 0;
+
+ /* the monitor either wasn't connected or it is a non-DDC CRT.
+ * try to probe it
+ */
+ if(IsCrtDac) {
+ unsigned long ulOrigVCLK_ECP_CNTL;
+ unsigned long ulOrigDAC_CNTL;
+ unsigned long ulOrigDAC_EXT_CNTL;
+ unsigned long ulOrigCRTC_EXT_CNTL;
+ unsigned long ulData;
+ unsigned long ulMask;
+
+ ulOrigVCLK_ECP_CNTL = INPLL(pScrn, RADEON_VCLK_ECP_CNTL);
+
+ ulData = ulOrigVCLK_ECP_CNTL;
+ ulData &= ~(RADEON_PIXCLK_ALWAYS_ONb
+ | RADEON_PIXCLK_DAC_ALWAYS_ONb);
+ ulMask = ~(RADEON_PIXCLK_ALWAYS_ONb
+ |RADEON_PIXCLK_DAC_ALWAYS_ONb);
+ OUTPLLP(pScrn, RADEON_VCLK_ECP_CNTL, ulData, ulMask);
+
+ ulOrigCRTC_EXT_CNTL = INREG(RADEON_CRTC_EXT_CNTL);
+ ulData = ulOrigCRTC_EXT_CNTL;
+ ulData |= RADEON_CRTC_CRT_ON;
+ OUTREG(RADEON_CRTC_EXT_CNTL, ulData);
+
+ ulOrigDAC_EXT_CNTL = INREG(RADEON_DAC_EXT_CNTL);
+ ulData = ulOrigDAC_EXT_CNTL;
+ ulData &= ~RADEON_DAC_FORCE_DATA_MASK;
+ ulData |= (RADEON_DAC_FORCE_BLANK_OFF_EN
+ |RADEON_DAC_FORCE_DATA_EN
+ |RADEON_DAC_FORCE_DATA_SEL_MASK);
+ if (info->ChipFamily == CHIP_FAMILY_RV250)
+ ulData |= (0x01b6 << RADEON_DAC_FORCE_DATA_SHIFT);
+ else
+ ulData |= (0x01ac << RADEON_DAC_FORCE_DATA_SHIFT);
+
+ OUTREG(RADEON_DAC_EXT_CNTL, ulData);
+
+ ulOrigDAC_CNTL = INREG(RADEON_DAC_CNTL);
+ ulData = ulOrigDAC_CNTL;
+ ulData |= RADEON_DAC_CMP_EN;
+ ulData &= ~(RADEON_DAC_RANGE_CNTL_MASK
+ | RADEON_DAC_PDWN);
+ ulData |= 0x2;
+ OUTREG(RADEON_DAC_CNTL, ulData);
+
+ usleep(1000);
+
+ ulData = INREG(RADEON_DAC_CNTL);
+ bConnected = (RADEON_DAC_CMP_OUTPUT & ulData)?1:0;
+
+ ulData = ulOrigVCLK_ECP_CNTL;
+ ulMask = 0xFFFFFFFFL;
+ OUTPLLP(pScrn, RADEON_VCLK_ECP_CNTL, ulData, ulMask);
+
+ OUTREG(RADEON_DAC_CNTL, ulOrigDAC_CNTL );
+ OUTREG(RADEON_DAC_EXT_CNTL, ulOrigDAC_EXT_CNTL );
+ OUTREG(RADEON_CRTC_EXT_CNTL, ulOrigCRTC_EXT_CNTL);
+ } else { /* TV DAC */
+
+ /* This doesn't seem to work reliably (maybe worse on some OEM cards),
+ for now we always return false. If one wants to connected a
+ non-DDC monitor on the DVI port when CRT port is also connected,
+ he will need to explicitly tell the driver in the config file
+ with Option MonitorLayout.
+ */
+
+ bConnected = FALSE;
+
+#if 0
+ if (info->ChipFamily == CHIP_FAMILY_R200) {
+
+ unsigned long ulOrigGPIO_MONID;
+ unsigned long ulOrigFP2_GEN_CNTL;
+ unsigned long ulOrigDISP_OUTPUT_CNTL;
+ unsigned long ulOrigCRTC2_GEN_CNTL;
+ unsigned long ulOrigDISP_LIN_TRANS_GRPH_A;
+ unsigned long ulOrigDISP_LIN_TRANS_GRPH_B;
+ unsigned long ulOrigDISP_LIN_TRANS_GRPH_C;
+ unsigned long ulOrigDISP_LIN_TRANS_GRPH_D;
+ unsigned long ulOrigDISP_LIN_TRANS_GRPH_E;
+ unsigned long ulOrigDISP_LIN_TRANS_GRPH_F;
+ unsigned long ulOrigCRTC2_H_TOTAL_DISP;
+ unsigned long ulOrigCRTC2_V_TOTAL_DISP;
+ unsigned long ulOrigCRTC2_H_SYNC_STRT_WID;
+ unsigned long ulOrigCRTC2_V_SYNC_STRT_WID;
+ unsigned long ulData, i;
+
+ ulOrigGPIO_MONID = INREG(RADEON_GPIO_MONID);
+ ulOrigFP2_GEN_CNTL = INREG(RADEON_FP2_GEN_CNTL);
+ ulOrigDISP_OUTPUT_CNTL = INREG(RADEON_DISP_OUTPUT_CNTL);
+ ulOrigCRTC2_GEN_CNTL = INREG(RADEON_CRTC2_GEN_CNTL);
+ ulOrigDISP_LIN_TRANS_GRPH_A = INREG(RADEON_DISP_LIN_TRANS_GRPH_A);
+ ulOrigDISP_LIN_TRANS_GRPH_B = INREG(RADEON_DISP_LIN_TRANS_GRPH_B);
+ ulOrigDISP_LIN_TRANS_GRPH_C = INREG(RADEON_DISP_LIN_TRANS_GRPH_C);
+ ulOrigDISP_LIN_TRANS_GRPH_D = INREG(RADEON_DISP_LIN_TRANS_GRPH_D);
+ ulOrigDISP_LIN_TRANS_GRPH_E = INREG(RADEON_DISP_LIN_TRANS_GRPH_E);
+ ulOrigDISP_LIN_TRANS_GRPH_F = INREG(RADEON_DISP_LIN_TRANS_GRPH_F);
+
+ ulOrigCRTC2_H_TOTAL_DISP = INREG(RADEON_CRTC2_H_TOTAL_DISP);
+ ulOrigCRTC2_V_TOTAL_DISP = INREG(RADEON_CRTC2_V_TOTAL_DISP);
+ ulOrigCRTC2_H_SYNC_STRT_WID = INREG(RADEON_CRTC2_H_SYNC_STRT_WID);
+ ulOrigCRTC2_V_SYNC_STRT_WID = INREG(RADEON_CRTC2_V_SYNC_STRT_WID);
+
+ ulData = INREG(RADEON_GPIO_MONID);
+ ulData &= ~RADEON_GPIO_A_0;
+ OUTREG(RADEON_GPIO_MONID, ulData);
+
+ OUTREG(RADEON_FP2_GEN_CNTL, 0x0a000c0c);
+
+ OUTREG(RADEON_DISP_OUTPUT_CNTL, 0x00000012);
+
+ OUTREG(RADEON_CRTC2_GEN_CNTL, 0x06000000);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_A, 0x00000000);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_B, 0x000003f0);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_C, 0x00000000);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_D, 0x000003f0);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_E, 0x00000000);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_F, 0x000003f0);
+ OUTREG(RADEON_CRTC2_H_TOTAL_DISP, 0x01000008);
+ OUTREG(RADEON_CRTC2_H_SYNC_STRT_WID, 0x00000800);
+ OUTREG(RADEON_CRTC2_V_TOTAL_DISP, 0x00080001);
+ OUTREG(RADEON_CRTC2_V_SYNC_STRT_WID, 0x00000080);
+
+ for (i = 0; i < 200; i++) {
+ ulData = INREG(RADEON_GPIO_MONID);
+ bConnected = (ulData & RADEON_GPIO_Y_0)?1:0;
+ if (!bConnected) break;
+
+ usleep(1000);
+ }
+
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_A, ulOrigDISP_LIN_TRANS_GRPH_A);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_B, ulOrigDISP_LIN_TRANS_GRPH_B);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_C, ulOrigDISP_LIN_TRANS_GRPH_C);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_D, ulOrigDISP_LIN_TRANS_GRPH_D);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_E, ulOrigDISP_LIN_TRANS_GRPH_E);
+ OUTREG(RADEON_DISP_LIN_TRANS_GRPH_F, ulOrigDISP_LIN_TRANS_GRPH_F);
+ OUTREG(RADEON_CRTC2_H_TOTAL_DISP, ulOrigCRTC2_H_TOTAL_DISP);
+ OUTREG(RADEON_CRTC2_V_TOTAL_DISP, ulOrigCRTC2_V_TOTAL_DISP);
+ OUTREG(RADEON_CRTC2_H_SYNC_STRT_WID, ulOrigCRTC2_H_SYNC_STRT_WID);
+ OUTREG(RADEON_CRTC2_V_SYNC_STRT_WID, ulOrigCRTC2_V_SYNC_STRT_WID);
+ OUTREG(RADEON_CRTC2_GEN_CNTL, ulOrigCRTC2_GEN_CNTL);
+ OUTREG(RADEON_DISP_OUTPUT_CNTL, ulOrigDISP_OUTPUT_CNTL);
+ OUTREG(RADEON_FP2_GEN_CNTL, ulOrigFP2_GEN_CNTL);
+ OUTREG(RADEON_GPIO_MONID, ulOrigGPIO_MONID);
+ } else {
+ unsigned long ulOrigPIXCLKSDATA;
+ unsigned long ulOrigTV_MASTER_CNTL;
+ unsigned long ulOrigTV_DAC_CNTL;
+ unsigned long ulOrigTV_PRE_DAC_MUX_CNTL;
+ unsigned long ulOrigDAC_CNTL2;
+ unsigned long ulData;
+ unsigned long ulMask;
+
+ ulOrigPIXCLKSDATA = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
+
+ ulData = ulOrigPIXCLKSDATA;
+ ulData &= ~(RADEON_PIX2CLK_ALWAYS_ONb
+ | RADEON_PIX2CLK_DAC_ALWAYS_ONb);
+ ulMask = ~(RADEON_PIX2CLK_ALWAYS_ONb
+ | RADEON_PIX2CLK_DAC_ALWAYS_ONb);
+ OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, ulData, ulMask);
+
+ ulOrigTV_MASTER_CNTL = INREG(RADEON_TV_MASTER_CNTL);
+ ulData = ulOrigTV_MASTER_CNTL;
+ ulData &= ~RADEON_TVCLK_ALWAYS_ONb;
+ OUTREG(RADEON_TV_MASTER_CNTL, ulData);
+
+ ulOrigDAC_CNTL2 = INREG(RADEON_DAC_CNTL2);
+ ulData = ulOrigDAC_CNTL2;
+ ulData &= ~RADEON_DAC2_DAC2_CLK_SEL;
+ OUTREG(RADEON_DAC_CNTL2, ulData);
+
+ ulOrigTV_DAC_CNTL = INREG(RADEON_TV_DAC_CNTL);
+
+ ulData = 0x00880213;
+ OUTREG(RADEON_TV_DAC_CNTL, ulData);
+
+ ulOrigTV_PRE_DAC_MUX_CNTL = INREG(RADEON_TV_PRE_DAC_MUX_CNTL);
+
+ ulData = (RADEON_Y_RED_EN
+ | RADEON_C_GRN_EN
+ | RADEON_CMP_BLU_EN
+ | RADEON_RED_MX_FORCE_DAC_DATA
+ | RADEON_GRN_MX_FORCE_DAC_DATA
+ | RADEON_BLU_MX_FORCE_DAC_DATA);
+ if(info->ChipFamily == CHIP_FAMILY_R300)
+ ulData |= 0x180 << RADEON_TV_FORCE_DAC_DATA_SHIFT;
+ else
+ ulData |= 0x1f5 << RADEON_TV_FORCE_DAC_DATA_SHIFT;
+ OUTREG(RADEON_TV_PRE_DAC_MUX_CNTL, ulData);
+
+ usleep(1000);
+
+ ulData = INREG(RADEON_TV_DAC_CNTL);
+ bConnected = (ulData & RADEON_TV_DAC_CMPOUT)?1:0;
+
+ ulData = ulOrigPIXCLKSDATA;
+ ulMask = 0xFFFFFFFFL;
+ OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, ulData, ulMask);
+
+ OUTREG(RADEON_TV_MASTER_CNTL, ulOrigTV_MASTER_CNTL);
+ OUTREG(RADEON_DAC_CNTL2, ulOrigDAC_CNTL2);
+ OUTREG(RADEON_TV_DAC_CNTL, ulOrigTV_DAC_CNTL);
+ OUTREG(RADEON_TV_PRE_DAC_MUX_CNTL, ulOrigTV_PRE_DAC_MUX_CNTL);
+ }
+#endif
+ }
+
+ return(bConnected ? MT_CRT : MT_NONE);
+}
+
+static void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ DevUnion* pPriv;
+ RADEONEntPtr pRADEONEnt;
+ unsigned char *RADEONMMIO = info->MMIO;
+ const char *s;
+ Bool ignore_edid = FALSE;
#define RADEON_BIOS8(v) (info->VBIOS[v])
#define RADEON_BIOS16(v) (info->VBIOS[v] | \
@@ -773,6 +1104,277 @@ static Bool RADEONGetBIOSParameters(Scrn
(info->VBIOS[(v) + 2] << 16) | \
(info->VBIOS[(v) + 3] << 24))
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex);
+ pRADEONEnt = pPriv->ptr;
+
+ pRADEONEnt->MonType1 = MT_NONE;
+ pRADEONEnt->MonType2 = MT_NONE;
+ pRADEONEnt->MonInfo1 = NULL;
+ pRADEONEnt->MonInfo2 = NULL;
+
+ /* IgnoreEDID option is different from NoDDC options used by DDC module
+ * When IgnoreEDID is used, monitor detection will still use DDC
+ * detection, but all EDID data will not be used in mode validation.
+ */
+ if (xf86GetOptValBool(info->Options, OPTION_IGNORE_EDID, &ignore_edid))
+ {
+ if (ignore_edid)
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "IgnoreEDID is specified, EDID data will be ignored\n");
+ }
+
+ /*
+ * MonitorLayout option takes a string for two monitors connected in following format:
+ * Option "MonitorLayout" "primary-port-display, secondary-port-display"
+ * primary and secondary port displays can have one of following:
+ * NONE, CRT, LVDS, TMDS
+ * With this option, driver will bring up monitors as specified,
+ * not using auto-detection routines to probe monitors.
+ */
+
+ /* current monitor mapping scheme:
+ * Two displays connected:
+ * Primary Port:
+ * CRTC1 -> FP/TMDS -> DVI port -> TMDS panel --> Primary or
+ * CRTC1 -> FP/LVDS -> Int. LCD -> LVDS panel --> Primary or
+ * CRTC1 -> TV DAC -> DVI port -> CRT monitor --> Primary
+ *
+ * Secondary Port
+ * CRTC2 -> CRT DAC -> VGA port -> CRT monitor --> Secondary or
+ * CRTC2 -> FP2/Ext. -> DVI port -> TMDS panel --> Secondary
+ *
+ * Only DVI (or Int. LDC) conneced:
+ * CRTC1 -> FP/TMDS -> DVI port -> TMDS panel --> Primary or
+ * CRTC1 -> FP/LVDS -> Int. LCD -> LVDS panel --> Primary or
+ * CRTC1 -> TV DAC -> DVI port -> CRT monitor --> Primary
+ *
+ * Only VGA (can be DVI on some dual-DVI boards) connected:
+ * CRTC1 -> CRT DAC -> VGA port -> CRT monitor --> Primary or
+ * CRTC1 -> FP2/Ext. -> DVI port -> TMDS panel --> Primary (not supported)
+ *
+ * Note, this is different from Windows scheme where
+ * if a digital panel is connected to DVI port, DVI will be the 1st port
+ * otherwise, VGA port will be treated as 1st port
+ *
+ * Here we always treat DVI port as primary if both ports are connected.
+ * When only one port is connected, it will be treated as
+ * primary regardless which port or what type of display is involved.
+ */
+
+ if ((s = xf86GetOptValString(info->Options, OPTION_MONITOR_LAYOUT))) {
+ char s1[5], s2[5];
+ int i = 0, second = 0;
+
+ /* When using user specified monitor types, we will not do DDC detection
+ *
+ */
+ do {
+ switch(*s)
+ {
+ case ',':
+ s1[i] = '\0';
+ i = 0;
+ second = 1;
+ break;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ default:
+ if (second)
+ s2[i] = *s;
+ else
+ s1[i] = *s;
+ i++;
+ if (i == 4) break;
+ }
+ } while(*s++);
+ s2[i] = '\0';
+
+ if (strcmp(s1, "NONE") == 0)
+ pRADEONEnt->MonType1 = MT_NONE;
+ else if (strcmp(s1, "CRT") == 0)
+ pRADEONEnt->MonType1 = MT_CRT;
+ else if (strcmp(s1, "TMDS") == 0)
+ pRADEONEnt->MonType1 = MT_DFP;
+ else if (strcmp(s1, "LVDS") == 0)
+ pRADEONEnt->MonType1 = MT_LCD;
+ else
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Invalid Monitor type specified for 1st port \n");
+ if (strcmp(s2, "NONE") == 0)
+ pRADEONEnt->MonType2 = MT_NONE;
+ else if (strcmp(s2, "CRT") == 0)
+ pRADEONEnt->MonType2 = MT_CRT;
+ else if (strcmp(s2, "TMDS") == 0)
+ pRADEONEnt->MonType2 = MT_DFP;
+ else if (strcmp(s2, "LVDS") == 0)
+ pRADEONEnt->MonType2 = MT_LCD;
+ else
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Invalid Monitor type specified for 2nd port \n");
+
+ if (!ignore_edid) {
+ if (pRADEONEnt->MonType1) /* assuming the first port using DDC_DVI */
+ RADEONDisplayDDCConnected(pScrn, DDC_DVI, &pRADEONEnt->MonInfo1);
+ if (pRADEONEnt->MonType2) { /* assuming the second port using DDC_VGA/DDC_CRT2 */
+ if(!RADEONDisplayDDCConnected(pScrn, DDC_VGA, &pRADEONEnt->MonInfo2))
+ RADEONDisplayDDCConnected(pScrn, DDC_CRT2, &pRADEONEnt->MonInfo2);
+ }
+ }
+
+ if (!pRADEONEnt->MonType1) {
+ if (pRADEONEnt->MonType2) {
+ pRADEONEnt->MonType1 = pRADEONEnt->MonType2;
+ pRADEONEnt->MonInfo1 = pRADEONEnt->MonInfo2;
+ } else {
+ pRADEONEnt->MonType1 = MT_CRT;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "No valid monitor specified, force to CRT on 1st port\n");
+ }
+ pRADEONEnt->MonType2 = MT_NONE;
+ pRADEONEnt->MonInfo2 = NULL;
+ }
+ } else {
+ /* Auto detection */
+
+ Bool ReversedDAC = FALSE;
+ int i;
+ CARD32 tmp;
+
+ /* Old single head radeon cards */
+ if(!info->HasCRTC2) {
+ if((pRADEONEnt->MonType1 = RADEONDisplayDDCConnected(pScrn, DDC_DVI, &pRADEONEnt->MonInfo1)));
+ else if((pRADEONEnt->MonType1 = RADEONDisplayDDCConnected(pScrn, DDC_VGA, &pRADEONEnt->MonInfo1)));
+ else if((pRADEONEnt->MonType1 = RADEONDisplayDDCConnected(pScrn, DDC_CRT2, &pRADEONEnt->MonInfo1)));
+ else
+ pRADEONEnt->MonType1 = MT_CRT;
+ pRADEONEnt->HasSecondary = FALSE;
+ if (!ignore_edid) {
+ if (pRADEONEnt->MonInfo1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor1 EDID data ---------------------------\n");
+ xf86PrintEDID( pRADEONEnt->MonInfo1 );
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of Monitor1 EDID data --------------------\n");
+ }
+ }
+ return;
+ }
+
+ /* Normally the port uses DDC_DVI connected with TVDAC,
+ * But this is not true for OEM cards which have TVDAC and CRT DAC reversed.
+ * If that's the case, we need also reverse the port arrangement.
+ * BIOS settings are supposed report this correctly, work fine for all cards tested.
+ * But there may be some exceptions, in that case, user can reverse their monitor
+ * definition in config file to correct the problem.
+ */
+ if (info->VBIOS && (tmp = RADEON_BIOS16(info->FPBIOSstart + 0x50))) {
+ for (i = 1; i < 4; i++) {
+ unsigned int tmp0;
+ if (!RADEON_BIOS8(tmp + i*2) && i > 1) break;
+
+ tmp0 = RADEON_BIOS16(tmp + i*2);
+ if ((tmp0 & 0x01) && (((tmp0 >> 8) & 0xf) != DDC_DVI)) {
+ ReversedDAC = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Reversed DACs detected\n");
+ }
+ }
+ }
+
+ /* Primary Head (DVI or Laptop Int. panel)*/
+ /* A ddc capable display connected on DVI port */
+ if((pRADEONEnt->MonType1 = RADEONDisplayDDCConnected(pScrn, DDC_DVI, &pRADEONEnt->MonInfo1)));
+ else if ((info->ChipFamily == CHIP_FAMILY_M9 ||
+ info->ChipFamily == CHIP_FAMILY_M7 ||
+ info->ChipFamily == CHIP_FAMILY_M6) &&
+ (info->VBIOS && (INREG(RADEON_BIOS_4_SCRATCH) & 4))) {
+ /* non-DDC laptop panel connected on primary */
+ pRADEONEnt->MonType1 = MT_LCD;
+ } else {
+ /* CRT on DVI, TODO: not reliable, make it always return false for now*/
+ pRADEONEnt->MonType1 = RADEONCrtIsPhysicallyConnected(pScrn, ReversedDAC);
+ }
+
+ /* Secondary Head (mostly VGA, can be DVI on some OEM boards)*/
+ if((pRADEONEnt->MonType2 =
+ RADEONDisplayDDCConnected(pScrn, DDC_VGA, &pRADEONEnt->MonInfo2)));
+ else if((pRADEONEnt->MonType2 =
+ RADEONDisplayDDCConnected(pScrn, DDC_CRT2, &pRADEONEnt->MonInfo2)));
+ else
+ pRADEONEnt->MonType2 = RADEONCrtIsPhysicallyConnected(pScrn, !ReversedDAC);
+
+ /* no display detected on DVI port*/
+ if (pRADEONEnt->MonType1 == MT_NONE) {
+ if (pRADEONEnt->MonType2 != MT_NONE) {
+ /* Only one detected on VGA, let it to be primary */
+ pRADEONEnt->MonType1 = pRADEONEnt->MonType2;
+ pRADEONEnt->MonInfo1 = pRADEONEnt->MonInfo2;
+ pRADEONEnt->MonType2 = MT_NONE;
+ } else {
+ /* Non detected, Default to a CRT connected */
+ pRADEONEnt->MonType1 = MT_CRT;
+ }
+ }
+
+ if(ReversedDAC) {
+ if (pRADEONEnt->MonType1 == MT_CRT && pRADEONEnt->MonType2 == MT_CRT) {
+ xf86MonPtr MonInfo = pRADEONEnt->MonInfo1;
+ pRADEONEnt->MonInfo1 = pRADEONEnt->MonInfo2;
+ pRADEONEnt->MonInfo2 = MonInfo;
+ }
+ }
+
+ }
+
+ if(s) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Displays Configured by MonitorLayout: \n\tMonitor1--Type %d, Monitor2--Type %d\n\n",
+ pRADEONEnt->MonType1, pRADEONEnt->MonType2);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Displays Detected: Monitor1--Type %d, Monitor2--Type %d\n\n",
+ pRADEONEnt->MonType1, pRADEONEnt->MonType2);
+ }
+
+
+ if(ignore_edid) {
+ pRADEONEnt->MonInfo1 = NULL;
+ pRADEONEnt->MonInfo2 = NULL;
+ }
+
+ if (!ignore_edid) {
+ if (pRADEONEnt->MonInfo1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor1 EDID data ---------------------------\n");
+ xf86PrintEDID( pRADEONEnt->MonInfo1 );
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of Monitor1 EDID data --------------------\n");
+ }
+
+ if (pRADEONEnt->MonInfo2) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor2 EDID data ---------------------------\n");
+ xf86PrintEDID( pRADEONEnt->MonInfo2 );
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of Monitor2 EDID data --------------------\n");
+ }
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\n");
+
+ info->OverlayOnCRTC2 = FALSE;
+ if (xf86ReturnOptValBool(info->Options, OPTION_CRTC2_OVERLAY, FALSE)) {
+ info->OverlayOnCRTC2 = TRUE;
+ }
+
+ if (pRADEONEnt->MonType2 == MT_NONE)
+ pRADEONEnt->HasSecondary = FALSE;
+
+}
+
+/* Read the Video BIOS block and the FP registers (if applicable). */
+static Bool RADEONGetParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned long tmp, i;
+ unsigned char *RADEONMMIO;
+
if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Cannot allocate space for hold Video BIOS!\n");
@@ -799,333 +1401,237 @@ static Bool RADEONGetBIOSParameters(Scrn
if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
xfree(info->VBIOS);
+ info->FPBIOSstart = 0;
info->VBIOS = NULL;
info->BIOSAddr = 0x00000000;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Video BIOS not found!\n");
- return TRUE;
- }
+ } else
+ info->FPBIOSstart = RADEON_BIOS16(0x48);
- info->FPBIOSstart = RADEON_BIOS16(0x48);
info->OverlayOnCRTC2 = FALSE;
- RADEONMapMMIO(pScrn);
- RADEONMMIO = info->MMIO;
-
- /* FIXME: using BIOS scratch registers to detect connected monitors
- * may not be a reliable way.... should use EDID data. Also it only
- * works with for VE/M6, no such registers in regular RADEON!!!
- */
+ if (!info->IsSecondary)
+ RADEONQueryConnectedDisplays(pScrn);
- /* VE and M6 have both DVI and CRT ports (for M6 DVI port can be
- * switch to DFP port). The DVI port can also be conneted to a CRT
- * with an adapter. Here is the definition of ports for this
- * driver:
- *
- * (1) If both port are connected, DVI port will be treated as the
- * Primary port (first screen in XF86Config, uses CRTC1) and CRT
- * port will be treated as the Secondary port (second screen in
- * XF86Config, uses CRTC2)
- *
- * (2) If only one screen specified in XF86Config, it will be used
- * for DVI port if a monitor is connected to DVI port, otherwise
- * (only one monitor is connected the CRT port) it will be used for
- * CRT port.
- */
+ {
+ DevUnion* pPriv;
+ RADEONEntPtr pRADEONEnt;
+ RADEONMMIO = info->MMIO;
- if (info->HasCRTC2) {
- /* FIXME: this may not be reliable */
- tmp = INREG(RADEON_BIOS_4_SCRATCH);
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex);
+ pRADEONEnt = pPriv->ptr;
+ info->Clone = FALSE;
+ info->CloneType = MT_NONE;
- if (info->IsSecondary) {
- /* Check Port2 (CRT port) -- for the existing boards (VE &
- * M6), this port can only be connected to a CRT
- */
- if (tmp & 0x02) info->DisplayType = MT_CRT;
- else if (tmp & 0x800) info->DisplayType = MT_DFP;
- else if (tmp & 0x400) info->DisplayType = MT_LCD;
- else if (tmp & 0x1000) info->DisplayType = MT_CTV;
- else if (tmp & 0x2000) info->DisplayType = MT_STV;
- else info->DisplayType = MT_CRT;
+ if(info->HasCRTC2) {
+ if(info->IsSecondary) {
+ if(!(info->DisplayType = pRADEONEnt->MonType2)) return FALSE;
+ } else {
+ info->DisplayType = pRADEONEnt->MonType1;
+ if(!pRADEONEnt->HasSecondary) {
+ if ((info->CloneType = pRADEONEnt->MonType2))
+ info->Clone = TRUE;
+ }
+ }
} else {
- info->Clone = FALSE;
- info->CloneType = MT_NONE;
+ /*Regular RADEON ASIC, only one CRTC, but it could be
+ used for DFP with a DVI output, like AIW board*/
+ tmp = INREG(RADEON_FP_GEN_CNTL);
- /* Check Primary (DVI/DFP port) */
- if (tmp & 0x08) info->DisplayType = MT_DFP;
- else if (tmp & 0x04) info->DisplayType = MT_LCD;
- else if (tmp & 0x0200) info->DisplayType = MT_CRT;
- else if (tmp & 0x10) info->DisplayType = MT_CTV;
- else if (tmp & 0x20) info->DisplayType = MT_STV;
- else info->DisplayType = MT_NONE;
-
- if (info->DisplayType == MT_NONE) {
- /* DVI port has no monitor connected, try CRT port.
- * If something on CRT port, treat it as primary
- */
- if (xf86IsEntityShared(pScrn->entityList[0])) {
- DevUnion *pPriv;
- RADEONEntPtr pRADEONEnt;
+ if(tmp & RADEON_FP_EN_TMDS) info->DisplayType = MT_DFP;
+ else info->DisplayType = MT_CRT;
+ }
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- gRADEONEntityIndex);
- pRADEONEnt = pPriv->ptr;
- pRADEONEnt->BypassSecondary = TRUE;
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Display == Type %d\n",
+ (info->IsSecondary ? "Secondary" : "Primary"),
+ info->DisplayType);
- if (tmp & 0x02) info->DisplayType = MT_CRT;
- else if (tmp & 0x800) info->DisplayType = MT_DFP;
- else if (tmp & 0x400) info->DisplayType = MT_LCD;
- else if (tmp & 0x1000) info->DisplayType = MT_CTV;
- else if (tmp & 0x2000) info->DisplayType = MT_STV;
- else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "No monitor detected!!!\n");
- return FALSE;
- }
- BypassSecondary = TRUE;
- } else {
- if (tmp & 0x02) {
- info->CloneType = MT_CRT;
- info->Clone = TRUE;
- } else if (tmp & 0x800) {
- info->CloneType = MT_DFP;
- info->Clone = TRUE;
- }
- }
+ if (info->Clone)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clone Display == Type %d\n",
+ info->CloneType);
- /* FIXME: This option is too complicated. We need to
- * find a better way to handle all cases.
- *
- * CloneDisplay options:
- * 0 -- disable
- * 1 -- auto-detect (default)
- * 2 -- force on
- * 3 -- auto-detect + 2nd head overlay.
- * 4 -- force on + 2nd head overlay.
- * others -- auto-detect
- *
- * Force on: it will force the clone mode on even no display
- * is detected. With this option together with the proper
- * CloneHSync and CloneVRefresh options, we can turn on the
- * CRT ouput on the 2nd head regardless if a monitor is
- * connected there. This way, we can plug in a CRT to the
- * second head later after X server has started.
- *
- * 2nd head overlay: it will force the hardware overlay on
- * CRTC2 (used by 2nd head). Since we only have one overlay,
- * we have to decide which head to use it (the overlay space
- * on the other head will be blank). 2nd head overlay is on
- * automatically when PanelOff option is effective.
- */
- if (xf86GetOptValInteger(info->Options, OPTION_CLONE_DISPLAY,
- &(CloneDispOption))) {
- char *s = NULL;
+
+ info->HBlank = 0;
+ info->HOverPlus = 0;
+ info->HSyncWidth = 0;
+ info->VBlank = 0;
+ info->VOverPlus = 0;
+ info->VSyncWidth = 0;
+ info->DotClock = 0;
+
+ if (info->DisplayType == MT_LCD && info->FPBIOSstart) {
+ tmp = RADEON_BIOS16(info->FPBIOSstart + 0x40);
+ if (!tmp) {
+ info->PanelPwrDly = 200;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "No Panel Info Table found in BIOS!\n");
+ } else {
+ char stmp[30];
+ int tmp0;
+
+ for (i = 0; i < 24; i++)
+ stmp[i] = RADEON_BIOS8(tmp+i+1);
+ stmp[24] = 0;
- if (CloneDispOption < 0 || CloneDispOption > 4) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Illegal CloneDisplay Option set, "
- "using default\n");
- CloneDispOption = 1;
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Panel ID string: %s\n", stmp);
- switch (CloneDispOption) {
- case 0: s = "Disable"; break;
- case 1: s = "Auto-detect"; break;
- case 2: s = "Force On"; break;
- case 3: s = "Auto-detect -- use 2nd head overlay"; break;
- case 4: s = "Force On -- use 2nd head overlay"; break;
+ info->PanelXRes = RADEON_BIOS16(tmp+25);
+ info->PanelYRes = RADEON_BIOS16(tmp+27);
+ xf86DrvMsg(0, X_INFO, "Panel Size from BIOS: %dx%d\n",
+ info->PanelXRes, info->PanelYRes);
+
+ info->PanelPwrDly = RADEON_BIOS16(tmp+44);
+ if (info->PanelPwrDly > 2000 || info->PanelPwrDly < 0)
+ info->PanelPwrDly = 2000;
+ for (i = 0; i < 20; i++) {
+ tmp0 = RADEON_BIOS16(tmp+64+i*2);
+ if (tmp0 == 0) break;
+ if ((RADEON_BIOS16(tmp0) == info->PanelXRes) &&
+ (RADEON_BIOS16(tmp0+2) == info->PanelYRes)) {
+ info->HBlank = (RADEON_BIOS16(tmp0+17) -
+ RADEON_BIOS16(tmp0+19)) * 8;
+ info->HOverPlus = (RADEON_BIOS16(tmp0+21) -
+ RADEON_BIOS16(tmp0+19) - 1) * 8;
+ info->HSyncWidth = RADEON_BIOS8(tmp0+23) * 8;
+ info->VBlank = (RADEON_BIOS16(tmp0+24) -
+ RADEON_BIOS16(tmp0+26));
+ info->VOverPlus = ((RADEON_BIOS16(tmp0+28) & 0x7ff) -
+ RADEON_BIOS16(tmp0+26));
+ info->VSyncWidth = ((RADEON_BIOS16(tmp0+28) & 0xf800) >> 11);
+ info->DotClock = RADEON_BIOS16(tmp0+9) * 10;
+ info->Flags = 0;
+ }
}
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "CloneDisplay option: %s (%d)\n",
- s, CloneDispOption);
- } else {
- /* Default to auto-detect */
- CloneDispOption = 1;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "CloneDisplay option not set -- "
- "defaulting to auto-detect\n");
}
+ }
+ }
+ return TRUE;
+}
- if (CloneDispOption == 0) {
- info->Clone = FALSE;
- } else if ((CloneDispOption == 2 || CloneDispOption == 4)
- && !info->Clone) {
- info->CloneType = MT_CRT;
- info->Clone = TRUE;
- }
- /* This will be used to set OV0_SCALAR_CNTL */
- if (info->Clone && (CloneDispOption == 3 || CloneDispOption == 4))
- info->OverlayOnCRTC2 = TRUE;
- }
- } else {
- /* Regular Radeon ASIC, only one CRTC, but it could be used for
- * DFP with a DVI output, like AIW board
- */
- tmp = INREG(RADEON_FP_GEN_CNTL);
- if (tmp & RADEON_FP_EN_TMDS) info->DisplayType = MT_DFP;
- else info->DisplayType = MT_CRT;
+static Bool RADEONProbePLLParameters(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONPLLPtr pll = &info->pll;
+ unsigned char *RADEONMMIO = info->MMIO;
+ unsigned char ppll_div_sel;
+ unsigned Nx, M;
+ unsigned xclk, tmp, ref_div;
+ int mapped=0, hTotal, vTotal, num, denom, m, n;
+ float hz, vclk, xtal;
+ long start_secs, start_usecs, stop_secs, stop_usecs, total_usecs;
+ int i;
+
+ if (!info->MMIO) {
+ RADEONMapMMIO(pScrn);
+ RADEONMMIO = info->MMIO;
+ mapped = 1;
}
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Display == Type %d\n",
- (info->IsSecondary ? "Secondary" : "Primary"),
- info->DisplayType);
+ tmp = INREG(RADEON_DEVICE_ID);
- RADEONMMIO = NULL;
- RADEONUnmapMMIO(pScrn);
+ for(i=0; i<1000000; i++)
+ if (((INREG(RADEON_CRTC_VLINE_CRNT_VLINE) >> 16) & 0x3ff) == 0)
+ break;
- info->HBlank = 0;
- info->HOverPlus = 0;
- info->HSyncWidth = 0;
- info->VBlank = 0;
- info->VOverPlus = 0;
- info->VSyncWidth = 0;
- info->DotClock = 0;
-
- if (info->DisplayType == MT_LCD) {
- tmp = RADEON_BIOS16(info->FPBIOSstart + 0x40);
- if (!tmp) {
- info->PanelPwrDly = 200;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "No Panel Info Table found in BIOS!\n");
- } else {
- char stmp[30];
- int tmp0;
+ xf86getsecs(&start_secs, &start_usecs);
- for (i = 0; i < 24; i++)
- stmp[i] = RADEON_BIOS8(tmp+i+1);
- stmp[24] = 0;
+ for(i=0; i<1000000; i++)
+ if (((INREG(RADEON_CRTC_VLINE_CRNT_VLINE) >> 16) & 0x3ff) != 0)
+ break;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Panel ID string: %s\n", stmp);
+ for(i=0; i<1000000; i++)
+ if (((INREG(RADEON_CRTC_VLINE_CRNT_VLINE) >> 16) & 0x3ff) == 0)
+ break;
- info->PanelXRes = RADEON_BIOS16(tmp+25);
- info->PanelYRes = RADEON_BIOS16(tmp+27);
- xf86DrvMsg(0, X_INFO, "Panel Size from BIOS: %dx%d\n",
- info->PanelXRes, info->PanelYRes);
+ xf86getsecs(&stop_secs, &stop_usecs);
- info->PanelPwrDly = RADEON_BIOS16(tmp+44);
- if (info->PanelPwrDly > 2000 || info->PanelPwrDly < 0)
- info->PanelPwrDly = 2000;
- for (i = 0; i < 20; i++) {
- tmp0 = RADEON_BIOS16(tmp+64+i*2);
- if (tmp0 == 0) break;
- if ((RADEON_BIOS16(tmp0) == info->PanelXRes) &&
- (RADEON_BIOS16(tmp0+2) == info->PanelYRes)) {
- info->HBlank = (RADEON_BIOS16(tmp0+17) -
- RADEON_BIOS16(tmp0+19)) * 8;
- info->HOverPlus = (RADEON_BIOS16(tmp0+21) -
- RADEON_BIOS16(tmp0+19) - 1) * 8;
- info->HSyncWidth = RADEON_BIOS8(tmp0+23) * 8;
- info->VBlank = (RADEON_BIOS16(tmp0+24) -
- RADEON_BIOS16(tmp0+26));
- info->VOverPlus = ((RADEON_BIOS16(tmp0+28) & 0x7ff) -
- RADEON_BIOS16(tmp0+26));
- info->VSyncWidth = ((RADEON_BIOS16(tmp0+28) & 0xf800)
- >> 11);
- info->DotClock = RADEON_BIOS16(tmp0+9) * 10;
- info->Flags = 0;
- }
- }
- }
- } else if ((info->DisplayType == MT_DFP) && info->HasCRTC2) {
- tmp = RADEON_BIOS16(info->FPBIOSstart + 0x34);
- if (tmp != 0) {
- tmp = RADEON_BIOS16(tmp + 2);
- if (tmp != 0) {
- /* 18 bytes of EDID data should be here */
- info->DotClock = RADEON_BIOS16(tmp) * 10;
- info->PanelXRes =
- ((RADEON_BIOS8(tmp + 4) & 0xf0) << 4) +
- RADEON_BIOS8(tmp + 2);
- info->HBlank =
- ((RADEON_BIOS8(tmp + 4) & 0x0f) << 8) +
- RADEON_BIOS8(tmp + 3);
- info->PanelYRes =
- ((RADEON_BIOS8(tmp + 7) & 0xf0) << 4) +
- RADEON_BIOS8(tmp + 5);
- info->VBlank =
- ((RADEON_BIOS8(tmp + 7) & 0x0f) << 8) +
- RADEON_BIOS8(tmp + 6);
- info->HOverPlus =
- ((RADEON_BIOS8(tmp + 11) & 0xc0) << 2) +
- RADEON_BIOS8(tmp + 8);
- info->HSyncWidth =
- ((RADEON_BIOS8(tmp + 11) & 0x30) << 4) +
- RADEON_BIOS8(tmp + 9);
- info->VOverPlus =
- ((RADEON_BIOS8(tmp + 11) & 0x0c) << 2) +
- ((RADEON_BIOS8(tmp + 10) & 0xf0) >> 4);
- info->VSyncWidth =
- ((RADEON_BIOS8(tmp + 11) & 0x03) << 4) +
- (RADEON_BIOS8(tmp + 10) & 0x0f);
- info->Flags = 0;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "No DFP timing table detected\n");
- }
- }
+ total_usecs = xf86abs(stop_usecs - start_usecs);
+ hz = 1000000/total_usecs;
- RADEONTRACE(("DFP Info: ----------------------\n"
- "pixel clock: %d KHz\n"
- "panel size: %dx%d\n"
- "H. Blanking: %d\n"
- "H. Sync. Offset: %d\n"
- "H. Sync. Width: %d\n"
- "V. Blanking: %d\n"
- "V. Sync. Offset: %d\n"
- "V. Sync. Width: %d\n",
- info->DotClock,
- info->PanelXRes, info->PanelYRes,
- info->HBlank,
- info->HOverPlus,
- info->HSyncWidth,
- info->VBlank, info->VOverPlus, info->VSyncWidth));
- }
-
- /* Detect connector type from BIOS, used for I2C/DDC qeurying EDID,
- * Only available for VE or newer cards */
-
- /* DELL OEM card doesn't seem to follow the conviention for BIOS's
- * DDC type, we have to make a special case. Following hard coded
- * type works with both CRT+CRT and DVI+DVI cases
- */
- if (info->IsDell && info->DellType == 2) {
- if (info->IsSecondary)
- info->DDCType = DDC_CRT2;
- else
- info->DDCType = DDC_DVI;
- info->CloneDDCType = DDC_CRT2;
- } else if ((tmp = RADEON_BIOS16(info->FPBIOSstart + 0x50))) {
- for (i = 1; i < 4; i++) {
- unsigned int tmp0;
- if (!RADEON_BIOS8(tmp + i*2) && i > 1) break;
-
- /* Note: Secondary port (CRT port) actually uses primary DAC */
- tmp0 = RADEON_BIOS16(tmp + i*2);
- if (tmp0 & 0x01) {
- if (!info->IsSecondary && !BypassSecondary)
- info->DDCType = (tmp0 & 0x0f00) >> 8;
- } else { /* Primary DAC */
- if (info->Clone)
- info->CloneDDCType = (tmp0 & 0x0f00) >> 8;
- else if (info->IsSecondary ||
- BypassSecondary ||
- !info->HasCRTC2) {
- info->DDCType = (tmp0 & 0x0f00) >> 8;
- }
- }
- }
- } else {
- /* Orignal radeon cards, set it to DDC_VGA, this will not work
- * with AIW, it should be DDC_DVI, let it fall back to VBE calls
- * for AIW
- */
- info->DDCType = DDC_VGA;
+ hTotal = ((INREG(RADEON_CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8;
+ vTotal = ((INREG(RADEON_CRTC_V_TOTAL_DISP) & 0x3ff) + 1);
+ vclk = (float)(hTotal * (float)(vTotal * hz));
+
+ switch((INPLL(pScrn, RADEON_PPLL_REF_DIV) & 0x30000) >> 16) {
+ case 0:
+ default:
+ num = 1;
+ denom = 1;
+ break;
+ case 1:
+ n = ((INPLL(pScrn, RADEON_X_MPLL_REF_FB_DIV) >> 16) & 0xff);
+ m = (INPLL(pScrn, RADEON_X_MPLL_REF_FB_DIV) & 0xff);
+ num = 2*n;
+ denom = 2*m;
+ break;
+ case 2:
+ n = ((INPLL(pScrn, RADEON_X_MPLL_REF_FB_DIV) >> 8) & 0xff);
+ m = (INPLL(pScrn, RADEON_X_MPLL_REF_FB_DIV) & 0xff);
+ num = 2*n;
+ denom = 2*m;
+ break;
}
+ OUTREG(RADEON_CLOCK_CNTL_INDEX, 1);
+ ppll_div_sel = INREG8(RADEON_CLOCK_CNTL_DATA + 1) & 0x3;
+
+ n = (INPLL(pScrn, RADEON_PPLL_DIV_0 + ppll_div_sel) & 0x7ff);
+ m = (INPLL(pScrn, RADEON_PPLL_REF_DIV) & 0x3ff);
+
+ num *= n;
+ denom *= m;
+
+ switch ((INPLL(pScrn, RADEON_PPLL_DIV_0 + ppll_div_sel) >> 16) & 0x7) {
+ case 1:
+ denom *= 2;
+ break;
+ case 2:
+ denom *= 4;
+ break;
+ case 3:
+ denom *= 8;
+ break;
+ case 4:
+ denom *= 3;
+ break;
+ case 6:
+ denom *= 6;
+ break;
+ case 7:
+ denom *= 12;
+ break;
+ }
+
+ xtal = (int)(vclk *(float)denom/(float)num);
+
+ if ((xtal > 26900000) && (xtal < 27100000))
+ xtal = 2700;
+ else if ((xtal > 14200000) && (xtal < 14400000))
+ xtal = 1432;
+ else if ((xtal > 29400000) && (xtal < 29600000))
+ xtal = 2950;
+ else
+ return FALSE;
+
+ tmp = INPLL(pScrn, RADEON_X_MPLL_REF_FB_DIV);
+ ref_div = INPLL(pScrn, RADEON_PPLL_REF_DIV) & 0x3ff;
+
+ if (mapped)
+ RADEONUnmapMMIO(pScrn);
+
+ Nx = (tmp & 0xff00) >> 8;
+ M = (tmp & 0xff);
+ xclk = RADEONDiv((2 * Nx * xtal), (2 * M));
+
+ /* we're done, hopefully these are sane values */
+ pll->reference_div = ref_div;
+ pll->xclk = xclk;
+ pll->reference_freq = xtal;
+
return TRUE;
}
@@ -1140,21 +1646,43 @@ static Bool RADEONGetPLLParameters(ScrnI
CARD16 pll_info_block;
if (!info->VBIOS) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Video BIOS not detected, using default PLL parameters!\n");
- /* These probably aren't going to work for
- the card you are using. Specifically,
- reference freq can be 29.50MHz,
- 28.63MHz, or 14.32MHz. YMMV. */
-
- /* These are somewhat sane defaults for Mac boards, we will need
- * to find a good way of getting these from OpenFirmware
- */
- pll->reference_freq = 2700;
- pll->reference_div = 67;
pll->min_pll_freq = 12500;
pll->max_pll_freq = 35000;
- pll->xclk = 16615;
+
+ if (!RADEONProbePLLParameters(pScrn)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Video BIOS not detected, using default PLL parameters!\n");
+
+ switch (info->Chipset) {
+ case PCI_CHIP_R200_QL:
+ case PCI_CHIP_R200_QN:
+ case PCI_CHIP_R200_QO:
+ case PCI_CHIP_R200_Ql:
+ case PCI_CHIP_R200_BB:
+ pll->reference_freq = 2700;
+ pll->reference_div = 12;
+ pll->xclk = 27500;
+ break;
+ case PCI_CHIP_RV250_Id:
+ case PCI_CHIP_RV250_Ie:
+ case PCI_CHIP_RV250_If:
+ case PCI_CHIP_RV250_Ig:
+ pll->reference_freq = 2700;
+ pll->reference_div = 12;
+ pll->xclk = 24975;
+ break;
+ case PCI_CHIP_RV200_QW:
+ pll->reference_freq = 2700;
+ pll->reference_div = 12;
+ pll->xclk = 23000;
+ break;
+ default:
+ pll->reference_freq = 2700;
+ pll->reference_div = 67;
+ pll->xclk = 16615;
+ break;
+ }
+ }
} else {
bios_header = RADEON_BIOS16(0x48);
pll_info_block = RADEON_BIOS16(bios_header + 0x30);
@@ -1281,6 +1809,10 @@ static Bool RADEONPreInitConfig(ScrnInfo
int offset = 0; /* RAM Type */
MessageType from;
unsigned char *RADEONMMIO;
+ DevUnion *pPriv;
+ RADEONEntPtr pRADEONEnt;
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex);
+ pRADEONEnt = pPriv->ptr;
/* Chipset */
from = X_PROBED;
@@ -1367,33 +1899,6 @@ static Bool RADEONPreInitConfig(ScrnInfo
info->HasCRTC2 = FALSE;
}
- /* Here is the special case for DELL's VE card.
- * It needs some special handlings for it's 2nd head to work.
- */
- info->IsDell = FALSE;
- if (info->ChipFamily == CHIP_FAMILY_VE &&
- info->PciInfo->subsysVendor == PCI_VENDOR_ATI &&
- info->PciInfo->subsysCard & (1 << 12)) { /* DELL's signature */
- if (info->PciInfo->subsysCard & 0xb00) {
- info->IsDell = TRUE;
- info->DellType = 2; /* DVI+DVI config, this seems to be the
- * only known type for now, can be
- * connected to both DVI+DVI and VGA+VGA
- * dongles.
- */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "DELL OEM Card detected with %s (type %d)\n",
- (info->DellType == 2) ? "DVI+DVI / VGA+VGA" : "VGA+VGA",
- info->DellType);
- } else {
- info->DellType = 0; /* Unknown */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Unknown type of DELL's Card (SSCID %x), "
- "treated as normal type\n",
- info->PciInfo->subsysCard);
- }
- }
-
/* Framebuffer */
from = X_PROBED;
@@ -1460,23 +1965,12 @@ static Bool RADEONPreInitConfig(ScrnInfo
/* Some production boards of m6 will return 0 if it's 8 MB */
if (pScrn->videoRam == 0) pScrn->videoRam = 8192;
- if (info->IsSecondary) {
+ if (pRADEONEnt->HasSecondary) {
/* FIXME: For now, split FB into two equal sections. This should
* be able to be adjusted by user with a config option. */
- DevUnion *pPriv;
- RADEONEntPtr pRADEONEnt;
- RADEONInfoPtr info1;
-
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gRADEONEntityIndex);
- pRADEONEnt = pPriv->ptr;
- pScrn->videoRam /= 2;
- pRADEONEnt->pPrimaryScrn->videoRam = pScrn->videoRam;
-
- info1 = RADEONPTR(pRADEONEnt->pPrimaryScrn);
- info1->FbMapSize = pScrn->videoRam * 1024;
- info->LinearAddr += pScrn->videoRam * 1024;
- info1->Clone = FALSE;
- info1->CurCloneMode = NULL;
+ pScrn->videoRam /= 2;
+ if (info->IsSecondary)
+ info->LinearAddr += pScrn->videoRam * 1024;
}
info->MemCntl = INREG(RADEON_SDRAM_MODE_REG);
@@ -1578,24 +2072,7 @@ static Bool RADEONI2cInit(ScrnInfoPtr pS
info->pI2CBus->I2CPutBits = RADEONI2CPutBits;
info->pI2CBus->I2CGetBits = RADEONI2CGetBits;
info->pI2CBus->AcknTimeout = 5;
-
- switch (info->DDCType) {
- case DDC_MONID:
- info->DDCReg = RADEON_GPIO_MONID;
- break;
- case DDC_DVI:
- info->DDCReg = RADEON_GPIO_DVI_DDC;
- break;
- case DDC_VGA:
- info->DDCReg = RADEON_GPIO_VGA_DDC;
- break;
- case DDC_CRT2:
- info->DDCReg = RADEON_GPIO_CRT2_DDC;
- break;
- default:
- return FALSE;
- }
-
+
if (!xf86I2CBusInit(info->pI2CBus)) return FALSE;
return TRUE;
}
@@ -1625,114 +2102,6 @@ static void RADEONPreInitDDC(ScrnInfoPtr
}
}
-static xf86MonPtr RADEONDoDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
-{
- RADEONInfoPtr info = RADEONPTR(pScrn);
- xf86MonPtr MonInfo = NULL;
- unsigned char *RADEONMMIO;
- int i;
-
- /* We'll use DDC2, BIOS EDID can only detect the monitor connected
- * to one port. For VE, BIOS EDID detects the monitor connected to
- * DVI port by default. If no monitor their, it will try CRT port
- */
-
- /* Read and output monitor info using DDC2 over I2C bus */
- if (info->pI2CBus && info->ddc2) {
- int j;
-
- if (!RADEONMapMMIO(pScrn)) return NULL;
- RADEONMMIO = info->MMIO;
- OUTREG(info->DDCReg, INREG(info->DDCReg) &
- (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1));
-
- /* For some old monitors (like Compaq Presario FP500), we need
- * following process to initialize/stop DDC
- */
- OUTREG(info->DDCReg, INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1));
- for (j = 0; j < 3; j++) {
- OUTREG(info->DDCReg,
- INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0));
- usleep(13000);
-
- OUTREG(info->DDCReg,
- INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1));
- for (i = 0; i < 10; i++) {
- usleep(15000);
- if (INREG(info->DDCReg) & RADEON_GPIO_Y_1)
- break;
- }
- if (i == 10) continue;
-
- usleep(15000);
-
- OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0);
- usleep(15000);
-
- OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1);
- usleep(15000);
- OUTREG(info->DDCReg,
- INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0));
- usleep(15000);
- MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, info->pI2CBus);
-
- OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1);
- OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0);
- usleep(15000);
- OUTREG(info->DDCReg,
- INREG(info->DDCReg) & ~(RADEON_GPIO_EN_1));
- for (i = 0; i < 50; i++) {
- usleep(15000);
- if (INREG(info->DDCReg) & RADEON_GPIO_Y_1)
- break;
- }
- usleep(15000);
- OUTREG(info->DDCReg,
- INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0));
- usleep(15000);
-
- OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_1);
- OUTREG(info->DDCReg, INREG(info->DDCReg) | RADEON_GPIO_EN_0);
- usleep(15000);
- if (MonInfo)
- break;
- }
-
- RADEONUnmapMMIO(pScrn);
- }
-
- if (!MonInfo && pInt10 && (info->DDCReg == RADEON_GPIO_VGA_DDC)) {
- if (xf86LoadSubModule(pScrn, "vbe")) {
- vbeInfoPtr pVbe;
- pVbe = VBEInit(pInt10, info->pEnt->index);
- if (pVbe) {
- for (i = 0; i < 5; i++) {
- MonInfo = vbeDoEDID(pVbe, NULL);
- info->ddc_bios = TRUE;
- if (MonInfo)
- break;
- }
- } else
- info->ddc_bios = FALSE;
- }
- }
-
- if (MonInfo) {
- if (info->ddc2)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C EDID Info:\n");
- else if (info->ddc_bios)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS EDID Info:\n");
- else return NULL;
-
- xf86PrintEDID(MonInfo);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of DDC Monitor info\n\n");
-
- xf86SetDDCproperties(pScrn, MonInfo);
- return MonInfo;
- }
- else return NULL;
-}
-
/* BIOS may not have right panel size, we search through all supported
* DDC modes looking for the maximum panel size.
*/
@@ -1918,7 +2287,6 @@ static DisplayModePtr RADEONDDCModes(Scr
new->name);
RADEONSortModes(&new, &first, &last);
- break;
}
}
@@ -2056,6 +2424,7 @@ static int RADEONValidateDDCModes(ScrnIn
/* Reset the max virtual dimensions */
maxVirtX = pScrn->virtualX;
maxVirtY = pScrn->virtualY;
+ count = 0;
/* Reset list */
first = last = NULL;
@@ -2090,7 +2459,7 @@ static int RADEONValidateDDCModes(ScrnIn
}
p->next = NULL;
last = p;
-
+ count++;
break;
}
}
@@ -2160,7 +2529,7 @@ static DisplayModePtr RADEONFPNativeMode
pScrn->virtualY = MAX(pScrn->virtualY, info->PanelYRes);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "No valid mode specified, force to native mdoe\n");
+ "No valid mode specified, force to native mode\n");
}
return new;
@@ -2240,7 +2609,10 @@ static int RADEONValidateFPModes(ScrnInf
}
/* If all else fails, add the native mode */
- if (!count) first = last = RADEONFPNativeMode(pScrn);
+ if (!count) {
+ if ((first = last = RADEONFPNativeMode(pScrn)))
+ count++;
+ }
/* Close the doubly-linked mode list, if we found any usable modes */
if (last) {
@@ -2256,15 +2628,6 @@ static int RADEONValidateFPModes(ScrnInf
return count;
}
-/* This is called by RADEONPreInit to initialize gamma correction */
-static Bool RADEONPreInitGamma(ScrnInfoPtr pScrn)
-{
- Gamma zeros = { 0.0, 0.0, 0.0 };
-
- if (!xf86SetGamma(pScrn, zeros)) return FALSE;
- return TRUE;
-}
-
static void RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
{
MonPtr mon = pScrn->monitor;
@@ -2353,6 +2716,15 @@ static void RADEONSetSyncRangeFromEdid(S
}
}
+/* This is called by RADEONPreInit to initialize gamma correction */
+static Bool RADEONPreInitGamma(ScrnInfoPtr pScrn)
+{
+ Gamma zeros = { 0.0, 0.0, 0.0 };
+
+ if (!xf86SetGamma(pScrn, zeros)) return FALSE;
+ return TRUE;
+}
+
static int RADEONValidateCloneModes(ScrnInfoPtr pScrn)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
@@ -2365,9 +2737,15 @@ static int RADEONValidateCloneModes(Scrn
int tmp_vdisplay = 0;
int i, save_n_hsync, save_n_vrefresh;
range save_hsync, save_vrefresh;
- char *s;
- char **clone_mode_names = NULL;
+ char *s;
+ char **clone_mode_names = NULL;
Bool ddc_mode = info->ddc_mode;
+ DevUnion *pPriv;
+ RADEONEntPtr pRADEONEnt;
+
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gRADEONEntityIndex);
+ pRADEONEnt = pPriv->ptr;
/* Save all infomations that will be changed by clone mode validateion */
save_mode = pScrn->modes;
@@ -2404,14 +2782,19 @@ static int RADEONValidateCloneModes(Scrn
else count++;
clone_mode_names[0] = xnfalloc(strlen(s)+1);
sprintf(clone_mode_names[0], "%dx%d", tmp_hdisplay, tmp_vdisplay);
- xf86DrvMsg(0, X_INFO, "Clone mode %s in config file is used\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clone mode %s in config file is used\n");
}
}
- if (pScrn->display->virtualX < tmp_hdisplay)
- pScrn->display->virtualX = tmp_hdisplay;
- if (pScrn->display->virtualY < tmp_vdisplay)
- pScrn->display->virtualY = tmp_vdisplay;
+ for (i = 0; i < count; i++) {
+ if (sscanf(clone_mode_names[i], "%dx%d",
+ &tmp_hdisplay, &tmp_vdisplay) == 2) {
+ if (pScrn->display->virtualX < tmp_hdisplay)
+ pScrn->display->virtualX = tmp_hdisplay;
+ if (pScrn->display->virtualY < tmp_vdisplay)
+ pScrn->display->virtualY = tmp_vdisplay;
+ }
+ }
save_hsync = pScrn->monitor->hsync[0];
save_vrefresh = pScrn->monitor->vrefresh[0];
@@ -2444,37 +2827,19 @@ static int RADEONValidateCloneModes(Scrn
}
}
- if ((pScrn->monitor->nVrefresh == 0) || (pScrn->monitor->nHsync == 0) ||
- (info->CloneType != MT_CRT) || info->ddc_mode) {
- unsigned int save_ddc_reg;
- save_ddc_reg = info->DDCReg;
- switch (info->CloneDDCType) {
- case DDC_MONID: info->DDCReg = RADEON_GPIO_MONID; break;
- case DDC_DVI: info->DDCReg = RADEON_GPIO_DVI_DDC; break;
- case DDC_VGA: info->DDCReg = RADEON_GPIO_VGA_DDC; break;
- case DDC_CRT2: info->DDCReg = RADEON_GPIO_CRT2_DDC; break;
- default: info->DDCReg = 0; break;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "DDC detection (type %d) for clone modes\n",
- info->CloneDDCType);
-
- pScrn->monitor->DDC = RADEONDoDDC(pScrn, NULL);
- if (pScrn->monitor->DDC) {
- if (info->CloneType == MT_CRT) {
- if (pScrn->monitor->nHsync == 0)
- RADEONSetSyncRangeFromEdid(pScrn, 1);
- if (pScrn->monitor->nVrefresh == 0)
- RADEONSetSyncRangeFromEdid(pScrn, 0);
- }
- } else if (info->ddc_mode) {
- ddc_mode = FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "No DDC data available for clone mode, "
- "DDCMode option is dismissed\n");
- }
- info->DDCReg = save_ddc_reg;
+ pScrn->monitor->DDC = pRADEONEnt->MonInfo2;
+ if (pScrn->monitor->DDC) {
+ if ((pScrn->monitor->nVrefresh == 0) || (pScrn->monitor->nHsync == 0)) {
+ if (pScrn->monitor->nHsync == 0)
+ RADEONSetSyncRangeFromEdid(pScrn, 1);
+ if (pScrn->monitor->nVrefresh == 0)
+ RADEONSetSyncRangeFromEdid(pScrn, 0);
+ }
+ } else if (info->ddc_mode) {
+ ddc_mode = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "No DDC data available for clone mode, "
+ "DDCMode option is dismissed\n");
}
if (info->CloneType == MT_CRT && !ddc_mode) {
@@ -2500,8 +2865,29 @@ static int RADEONValidateCloneModes(Scrn
/* If that fails and we're connect to a flat panel, then try to
* add the flat panel modes
*/
- if (modesFound < 1 && info->DisplayType != MT_CRT)
- modesFound = RADEONValidateFPModes(pScrn, clone_mode_names);
+ if (info->CloneType != MT_CRT) {
+ /* when panel size is not valid, try to validate
+ * mode using xf86ValidateModes routine
+ * This can happen when DDC is disabled.
+ */
+ if (info->PanelXRes < 320 || info->PanelYRes < 200)
+ modesFound =
+ xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ clone_mode_names,
+ clockRanges,
+ NULL, /* linePitches */
+ 8 * 64, /* minPitch */
+ 8 * 1024, /* maxPitch */
+ 64 * pScrn->bitsPerPixel, /* pitchInc */
+ 128, /* minHeight */
+ 2048, /* maxHeight */
+ pScrn->display->virtualX,
+ pScrn->display->virtualY,
+ info->FbMapSize,
+ LOOKUP_BEST_REFRESH);
+ else
+ modesFound = RADEONValidateFPModes(pScrn, clone_mode_names);
+ }
}
if (modesFound > 0) {
@@ -2574,6 +2960,11 @@ static Bool RADEONPreInitModes(ScrnInfoP
#ifndef USE_FB
const char *Sym = NULL;
#endif
+ DevUnion *pPriv;
+ RADEONEntPtr pRADEONEnt;
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gRADEONEntityIndex);
+ pRADEONEnt = pPriv->ptr;
/* This option has two purposes:
*
@@ -2605,6 +2996,10 @@ static Bool RADEONPreInitModes(ScrnInfoP
info->ddc_mode =
xf86ReturnOptValBool(info->Options, OPTION_DDC_MODE, FALSE);
+ /* don't use RMX if we have a dual-tdms panels */
+ if (pRADEONEnt->MonType2 == MT_DFP)
+ info->ddc_mode = TRUE;
+
/* Here is a hack for cloning first display on the second head. If
* we don't do this, when both heads are connected, the same CRTC
* will be used to drive them according to the capability of the
@@ -2646,11 +3041,14 @@ static Bool RADEONPreInitModes(ScrnInfoP
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Validating modes on %s head (DDCType: %d) ---------\n",
- info->IsSecondary ? "Secondary" : "Primary",
- info->DDCType);
+ "Validating modes on %s head ---------\n",
+ info->IsSecondary ? "Secondary" : "Primary");
+
+ if (info->IsSecondary)
+ pScrn->monitor->DDC = pRADEONEnt->MonInfo2;
+ else
+ pScrn->monitor->DDC = pRADEONEnt->MonInfo1;
- pScrn->monitor->DDC = RADEONDoDDC(pScrn, pInt10);
if (!pScrn->monitor->DDC && info->ddc_mode) {
info->ddc_mode = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -2704,19 +3102,20 @@ static Bool RADEONPreInitModes(ScrnInfoP
info->FbMapSize,
LOOKUP_BEST_REFRESH);
+ if (modesFound == -1) return FALSE;
+
if (modesFound < 1 && info->FBDev) {
fbdevHWUseBuildinMode(pScrn);
pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */
modesFound = 1;
}
- if (modesFound == -1) return FALSE;
-
xf86PruneDriverModes(pScrn);
if (!modesFound || !pScrn->modes) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
return FALSE;
}
+
} else {
/* First, free any allocated modes during configuration, since
* we don't need them
@@ -2733,8 +3132,36 @@ static Bool RADEONPreInitModes(ScrnInfoP
/* If that fails and we're connect to a flat panel, then try to
* add the flat panel modes
*/
- if (modesFound < 1 && info->DisplayType != MT_CRT)
- modesFound = RADEONValidateFPModes(pScrn, pScrn->display->modes);
+ if (info->DisplayType != MT_CRT) {
+ /* when panel size is not valid, try to validate
+ * mode using xf86ValidateModes routine
+ * This can happen when DDC is disabled.
+ */
+ if (info->PanelXRes < 320 || info->PanelYRes < 200)
+ modesFound =
+ xf86ValidateModes(pScrn,
+ pScrn->monitor->Modes,
+ pScrn->display->modes,
+ clockRanges,
+ NULL, /* linePitches */
+ 8 * 64, /* minPitch */
+ 8 * 1024, /* maxPitch */
+ 64 * pScrn->bitsPerPixel, /* pitchInc */
+ 128, /* minHeight */
+ 2048, /* maxHeight */
+ pScrn->display->virtualX,
+ pScrn->display->virtualY,
+ info->FbMapSize,
+ LOOKUP_BEST_REFRESH);
+ else
+ modesFound = RADEONValidateFPModes(pScrn, pScrn->display->modes);
+ }
+
+ if (modesFound < 1 && info->FBDev) {
+ fbdevHWUseBuildinMode(pScrn);
+ pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */
+ modesFound = 1;
+ }
/* Fail if we still don't have any valid modes */
if (modesFound < 1) {
@@ -3049,8 +3472,7 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, in
pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
gRADEONEntityIndex);
pRADEONEnt = pPriv->ptr;
- if (pRADEONEnt->BypassSecondary) {
- pRADEONEnt->HasSecondary = FALSE;
+ if (!pRADEONEnt->HasSecondary) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Only one monitor detected, Second screen "
"will NOT be created\n");
@@ -3067,8 +3489,6 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, in
pRADEONEnt = pPriv->ptr;
pRADEONEnt->pPrimaryScrn = pScrn;
- pRADEONEnt->IsDRIEnabled = FALSE;
- pRADEONEnt->BypassSecondary = FALSE;
pRADEONEnt->RestorePrimary = FALSE;
pRADEONEnt->IsSecondaryRestored = FALSE;
}
@@ -3162,18 +3582,11 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, in
if (!RADEONPreInitConfig(pScrn))
goto fail;
-#if !defined(__powerpc__)
- if (!RADEONGetBIOSParameters(pScrn, pInt10))
- goto fail;
-#else
- /* Force type to CRT since we currently can't read BIOS to tell us
- * what kind of heads we have.
- */
- info->DisplayType = MT_CRT;
-#endif
-
RADEONPreInitDDC(pScrn);
+ if (!RADEONGetParameters(pScrn, pInt10))
+ goto fail;
+
if (!RADEONGetPLLParameters(pScrn)) goto fail;
if (!RADEONPreInitGamma(pScrn)) goto fail;
@@ -3378,6 +3791,12 @@ Bool RADEONScreenInit(int scrnIndex, Scr
RADEONInfoPtr info = RADEONPTR(pScrn);
BoxRec MemBox;
int y2;
+ DevUnion *pPriv;
+ RADEONEntPtr pRADEONEnt;
+
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ gRADEONEntityIndex);
+ pRADEONEnt = pPriv->ptr;
RADEONTRACE(("RADEONScreenInit %x %d\n",
pScrn->memPhysBase, pScrn->fbOffset));
@@ -3478,16 +3896,6 @@ Bool RADEONScreenInit(int scrnIndex, Scr
info->directRenderingEnabled =
RADEONDRIScreenInit(pScreen);
}
-
- if (xf86IsEntityShared(pScrn->entityList[0])) {
- DevUnion *pPriv;
- RADEONEntPtr pRADEONEnt;
-
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
- gRADEONEntityIndex);
- pRADEONEnt = pPriv->ptr;
- pRADEONEnt->IsDRIEnabled = info->directRenderingEnabled;
- }
}
}
}
@@ -4018,13 +4436,11 @@ static void RADEONRestoreCrtc2Registers(
OUTREG(RADEON_DISP_OUTPUT_CNTL, restore->disp_output_cntl);
} else {
OUTREG(RADEON_DISP_HW_DEBUG, restore->disp_hw_debug);
- if (info->IsDell) {
- /* Workaround for DELL card. BIOS doesn't initialize
- * TV_DAC_CNTL to a correct value which causes too high
- * contrast for the second CRT (using TV_DAC).
- */
- OUTREG(0x88c, 0x00280203);
- }
+
+ /* BIOS may not initialize TV_DAC_CNTL to a
+ * correct value.
+ */
+ OUTREG(RADEON_TV_DAC_CNTL, 0x00880213);
}
OUTREG(RADEON_CRTC2_H_TOTAL_DISP, restore->crtc2_h_total_disp);
@@ -4059,11 +4475,13 @@ static void RADEONRestoreFPRegisters(Scr
OUTREG(RADEON_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid);
OUTREG(RADEON_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid);
OUTREG(RADEON_TMDS_PLL_CNTL, restore->tmds_pll_cntl);
+ OUTREG(RADEON_TMDS_TRANSMITTER_CNTL,restore->tmds_transmitter_cntl);
OUTREG(RADEON_FP_HORZ_STRETCH, restore->fp_horz_stretch);
OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch);
OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl);
- if (info->DisplayType == MT_LCD) {
+ if (info->DisplayType != MT_DFP) {
+ OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
tmp = INREG(RADEON_LVDS_GEN_CNTL);
if ((tmp & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) ==
(restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) {
@@ -4079,6 +4497,8 @@ static void RADEONRestoreFPRegisters(Scr
OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl);
}
}
+ usleep (20000);
+ OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, RADEON_PIXCLK_LVDS_ALWAYS_ONb, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
}
}
@@ -4299,10 +4719,7 @@ static void RADEONRestoreMode(ScrnInfoPt
if (!info->HasCRTC2) {
RADEONRestoreCommonRegisters(pScrn, restore);
RADEONRestoreCrtcRegisters(pScrn, restore);
- if ((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD)) {
- RADEONRestoreFPRegisters(pScrn, restore);
- }
+ RADEONRestoreFPRegisters(pScrn, restore);
RADEONRestorePLLRegisters(pScrn, restore);
return;
}
@@ -4322,7 +4739,7 @@ static void RADEONRestoreMode(ScrnInfoPt
* we may get a blank screen.
*/
if (info->IsSecondary) {
- if (!pRADEONEnt->RestorePrimary)
+ if (!pRADEONEnt->RestorePrimary && !info->IsSwitching)
RADEONRestoreCommonRegisters(pScrn, restore);
RADEONRestoreCrtc2Registers(pScrn, restore);
RADEONRestorePLL2Registers(pScrn, restore);
@@ -4332,18 +4749,13 @@ static void RADEONRestoreMode(ScrnInfoPt
pRADEONEnt->IsSecondaryRestored = TRUE;
if (pRADEONEnt->RestorePrimary) {
- RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn);
pRADEONEnt->RestorePrimary = FALSE;
RADEONRestoreCrtcRegisters(pScrn, &restore0);
- if ((info0->DisplayType == MT_DFP) ||
- (info0->DisplayType == MT_LCD)) {
- RADEONRestoreFPRegisters(pScrn, &restore0);
- }
-
+ RADEONRestoreFPRegisters(pScrn, &restore0);
RADEONRestorePLLRegisters(pScrn, &restore0);
pRADEONEnt->IsSecondaryRestored = FALSE;
- }
+ }
} else {
if (!pRADEONEnt->IsSecondaryRestored)
RADEONRestoreCommonRegisters(pScrn, restore);
@@ -4358,10 +4770,7 @@ static void RADEONRestoreMode(ScrnInfoPt
pRADEONEnt->IsSecondaryRestored = FALSE;
RADEONRestoreCrtcRegisters(pScrn, restore);
- if ((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD)) {
- RADEONRestoreFPRegisters(pScrn, restore);
- }
+ RADEONRestoreFPRegisters(pScrn, restore);
RADEONRestorePLLRegisters(pScrn, restore);
} else {
memcpy(&restore0, restore, sizeof(restore0));
@@ -4450,6 +4859,8 @@ static void RADEONSaveFPRegisters(ScrnIn
save->lvds_gen_cntl = INREG(RADEON_LVDS_GEN_CNTL);
save->lvds_pll_cntl = INREG(RADEON_LVDS_PLL_CNTL);
save->tmds_pll_cntl = INREG(RADEON_TMDS_PLL_CNTL);
+ save->tmds_transmitter_cntl= INREG(RADEON_TMDS_TRANSMITTER_CNTL);
+
}
/* Read CRTC2 registers */
@@ -4544,11 +4955,7 @@ static void RADEONSaveMode(ScrnInfoPtr p
RADEONSavePLLRegisters(pScrn, save);
RADEONSaveCommonRegisters(pScrn, save);
RADEONSaveCrtcRegisters(pScrn, save);
-
- if ((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD)) {
- RADEONSaveFPRegisters(pScrn, save);
- }
+ RADEONSaveFPRegisters(pScrn, save);
if (info->Clone) {
RADEONSaveCrtc2Registers(pScrn, save);
@@ -4902,19 +5310,16 @@ static Bool RADEONInitCrtc2Registers(Scr
| RADEON_DISP_DAC_SOURCE_CRTC2);
} else {
save->disp_hw_debug = info->SavedReg.disp_hw_debug;
- if (info->IsDell && info->DellType == 2) {
- if (info->DisplayType == MT_CRT || info->CloneType == MT_CRT) {
- /* Turn on 2nd CRT */
- save->dac2_cntl &= ~RADEON_DAC2_DAC_CLK_SEL;
- save->dac2_cntl |= RADEON_DAC2_DAC2_CLK_SEL;
- save->disp_hw_debug &= ~RADEON_CRT2_DISP1_SEL;
-
- /* This will make 2nd CRT stay on in console */
- info->SavedReg.dac2_cntl = save->dac2_cntl;
- info->SavedReg.disp_hw_debug |= RADEON_CRT2_DISP1_SEL;
- info->SavedReg.crtc2_gen_cntl |= RADEON_CRTC2_CRT2_ON;
- }
- } else save->dac2_cntl |= RADEON_DAC2_DAC_CLK_SEL;
+
+ /* Turn on 2nd CRT */
+ save->dac2_cntl |= (RADEON_DAC2_DAC2_CLK_SEL | RADEON_DAC2_DAC_CLK_SEL);
+ save->disp_hw_debug |= RADEON_CRT2_DISP1_SEL;
+
+ /* This will make 2nd CRT stay on in console */
+ info->SavedReg.dac2_cntl &= ~RADEON_DAC2_DAC_CLK_SEL;
+ info->SavedReg.dac2_cntl |= RADEON_DAC2_DAC2_CLK_SEL;
+ info->SavedReg.disp_hw_debug |= RADEON_CRT2_DISP1_SEL;
+ info->SavedReg.crtc2_gen_cntl |= RADEON_CRTC2_CRT2_ON;
}
save->crtc2_h_total_disp =
@@ -5008,6 +5413,36 @@ static void RADEONInitFPRegisters(ScrnIn
int yres = mode->VDisplay;
float Hratio, Vratio;
+ /* If the FP registers have been initialized before for a panel,
+ * but the primary port is a CRT, we need to reinitialize
+ * FP registers in order for CRT to work properly
+ */
+
+ if ((info->DisplayType != MT_DFP) && (info->DisplayType != MT_LCD)) {
+ save->fp_crtc_h_total_disp = orig->fp_crtc_h_total_disp;
+ save->fp_crtc_v_total_disp = orig->fp_crtc_v_total_disp;
+ save->fp_gen_cntl = 0;
+ save->fp_h_sync_strt_wid = orig->fp_h_sync_strt_wid;
+ save->fp_horz_stretch = 0;
+ save->fp_v_sync_strt_wid = orig->fp_v_sync_strt_wid;
+ save->fp_vert_stretch = 0;
+ save->lvds_gen_cntl = orig->lvds_gen_cntl;
+ save->lvds_pll_cntl = orig->lvds_pll_cntl;
+ save->tmds_pll_cntl = orig->tmds_pll_cntl;
+ save->tmds_transmitter_cntl= orig->tmds_transmitter_cntl;
+ /* Try to turn panel off.
+ * LCD off still has some problem:
+ * In principle, turning LVDS_ON off should do it. But it causes
+ * blooming on some panels, not sure why. Here just a workaround
+ * for blanking it, also may not work on certain panels
+ */
+ save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_DISPLAY_DIS | (1 << 23));
+ save->lvds_gen_cntl &= ~(RADEON_LVDS_BLON);
+ save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN);
+
+ return;
+ }
+
if (info->PanelXRes == 0 || info->PanelYRes == 0) {
Hratio = 1.0;
Vratio = 1.0;
@@ -5110,8 +5545,20 @@ static void RADEONInitFPRegisters(ScrnIn
if (info->DisplayType == MT_LCD) {
save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_BLON);
save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN);
- } else if (info->DisplayType == MT_DFP)
+ } else if (info->DisplayType == MT_DFP) {
+ /* This is needed for some panel at high resolution (>=1600x1200)
+ */
+ if ((save->dot_clock_freq > 15000) && (info->ChipFamily != CHIP_FAMILY_R300))
+ save->tmds_pll_cntl = 0xA3F;
+
+ save->tmds_transmitter_cntl &= ~(RADEON_TMDS_TRANSMITTER_PLLRST);
+ if ((info->ChipFamily == CHIP_FAMILY_R300) || (info->ChipFamily == CHIP_FAMILY_R200))
+ save->tmds_transmitter_cntl &= ~(RADEON_TMDS_TRANSMITTER_PLLEN);
+ else /* weird, RV chips got this bit reversed? */
+ save->tmds_transmitter_cntl |= (RADEON_TMDS_TRANSMITTER_PLLEN);
+
save->fp_gen_cntl |= (RADEON_FP_FPON | RADEON_FP_TMDS_EN);
+ }
}
save->fp_crtc_h_total_disp = save->crtc_h_total_disp;
@@ -5335,10 +5782,7 @@ static Bool RADEONInit(ScrnInfoPtr pScrn
/* if (!info->PaletteSavedOnVT) RADEONInitPalette(save); */
}
- if (((info->DisplayType == MT_DFP) ||
- (info->DisplayType == MT_LCD))) {
- RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info);
- }
+ RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info);
RADEONTRACE(("RADEONInit returns %p\n", save));
return TRUE;
Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v
retrieving revision 1.13
diff -p -u -r1.13 radeon_probe.c
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c 22 Oct 2002 23:38:42 -0000 1.13
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c 6 Jan 2003 20:52:37 -0000
@@ -255,20 +255,17 @@ RADEONProbe(DriverPtr drv, int flags)
pEnt = xf86GetEntityInfo(usedChips[i]);
- /* All Radeon chips except the original ones support
- * Dual-Head, mark the entity as sharable.
- */
- if (pEnt->chipset != PCI_CHIP_RADEON_QD &&
- pEnt->chipset != PCI_CHIP_RADEON_QE &&
- pEnt->chipset != PCI_CHIP_RADEON_QF &&
- pEnt->chipset != PCI_CHIP_RADEON_QG) {
+ /* create a RADEONEntity for all chips, even with
+ old single head Radeon, need to use pRADEONEnt
+ for new monitor detection routines
+ */
+ {
static int instance = 0;
DevUnion *pPriv;
xf86SetEntitySharable(usedChips[i]);
xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0],
instance);
-
if (gRADEONEntityIndex < 0) {
gRADEONEntityIndex = xf86AllocateEntityPrivateIndex();
pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
@@ -279,8 +276,6 @@ RADEONProbe(DriverPtr drv, int flags)
pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1);
pRADEONEnt = pPriv->ptr;
- pRADEONEnt->IsDRIEnabled = FALSE;
- pRADEONEnt->BypassSecondary = FALSE;
pRADEONEnt->HasSecondary = FALSE;
pRADEONEnt->IsSecondaryRestored = FALSE;
}
Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v
retrieving revision 1.7
diff -p -u -r1.7 radeon_probe.h
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h 22 Oct 2002 23:38:42 -0000 1.7
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h 6 Jan 2003 20:52:37 -0000
@@ -38,15 +38,14 @@
#define _RADEON_PROBE_H_ 1
#include "atiproto.h"
-
#include "xf86str.h"
+#include "xf86DDC.h"
typedef struct
{
Bool IsDRIEnabled;
Bool HasSecondary;
- Bool BypassSecondary;
/*
* The next two are used to make sure CRTC2 is restored before CRTC_EXT,
@@ -57,6 +56,13 @@ typedef struct
ScrnInfoPtr pSecondaryScrn;
ScrnInfoPtr pPrimaryScrn;
+
+
+ int MonType1;
+ int MonType2;
+ xf86MonPtr MonInfo1;
+ xf86MonPtr MonInfo2;
+
} RADEONEntRec, *RADEONEntPtr;
/* radeon_probe.c */
Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v
retrieving revision 1.25
diff -p -u -r1.25 radeon_reg.h
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h 5 Dec 2002 16:36:31 -0000 1.25
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h 6 Jan 2003 20:52:44 -0000
@@ -348,7 +348,10 @@
#define RADEON_DAC_CNTL 0x0058
# define RADEON_DAC_RANGE_CNTL (3 << 0)
+# define RADEON_DAC_RANGE_CNTL_MASK 0x03
# define RADEON_DAC_BLANKING (1 << 2)
+# define RADEON_DAC_CMP_EN (1 << 3)
+# define RADEON_DAC_CMP_OUTPUT (1 << 7)
# define RADEON_DAC_8BIT_EN (1 << 8)
# define RADEON_DAC_VGA_ADR_EN (1 << 13)
# define RADEON_DAC_PDWN (1 << 15)
@@ -357,6 +360,12 @@
# define RADEON_DAC2_DAC_CLK_SEL (1 << 0)
# define RADEON_DAC2_DAC2_CLK_SEL (1 << 1)
# define RADEON_DAC2_PALETTE_ACC_CTL (1 << 5)
+#define RADEON_DAC_EXT_CNTL 0x0280
+# define RADEON_DAC_FORCE_BLANK_OFF_EN (1 << 4)
+# define RADEON_DAC_FORCE_DATA_EN (1 << 5)
+# define RADEON_DAC_FORCE_DATA_SEL_MASK (3 << 6)
+# define RADEON_DAC_FORCE_DATA_MASK 0x0003ff00
+# define RADEON_DAC_FORCE_DATA_SHIFT 8
#define RADEON_TV_DAC_CNTL 0x088c
# define RADEON_TV_DAC_STD_MASK 0x0300
# define RADEON_TV_DAC_RDACPD (1 << 24)
@@ -384,6 +393,21 @@
#define RADEON_DEVICE_ID 0x0f02 /* PCI */
#define RADEON_DISP_MISC_CNTL 0x0d00
# define RADEON_SOFT_RESET_GRPH_PP (1 << 0)
+#define RADEON_DISP_MERGE_CNTL 0x0d60
+# define RADEON_DISP_ALPHA_MODE_MASK 0x03
+# define RADEON_DISP_ALPHA_MODE_KEY 0
+# define RADEON_DISP_ALPHA_MODE_PER_PIXEL 1
+# define RADEON_DISP_ALPHA_MODE_GLOBAL 2
+# define RADEON_DISP_GRPH_ALPHA_MASK (0xff << 16)
+# define RADEON_DISP_OV0_ALPHA_MASK (0xff << 24)
+# define RADEON_DISP_LIN_TRANS_BYPASS (0x01 << 9)
+#define RADEON_DISP_LIN_TRANS_GRPH_A 0x0d80
+#define RADEON_DISP_LIN_TRANS_GRPH_B 0x0d84
+#define RADEON_DISP_LIN_TRANS_GRPH_C 0x0d88
+#define RADEON_DISP_LIN_TRANS_GRPH_D 0x0d8c
+#define RADEON_DISP_LIN_TRANS_GRPH_E 0x0d90
+#define RADEON_DISP_LIN_TRANS_GRPH_F 0x0d98
+
#define RADEON_DP_BRUSH_BKGD_CLR 0x1478
#define RADEON_DP_BRUSH_FRGD_CLR 0x147c
#define RADEON_DP_CNTL 0x16c0
@@ -874,6 +899,12 @@
# define RADEON_PIX2CLK_SRC_SEL_PSCANCLK 0x01
# define RADEON_PIX2CLK_SRC_SEL_BYTECLK 0x02
# define RADEON_PIX2CLK_SRC_SEL_P2PLLCLK 0x03
+# define RADEON_PIX2CLK_ALWAYS_ONb (1<<6)
+# define RADEON_PIX2CLK_DAC_ALWAYS_ONb (1<<7)
+# define RADEON_PIXCLK_TV_SRC_SEL (1 << 8)
+# define RADEON_PIXCLK_LVDS_ALWAYS_ONb (1 << 14)
+# define RADEON_PIXCLK_TMDS_ALWAYS_ONb (1 << 15)
+
#define RADEON_PLANE_3D_MASK_C 0x1d44
#define RADEON_PLL_TEST_CNTL 0x0013 /* PLL */
#define RADEON_PMI_CAP_ID 0x0f5c /* PCI */
@@ -996,6 +1027,9 @@
#define RADEON_TEST_DEBUG_MUX 0x0124
#define RADEON_TEST_DEBUG_OUT 0x012c
#define RADEON_TMDS_PLL_CNTL 0x02a8
+#define RADEON_TMDS_TRANSMITTER_CNTL 0x02a4
+# define RADEON_TMDS_TRANSMITTER_PLLEN 1
+# define RADEON_TMDS_TRANSMITTER_PLLRST 2
#define RADEON_TRAIL_BRES_DEC 0x1614
#define RADEON_TRAIL_BRES_ERR 0x160c
#define RADEON_TRAIL_BRES_INC 0x1610
@@ -1008,6 +1042,9 @@
# define RADEON_VCLK_SRC_SEL_PSCANCLK 0x01
# define RADEON_VCLK_SRC_SEL_BYTECLK 0x02
# define RADEON_VCLK_SRC_SEL_PPLLCLK 0x03
+# define RADEON_PIXCLK_ALWAYS_ONb (1<<6)
+# define RADEON_PIXCLK_DAC_ALWAYS_ONb (1<<7)
+
#define RADEON_VENDOR_ID 0x0f00 /* PCI */
#define RADEON_VGA_DDA_CONFIG 0x02e8
#define RADEON_VGA_DDA_ON_OFF 0x02ec
@@ -1977,5 +2018,18 @@
#define RADEON_SS_HORZ_GUARD_CLIP_ADJ_ADDR 50
#define RADEON_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 51
#define RADEON_SS_SHININESS 60
+
+#define RADEON_TV_MASTER_CNTL 0x0800
+# define RADEON_TVCLK_ALWAYS_ONb (1 << 30)
+#define RADEON_TV_DAC_CNTL 0x088c
+# define RADEON_TV_DAC_CMPOUT (1 << 5)
+#define RADEON_TV_PRE_DAC_MUX_CNTL 0x0888
+# define RADEON_Y_RED_EN (1 << 0)
+# define RADEON_C_GRN_EN (1 << 1)
+# define RADEON_CMP_BLU_EN (1 << 2)
+# define RADEON_RED_MX_FORCE_DAC_DATA (6 << 4)
+# define RADEON_GRN_MX_FORCE_DAC_DATA (6 << 8)
+# define RADEON_BLU_MX_FORCE_DAC_DATA (6 << 12)
+# define RADEON_TV_FORCE_DAC_DATA_SHIFT 16
#endif