diff options
author | Egbert Eich <eich@freedesktop.org> | 2013-10-05 08:02:28 +0200 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-10-31 18:33:54 -0700 |
commit | 0cb33ce34081d7d123ec565582d7d19bdb3964ad (patch) | |
tree | 9dfe14639381b1550b4e365e94ff735ed753a2c7 /hw | |
parent | 41d4beb2616ceb3f1a1b8694733e85bae70de59a (diff) |
DDX/modes: Add a sanity check when using screen sizes from EDID
EDID sometimes lies about screen sizes. Since the screen size is used
by clients to determine the DPI a wrong ration will lead to terrible
looking fonts.
Add a sanity check for the h/v ratio cutting off at 2.4. This would
still accept the cinemascope aspect ratio as valid.
Also add message suggesting to add a quirk table entry.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 35845e875..2a02c8507 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -3045,10 +3045,22 @@ handle_detailed_physical_size(struct detailed_monitor_section if (det_mon->type == DT && det_mon->section.d_timings.h_size != 0 && det_mon->section.d_timings.v_size != 0) { - - p->output->mm_width = det_mon->section.d_timings.h_size; - p->output->mm_height = det_mon->section.d_timings.v_size; - p->ret = TRUE; + /* some sanity checking for aspect ratio: + assume any h / v (or v / h) > 2.4 to be bogus. + This would even include cinemascope */ + if (((det_mon->section.d_timings.h_size * 5) < + (det_mon->section.d_timings.v_size * 12)) && + ((det_mon->section.d_timings.v_size * 5) < + (det_mon->section.d_timings.h_size * 12))) { + p->output->mm_width = det_mon->section.d_timings.h_size; + p->output->mm_height = det_mon->section.d_timings.v_size; + p->ret = TRUE; + } else + xf86DrvMsg(p->output->scrn->scrnIndex, X_WARNING, + "Output %s: Strange aspect ratio (%i/%i), " + "consider adding a quirk\n", p->output->name, + det_mon->section.d_timings.h_size, + det_mon->section.d_timings.v_size); } } |