summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-14 15:47:52 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-14 15:47:52 -0200
commit5b8583fc2e5626ed98877858158d9687d7c94469 (patch)
treee68d583f03a7677eebe375d17a6ada94260819bf
parentffb4be763ced82158a3a1d2e06fb0e81815e057b (diff)
Be more liberal about mode width validation.
The code was inherited from first import of latest smi sources, but the driver actually programs a mode, so there is no need to check if there will be a table entry with register contents matching the requested mode.
-rw-r--r--src/smi501_crtc.c6
-rw-r--r--src/smi_output.c19
2 files changed, 8 insertions, 17 deletions
diff --git a/src/smi501_crtc.c b/src/smi501_crtc.c
index 54152fc..3fc0912 100644
--- a/src/smi501_crtc.c
+++ b/src/smi501_crtc.c
@@ -65,8 +65,7 @@ SMI501_CrtcVideoInit_lcd(xf86CrtcPtr crtc)
mode->panel_fb_width.f.offset = pitch >> 4;
mode->panel_fb_width.f.width = width >> 4;
- if (pSmi->Bpp > 1)
- mode->panel_display_ctl.f.gamma = 1;
+ mode->panel_display_ctl.f.gamma = pSmi->Bpp > 1;
WRITE_SCR(pSmi, PANEL_DISPLAY_CTL, mode->panel_display_ctl.value);
WRITE_SCR(pSmi, PANEL_FB_WIDTH, mode->panel_fb_width.value);
@@ -100,8 +99,7 @@ SMI501_CrtcVideoInit_crt(xf86CrtcPtr crtc)
mode->crt_fb_width.f.offset = pitch >> 4;
mode->crt_fb_width.f.width = width >> 4;
- if (pSmi->Bpp > 1)
- mode->crt_display_ctl.f.gamma = 1;
+ mode->crt_display_ctl.f.gamma = pSmi->Bpp > 1;
WRITE_SCR(pSmi, CRT_DISPLAY_CTL, mode->crt_display_ctl.value);
WRITE_SCR(pSmi, CRT_FB_WIDTH, mode->crt_fb_width.value);
diff --git a/src/smi_output.c b/src/smi_output.c
index f07f64e..8487db0 100644
--- a/src/smi_output.c
+++ b/src/smi_output.c
@@ -63,21 +63,14 @@ SMI_OutputModeValid(xf86OutputPtr output, DisplayModePtr mode)
(mode->HDisplay != pSmi->lcdWidth || mode->VDisplay != pSmi->lcdHeight))
RETURN(MODE_PANEL);
- if (!(((mode->HDisplay == 1280) && (mode->VDisplay == 1024)) ||
- ((mode->HDisplay == 1024) && (mode->VDisplay == 768)) ||
- ((mode->HDisplay == 800) && (mode->VDisplay == 600)) ||
- ((mode->HDisplay == 640) && (mode->VDisplay == 480)) ||
- ((mode->HDisplay == 320) && (mode->VDisplay == 240)) ||
- ((mode->HDisplay == 400) && (mode->VDisplay == 300)) ||
- ((mode->HDisplay == 1280) && (mode->VDisplay == 960)) ||
- ((mode->HDisplay == 1280) && (mode->VDisplay == 768)) ||
- ((mode->HDisplay == 1024) && (mode->VDisplay == 600)) ||
- ((mode->HDisplay == 800) && (mode->VDisplay == 480)) ||
- ((mode->HDisplay == 720) && (mode->VDisplay == 540)) ||
- ((mode->HDisplay == 720) && (mode->VDisplay == 480))))
+ /* The driver is actually programming modes, instead of loading registers
+ * state from static tables. But still, only accept modes that should
+ * be handled correctly by all hardwares. On the MSOC, currently, only
+ * the crt can be programmed to different resolution modes.
+ */
+ if (mode->HDisplay & 15)
RETURN(MODE_BAD_WIDTH);
-
if((mode->Clock < pSmi->clockRange.minClock) ||
(mode->Clock > pSmi->clockRange.maxClock) ||
((mode->Flags & V_INTERLACE) && !pSmi->clockRange.interlaceAllowed) ||