From 870c8043068a0f44b53d1148371b2cc1e3970a7b Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sun, 20 May 2007 21:03:10 -0400 Subject: RADEON: several updates - move output init from InitCrtc() functions to the output mode_set() - take the crtc off the MC when blanking - move EnableDisplay() to output commit() - clean up some dead code - don't enable dacs in initcrtc() functions, this is taken care of in EnableDisplay() --- src/radeon_crtc.c | 4 ++-- src/radeon_driver.c | 28 +++++----------------------- src/radeon_output.c | 15 ++++++++++++--- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index 1047dcf..5d7237c 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -58,7 +58,7 @@ radeon_crtc_dpms(xf86CrtcPtr crtc, int mode) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - mask = radeon_crtc->crtc_id ? (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS) : (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS); + mask = radeon_crtc->crtc_id ? (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS | RADEON_CRTC2_DISP_REQ_EN_B) : (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_DISP_REQ_EN_B); switch(mode) { @@ -129,7 +129,7 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, montype = radeon_output->MonType; } } - + ErrorF("init memmap\n"); RADEONInitMemMapRegisters(pScrn, &info->ModeReg, info); ErrorF("init common\n"); diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 91bb7b1..6409a6b 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -5292,10 +5292,11 @@ static void RADEONInitDAC2Registers(xf86OutputPtr output, RADEONSavePtr save, } } -static void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, DisplayModePtr mode, xf86OutputPtr output, int crtc_num) +void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, DisplayModePtr mode, xf86OutputPtr output, int crtc_num) { - Bool IsPrimary = crtc_num == 1 ? TRUE : FALSE; + Bool IsPrimary = crtc_num == 0 ? TRUE : FALSE; RADEONOutputPrivatePtr radeon_output = output->driver_private; + if (radeon_output->MonType == MT_CRT) { if (radeon_output->DACType == DAC_PRIMARY) { RADEONInitDACRegisters(output, save, mode, IsPrimary); @@ -5303,11 +5304,11 @@ static void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, Dis RADEONInitDAC2Registers(output, save, mode, IsPrimary); } } else if (radeon_output->MonType == MT_LCD) { - if (crtc_num == 1) + if (crtc_num == 0) RADEONInitRMXRegisters(output, save, mode); RADEONInitLVDSRegisters(output, save, mode, IsPrimary); } else if (radeon_output->MonType == MT_DFP) { - if (crtc_num == 1) + if (crtc_num == 0) RADEONInitRMXRegisters(output, save, mode); if (radeon_output->TMDSType == TMDS_INT) { RADEONInitFPRegisters(output, save, mode, IsPrimary); @@ -5366,7 +5367,6 @@ Bool RADEONInitCrtcRegisters(xf86CrtcPtr crtc, RADEONSavePtr save, : 0)); save->crtc_ext_cntl |= (RADEON_XCRT_CNT_EN| - RADEON_CRTC_CRT_ON | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_DISPLAY_DIS); @@ -5458,15 +5458,6 @@ Bool RADEONInitCrtcRegisters(xf86CrtcPtr crtc, RADEONSavePtr save, save->fp_crtc_h_total_disp = save->crtc_h_total_disp; save->fp_crtc_v_total_disp = save->crtc_v_total_disp; - - /* get the output connected to this CRTC */ - for (i = 0; i < xf86_config->num_output; i++) { - xf86OutputPtr output = xf86_config->output[i]; - if (output->crtc == crtc) { - RADEONInitOutputRegisters(pScrn, save, mode, output, 1); - } - } - Base = pScrn->fbOffset; if (info->tilingEnabled) { @@ -5649,7 +5640,6 @@ Bool RADEONInitCrtc2Registers(xf86CrtcPtr crtc, RADEONSavePtr save, save->crtc2_pitch |= save->crtc2_pitch << 16; save->crtc2_gen_cntl = (RADEON_CRTC2_EN - | RADEON_CRTC2_CRT2_ON | (format << 8) | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS @@ -5670,14 +5660,6 @@ Bool RADEONInitCrtc2Registers(xf86CrtcPtr crtc, RADEONSavePtr save, save->fp_h2_sync_strt_wid = save->crtc2_h_sync_strt_wid; save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid; - /* get the output connected to this CRTC */ - for (i = 0; i < xf86_config->num_output; i++) { - xf86OutputPtr output = xf86_config->output[i]; - if (output->crtc == crtc) { - RADEONInitOutputRegisters(pScrn, save, mode, output, 2); - } - } - Base = pScrn->fbOffset; if (info->tilingEnabled) { diff --git a/src/radeon_output.c b/src/radeon_output.c index a52b1fc..c2bebf0 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -215,13 +215,11 @@ radeon_dpms(xf86OutputPtr output, int mode) switch(mode) { case DPMSModeOn: RADEONEnableDisplay(output, TRUE); - /* RADEONDPMSSetOn(output);*/ break; case DPMSModeOff: case DPMSModeSuspend: case DPMSModeStandby: RADEONEnableDisplay(output, FALSE); - /*RADEONDPMSSetOff(output);*/ break; } } @@ -299,7 +297,18 @@ radeon_mode_set(xf86OutputPtr output, DisplayModePtr mode, { ScrnInfoPtr pScrn = output->scrn; RADEONInfoPtr info = RADEONPTR(pScrn); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); RADEONOutputPrivatePtr radeon_output = output->driver_private; + int i; + + /* get the outputs connected to this CRTC */ + for (i = 0; i < xf86_config->num_crtc; i++) { + xf86CrtcPtr crtc = xf86_config->crtc[i]; + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + if (output->crtc == crtc) { + RADEONInitOutputRegisters(pScrn, &info->ModeReg, adjusted_mode, output, radeon_crtc->crtc_id); + } + } switch(radeon_output->MonType) { case MT_LCD: @@ -312,12 +321,12 @@ radeon_mode_set(xf86OutputPtr output, DisplayModePtr mode, RADEONRestoreDACRegisters(pScrn, &info->ModeReg); } - RADEONEnableDisplay(output, TRUE); } static void radeon_mode_commit(xf86OutputPtr output) { + RADEONEnableDisplay(output, TRUE); } static xf86OutputStatus -- cgit v1.2.3