From bcafdfbed6f1e1f901c2459f60f94a0da506bd90 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 13 Feb 2009 14:06:07 -0500 Subject: [PATCH] RANDR: Validate entire mode list for interlace and doublescan Otherwise drivers have to refuse interlace twice: once in the output config, and once in ->valid_mode() to catch output and config modes. If you can't do interlaced modes, asking nicely for it in the config isn't going to suddenly make it work. --- hw/xfree86/modes/xf86Crtc.c | 11 ++++++++--- hw/xfree86/modes/xf86Modes.c | 11 ++++------- hw/xfree86/modes/xf86Modes.h | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 7dbabdac5..f65246ef4 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1660,8 +1660,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) } if (add_default_modes) - default_modes = xf86GetDefaultModes (output->interlaceAllowed, - output->doubleScanAllowed); + default_modes = xf86GetDefaultModes (); /* * If this is not an RB monitor, remove RB modes from the default @@ -1698,11 +1697,17 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) output->probed_modes = xf86ModesAdd (output->probed_modes, default_modes); /* - * Check all modes against max size + * Check all modes against max size, interlace, and doublescan */ if (maxX && maxY) xf86ValidateModesSize (scrn, output->probed_modes, maxX, maxY, 0); + + { + int flags = (output->interlaceAllowed ? V_INTERLACE : 0) | + (output->doubleScanAllowed ? V_DBLSCAN : 0); + xf86ValidateModesFlags (scrn, output->probed_modes, flags); + } /* * Check all modes against output diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 033d4aeb4..74d8648ec 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -351,6 +351,9 @@ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, { DisplayModePtr mode; + if (flags == (V_INTERLACE | V_DBLSCAN)) + return; + for (mode = modeList; mode != NULL; mode = mode->next) { if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE)) mode->status = MODE_NO_INTERLACE; @@ -691,7 +694,7 @@ xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor) * Build a mode list containing all of the default modes */ DisplayModePtr -xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) +xf86GetDefaultModes (void) { DisplayModePtr head = NULL, mode; int i; @@ -700,13 +703,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) { const DisplayModeRec *defMode = &xf86DefaultModes[i]; - if (!interlaceAllowed && (defMode->Flags & V_INTERLACE)) - continue; - if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN)) - continue; - mode = xf86DuplicateMode(defMode); - head = xf86ModesAdd(head, mode); } return head; diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h index 74cf5e78b..908f59b48 100644 --- a/hw/xfree86/modes/xf86Modes.h +++ b/hw/xfree86/modes/xf86Modes.h @@ -106,7 +106,7 @@ extern _X_EXPORT DisplayModePtr xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor); extern _X_EXPORT DisplayModePtr -xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed); +xf86GetDefaultModes (void); extern _X_EXPORT void xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);