Blob Blame History Raw
From bd9c6b3a4d726a3f83ac6d8cf7211eddbc28f25a Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Tue, 14 Oct 2008 14:04:01 -0400
Subject: [PATCH] EDID: Catch even more cases of encoding aspect as size.

Very cute, Samsung, not only do you claim to be 16cm by 9cm in the
global size record, you also claim to be 160mm by 90mm in the detailed
timings.  Grrr.
---
 hw/xfree86/ddc/interpret_edid.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 3596e87..fbb17b1 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -115,12 +115,16 @@ handle_edid_quirks(xf86MonPtr m)
 	    }
 	}
 
-	if (real_hsize && real_vsize) {
+	if (!real_hsize || !real_vsize) {
+	    m->features.hsize = m->features.vsize = 0;
+	} else if ((m->features.hsize * 10 == real_hsize) &&
+		   (m->features.vsize * 10 == real_vsize)) {
+	    /* exact match is just unlikely, should do a better check though */
+	    m->features.hsize = m->features.vsize = 0;
+	} else {
 	    /* convert mm to cm */
 	    m->features.hsize = (real_hsize + 5) / 10;
 	    m->features.vsize = (real_vsize + 5) / 10;
-	} else {
-	    m->features.hsize = m->features.vsize = 0;
 	}
 	
 	xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n",
-- 
1.6.0.1