Commit bcafdfbe authored by Adam Jackson's avatar Adam Jackson 🎧

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.
parent a26c77ff
......@@ -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
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment