From 445409f7dd905f599bbb847ff356ed14d0d10ac3 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Jan 25 2007 01:21:57 +0000 Subject: - vesa-1.2.1-validmode.patch: Strictly limit runtime modes to the intersection of the BIOS and DDC lists, if a DDC list exists; fixes cases where we'd choose 1600x1200 on 1680x1050 panel. Conversely, be more forgiving when validating the resulting set against the sync ranges; fixes 640x480 syndrome when the monitor has broken DDC. Don't be deceived though, vesa still sucks. --- diff --git a/vesa-1.2.1-validmode.patch b/vesa-1.2.1-validmode.patch index 98627e6..5b2eebf 100644 --- a/vesa-1.2.1-validmode.patch +++ b/vesa-1.2.1-validmode.patch @@ -1,17 +1,31 @@ ---- xf86-video-vesa-1.2.1/src/vesa.c.validmode 2006-12-04 18:25:14.000000000 -0500 -+++ xf86-video-vesa-1.2.1/src/vesa.c 2006-12-04 19:46:21.000000000 -0500 -@@ -273,6 +273,60 @@ +--- xf86-video-vesa-1.3.0/src/vesa.c.validmode 2007-01-24 19:29:16.000000000 -0500 ++++ xf86-video-vesa-1.3.0/src/vesa.c 2007-01-24 19:34:16.000000000 -0500 +@@ -273,6 +273,85 @@ xf86PrintChipsets(VESA_NAME, "driver for VESA chipsets", VESAChipsets); } ++static VESAPtr ++VESAGetRec(ScrnInfoPtr pScrn) ++{ ++ if (!pScrn->driverPrivate) ++ pScrn->driverPrivate = xcalloc(sizeof(VESARec), 1); ++ ++ return ((VESAPtr)pScrn->driverPrivate); ++} ++ +static ModeStatus +VESAValidMode(int scrn, DisplayModePtr p, Bool flag, int pass) +{ + static int warned = 0; ++ int found = 0; + ScrnInfoPtr pScrn = xf86Screens[scrn]; -+ MonPtr mon = pScrn->monitor; -+ ModeStatus ret1, ret2; -+ DisplayModePtr lo, hi, drop; ++ VESAPtr pVesa = VESAGetRec(pScrn); ++ MonPtr mon = pScrn->monitor, vesamon = pVesa->monitor; ++ ModeStatus ret; ++ DisplayModePtr mode; ++ float v; ++ ++ pVesa = VESAGetRec(pScrn); + + if (pass != MODECHECK_FINAL) { + if (!warned) { @@ -30,38 +44,49 @@ + * So first off, if this isn't a mode we handed to the server (ie, + * M_T_BUILTIN), then we know we can't do it. + */ -+ + if (!(p->type & M_T_BUILTIN)) + return MODE_NOMODE; + + /* -+ * Next, synthesize fully-loaded modes corresponding to the maximal and -+ * minimal refresh rates. If they both fail, then pass the failure code -+ * up (possibly bogus, but oh well). ++ * Next, walk through the mode list from DDC (if any) and look for a ++ * matching resolution. + */ -+ -+ lo = xf86CVTMode(p->HDisplay, p->VDisplay, mon->vrefresh[0].lo, 0, 0); -+ hi = xf86CVTMode(p->HDisplay, p->VDisplay, mon->vrefresh[0].hi, 0, 0); -+ ret1 = xf86CheckModeForMonitor(lo, mon); -+ ret2 = xf86CheckModeForMonitor(hi, mon); -+ xfree(lo); -+ xfree(hi); -+ -+ if (ret1 && ret2) { -+ if (ret1 == ret2) -+ return ret1; -+ else return MODE_BAD; ++ if (pScrn->monitor->DDC) { ++ for (mode = pScrn->monitor->Modes; mode; mode = mode->next) { ++ if (mode->type & M_T_DRIVER && ++ mode->HDisplay == p->HDisplay && ++ mode->VDisplay == p->VDisplay) { ++ found = 1; ++ break; ++ } ++ if (mode == pScrn->monitor->Last) ++ break; ++ } ++ if (!found) ++ return MODE_NOMODE; + } + -+ /* Hooray, we think we can do it */ ++ /* ++ * Finally, walk through the vsync rates 1Hz at a time looking for a mode ++ * that will fit. This is assuredly a terrible way to do this, but ++ * there's no obvious method for computing a mode of a given size that ++ * will pass xf86CheckModeForMonitor. ++ */ ++ for (v = mon->vrefresh[0].lo; v <= mon->vrefresh[0].hi; v++) { ++ mode = xf86CVTMode(p->HDisplay, p->VDisplay, v, 0, 0); ++ ret = xf86CheckModeForMonitor(mode, mon); ++ xfree(mode); ++ if (ret == MODE_OK) ++ break; ++ } + -+ return MODE_OK; ++ return ret; +} + /* * This function is called once, at the start of the first server generation to * do a minimal probe for supported hardware. -@@ -318,6 +372,7 @@ +@@ -318,6 +397,7 @@ pScrn->PreInit = VESAPreInit; pScrn->ScreenInit = VESAScreenInit; pScrn->SwitchMode = VESASwitchMode; @@ -69,3 +94,19 @@ pScrn->AdjustFrame = VESAAdjustFrame; pScrn->EnterVT = VESAEnterVT; pScrn->LeaveVT = VESALeaveVT; +@@ -391,15 +471,6 @@ + return (int)CHIP_VESA_GENERIC; + } + +-static VESAPtr +-VESAGetRec(ScrnInfoPtr pScrn) +-{ +- if (!pScrn->driverPrivate) +- pScrn->driverPrivate = xcalloc(sizeof(VESARec), 1); +- +- return ((VESAPtr)pScrn->driverPrivate); +-} +- + static void + VESAFreeRec(ScrnInfoPtr pScrn) + { diff --git a/xorg-x11-drv-vesa.spec b/xorg-x11-drv-vesa.spec index a96d5fc..58bed76 100644 --- a/xorg-x11-drv-vesa.spec +++ b/xorg-x11-drv-vesa.spec @@ -7,7 +7,7 @@ Summary: Xorg X11 vesa video driver Name: xorg-x11-drv-vesa Version: 1.3.0 -Release: 1%{?dist} +Release: 2%{?dist} URL: http://www.x.org Source0: http://xorg.freedesktop.org/releases/individual/driver/%{tarball}-%{version}.tar.bz2 License: MIT/X11 @@ -31,7 +31,7 @@ X.Org X11 vesa video driver. %setup -q -n %{tarball}-%{version} %patch0 -p1 -b .randr-crash -%patch1 -p1 -b .shadowfb +%patch1 -p1 -b .validmode %build %configure --disable-static @@ -58,6 +58,13 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man4/vesa.4* %changelog +* Wed Jan 24 2007 Adam Jackson 1.3.0-2 +- vesa-1.2.1-validmode.patch: Strictly limit runtime modes to the intersection + of the BIOS and DDC lists, if a DDC list exists; fixes cases where we'd + choose 1600x1200 on 1680x1050 panel. Conversely, be more forgiving when + validating the resulting set against the sync ranges; fixes 640x480 syndrome + when the monitor has broken DDC. Don't be deceived though, vesa still sucks. + * Mon Dec 4 2006 Adam Jackson 1.3.0-1 - Update to 1.3.0 - vesa-1.2.1-validmode.patch: Implement a ValidMode driver hook, which rejects