Skip to contentSkip to conversation

drm/edid: Skip empty CVT codepoints

PATCH New Adam Jackson 1 participant 2 messages Jan 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/edid: Skip empty CVT codepoints

---
 drivers/gpu/drm/drm_edid.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_edid.c +4 -0
index 5c9f798..9402b92 100644
@@ -911,11 +911,15 @@ static int drm_cvt_modes(struct drm_connector *connector,
 	struct drm_device *dev = connector->dev;
 	struct cvt_timing *cvt;
 	const int rates[] = { 60, 85, 75, 60, 50 };
+	const u8 empty[3] = { 0, 0, 0 };
 
 	for (i = 0; i < 4; i++) {
 		int uninitialized_var(width), height;
 		cvt = &(timing->data.other_data.data.cvt[i]);
 
+		if (!memcmp(cvt->code, empty, 3))
+		    continue;
+
 		height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2;
 		switch (cvt->code[1] & 0xc0) {
 		case 0x00:
Signature · 10 lines
1.6.5.2


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--
#1 lore raw

PATCH 2/2 drm/edid: Fix CVT width/height decode

---
 drivers/gpu/drm/drm_edid.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_edid.c +5 -5
index 9402b92..3a8b648 100644
@@ -920,18 +920,18 @@ static int drm_cvt_modes(struct drm_connector *connector,
 		if (!memcmp(cvt->code, empty, 3))
 		    continue;
 
-		height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2;
-		switch (cvt->code[1] & 0xc0) {
+		height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2;
+		switch (cvt->code[1] & 0x0c) {
 		case 0x00:
 			width = height * 4 / 3;
 			break;
-		case 0x40:
+		case 0x04:
 			width = height * 16 / 9;
 			break;
-		case 0x80:
+		case 0x08:
 			width = height * 16 / 10;
 			break;
-		case 0xc0:
+		case 0x0c:
 			width = height * 15 / 9;
 			break;
 		}
Signature · 10 lines
1.6.5.2


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--