diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-09-26 19:43:45 -0300 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-09-26 19:43:45 -0300 |
commit | e830572bca9b8eaf50a36a12d1fe31cdfec6280e (patch) | |
tree | 6a81c3ddc98a4df2194053aaa4db2018ef65447f | |
parent | 314eecb6628840a942ff2e76d8c7402301feac77 (diff) |
Don't always program CRT clock and registers.
This causes instabilities, and there was also a bug where it would
tell the crt to not select panel data (due to removing the "else").
-rw-r--r-- | src/smi_501.c | 111 |
1 files changed, 57 insertions, 54 deletions
diff --git a/src/smi_501.c b/src/smi_501.c index 273e6ab..c5551d6 100644 --- a/src/smi_501.c +++ b/src/smi_501.c @@ -390,56 +390,57 @@ SMI501_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr xf86mode) field(mode->panel_vsync, height) = xf86mode->VSyncEnd - xf86mode->VSyncStart; } - + else { #ifdef CALC_CLOCK - (void)SMI501_FindClock(xf86ModeBandwidth(xf86mode, pScrn->depth), - FALSE, - &x2_select, &x2_divider, &x2_shift); - field(mode->clock, v2_select) = x2_select; - field(mode->clock, v2_divider) = x2_divider; - field(mode->clock, v2_shift) = x2_shift; + (void)SMI501_FindClock(xf86ModeBandwidth(xf86mode, pScrn->depth), + FALSE, + &x2_select, &x2_divider, &x2_shift); + field(mode->clock, v2_select) = x2_select; + field(mode->clock, v2_divider) = x2_divider; + field(mode->clock, v2_shift) = x2_shift; #else - field(mode->clock, v2_select) = 1; /* 336 */ - field(mode->clock, v2_divider) = 0; /* 1 */ - field(mode->clock, v2_shift) = 0; /* 0 */ + field(mode->clock, v2_select) = 1; /* 336 */ + field(mode->clock, v2_divider) = 0; /* 1 */ + field(mode->clock, v2_shift) = 0; /* 0 */ #endif - field(mode->crt_display_ctl, format) = - pScrn->bitsPerPixel == 8 ? 0 : - pScrn->bitsPerPixel == 16 ? 1 : 2; + field(mode->crt_display_ctl, format) = + pScrn->bitsPerPixel == 8 ? 0 : + pScrn->bitsPerPixel == 16 ? 1 : 2; - /* 0: select panel - 1: select crt */ - field(mode->crt_display_ctl, select) = 1; - field(mode->crt_display_ctl, enable) = 1; + /* 0: select panel - 1: select crt */ + field(mode->crt_display_ctl, select) = 1; + field(mode->crt_display_ctl, enable) = 1; - /* FIXME if non clone dual head, and secondary, need to - * properly set crt fb address ... */ - field(mode->crt_fb_address, address) = 0; - field(mode->crt_fb_address, mextern) = 0; /* local memory */ - field(mode->crt_fb_address, pending) = 0; /* FIXME required? */ + /* FIXME if non clone dual head, and secondary, need to + * properly set crt fb address ... */ + field(mode->crt_fb_address, address) = 0; + field(mode->crt_fb_address, mextern) = 0; /* local memory */ + field(mode->crt_fb_address, pending) = 0; /* FIXME required? */ - /* >> 4 because of the "unused bits" that should be set to 0 */ - /* FIXME this should be used for virtual size? */ - field(mode->crt_fb_width, offset) = pSmi->Stride >> 4; - field(mode->crt_fb_width, width) = pSmi->Stride >> 4; + /* >> 4 because of the "unused bits" that should be set to 0 */ + /* FIXME this should be used for virtual size? */ + field(mode->crt_fb_width, offset) = pSmi->Stride >> 4; + field(mode->crt_fb_width, width) = pSmi->Stride >> 4; - /* 0 means pulse high */ - field(mode->crt_display_ctl, hsync) = !(xf86mode->Flags & V_PHSYNC); - field(mode->crt_display_ctl, vsync) = !(xf86mode->Flags & V_PVSYNC); + /* 0 means pulse high */ + field(mode->crt_display_ctl, hsync) = !(xf86mode->Flags & V_PHSYNC); + field(mode->crt_display_ctl, vsync) = !(xf86mode->Flags & V_PVSYNC); - field(mode->crt_htotal, total) = xf86mode->HTotal - 1; - field(mode->crt_htotal, end) = xf86mode->HDisplay - 1; + field(mode->crt_htotal, total) = xf86mode->HTotal - 1; + field(mode->crt_htotal, end) = xf86mode->HDisplay - 1; - field(mode->crt_hsync, start) = xf86mode->HSyncStart; - field(mode->crt_hsync, width) = xf86mode->HSyncEnd - - xf86mode->HSyncStart; + field(mode->crt_hsync, start) = xf86mode->HSyncStart; + field(mode->crt_hsync, width) = xf86mode->HSyncEnd - + xf86mode->HSyncStart; - field(mode->crt_vtotal, total) = xf86mode->VTotal - 1; - field(mode->crt_vtotal, end) = xf86mode->VDisplay - 1; + field(mode->crt_vtotal, total) = xf86mode->VTotal - 1; + field(mode->crt_vtotal, end) = xf86mode->VDisplay - 1; - field(mode->crt_vsync, start) = xf86mode->HSyncStart; - field(mode->crt_vsync, height) = xf86mode->HSyncEnd - - xf86mode->HSyncStart; + field(mode->crt_vsync, start) = xf86mode->HSyncStart; + field(mode->crt_vsync, height) = xf86mode->HSyncEnd - + xf86mode->HSyncStart; + } SMI501_ModeSet(pScrn, mode); @@ -483,12 +484,13 @@ SMI501_ModeSet(ScrnInfoPtr pScrn, MSOCRegPtr mode) field(clock, p2_shift) = field(mode->clock, p2_shift); SMI501_SetClock(pSmi, mode->current_clock, pll, clock.value); } - - field(clock, v2_select) = field(mode->clock, v2_select); - pll = clock.value; - field(clock, v2_divider) = field(mode->clock, v2_divider); - field(clock, v2_shift) = field(mode->clock, v2_shift); - SMI501_SetClock(pSmi, mode->current_clock, pll, clock.value); + else { + field(clock, v2_select) = field(mode->clock, v2_select); + pll = clock.value; + field(clock, v2_divider) = field(mode->clock, v2_divider); + field(clock, v2_shift) = field(mode->clock, v2_shift); + SMI501_SetClock(pSmi, mode->current_clock, pll, clock.value); + } WRITE_SCR(pSmi, MISC_CTL, mode->misc_ctl.value); @@ -533,17 +535,18 @@ SMI501_ModeSet(ScrnInfoPtr pScrn, MSOCRegPtr mode) field(mode->crt_display_ctl, select) = 0; WRITE_SCR(pSmi, CRT_DISPLAY_CTL, mode->crt_display_ctl.value); } + else { + WRITE_SCR(pSmi, CRT_FB_ADDRESS, mode->crt_fb_address.value); + WRITE_SCR(pSmi, CRT_FB_WIDTH, mode->crt_fb_width.value); + WRITE_SCR(pSmi, CRT_HTOTAL, mode->crt_htotal.value); + WRITE_SCR(pSmi, CRT_HSYNC, mode->crt_hsync.value); + WRITE_SCR(pSmi, CRT_VTOTAL, mode->crt_vtotal.value); + WRITE_SCR(pSmi, CRT_VSYNC, mode->crt_vsync.value); + WRITE_SCR(pSmi, CRT_DISPLAY_CTL, mode->crt_display_ctl.value); - WRITE_SCR(pSmi, CRT_FB_ADDRESS, mode->crt_fb_address.value); - WRITE_SCR(pSmi, CRT_FB_WIDTH, mode->crt_fb_width.value); - WRITE_SCR(pSmi, CRT_HTOTAL, mode->crt_htotal.value); - WRITE_SCR(pSmi, CRT_HSYNC, mode->crt_hsync.value); - WRITE_SCR(pSmi, CRT_VTOTAL, mode->crt_vtotal.value); - WRITE_SCR(pSmi, CRT_VSYNC, mode->crt_vsync.value); - WRITE_SCR(pSmi, CRT_DISPLAY_CTL, mode->crt_display_ctl.value); - - /* Turn CRT on */ - SMI501_DisplayPowerManagementSet(pScrn, DPMSModeOn, 0); + /* Turn CRT on */ + SMI501_DisplayPowerManagementSet(pScrn, DPMSModeOn, 0); + } WRITE_SCR(pSmi, POWER_CTL, mode->power_ctl.value); |