From 68a8963f726cb92624665669813b6d952d53556e Mon Sep 17 00:00:00 2001 From: Luc Verhaegen Date: Tue, 7 Mar 2006 16:00:57 +0000 Subject: [PATCH] Fix cvt -r check again. CH7011 TV encoder had 800x600 PAL hit the check. --- ChangeLog | 17 +++++++++++++++++ hw/xfree86/common/xf86Mode.c | 31 ++++++++++++++++++------------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c99ae9d8..6472095fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-03-07 Luc Verhaegen + + * hw/xfree86/common/xf86Mode.c: (xf86CheckModeForMonitor): + Third pass at stopping reduced blanking modes for CRTs. This time + round, there is almost no room for error left. We stop modes only + when: + - Hblank is less than 25% of HDisplay and + - HTotal - HDisplay is exactly 160 and + - HSyncEnd - HDisplay is exactly 80 (new) and + - HSyncEnd - HSyncStart is exactly 32 (new) and + - VSyncStart - VDisplay is exactly 3 (new). + So, we stop antique monitors which are rumoured to blow up regularly + from doing so _only_ with modes generated by xf86CVTMode with Reduced + TRUE or modelines generated by cvt -r. If the user dares as much as + look at such a modeline, we're free to scorch off his face and fill it + with glass. + 2006-03-06 Lars Knoll * render/picture.c diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index bb8f4b1d1..c84d952f0 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Mode.c,v 1.8 2005/12/28 15:22:21 libv Exp $ */ +/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Mode.c,v 1.9 2006/01/31 13:04:02 libv Exp $ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.69 2003/10/08 14:58:28 dawes Exp $ */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. @@ -817,19 +817,24 @@ xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor) mode->CrtcVTotal = mode->VTotal |= 1; /* - * Usually, CVT normal blanking is never more than one character below 25%, - * but for low frequencies and weird ratios, you can get below that. - * When you go into the low frequencies with the gtf generator, of which - * normal CVT is a simplification, you almost always go below 25%. - * - * So if we see awkward blanking, then it's either directly CVT or GTF - * generated, or the user supposedly knows what he's doing. So we only stop - * reduced blanking here, as that might accidentally hit us. -- libv + * This code stops cvt -r modes, and only cvt -r modes, from hitting 15y+ + * old CRTs which might, when there is a lot of solar flare activity and + * when the celestial bodies are unfavourably aligned, implode trying to + * sync to it. It's called "Protecting the user from doing anything stupid". + * -- libv */ - if (((mode->HTotal - mode->HDisplay) == 160) && - (((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal)) - if (!monitor->reducedblanking) - return MODE_NO_REDUCED; + + /* Is the horizontal blanking a bit lowish? */ + if (((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) { + /* is this a cvt -r mode, and only a cvt -r mode? */ + if (((mode->HTotal - mode->HDisplay) == 160) && + ((mode->HSyncEnd - mode->HDisplay) == 80) && + ((mode->HSyncEnd - mode->HSyncStart) == 32) && + ((mode->VSyncStart - mode->VDisplay) == 3)) { + if (!monitor->reducedblanking) + return MODE_NO_REDUCED; + } + } return MODE_OK; }