mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/edid: const cleanup
@ 2009-09-23 16:01 Adam Jackson
  2009-09-23 16:01 ` [PATCH 2/4] drm/edid: Ignore bad standard timings Adam Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Jackson @ 2009-09-23 16:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Adam Jackson

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 90d76ba..3326987 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -109,7 +109,9 @@ static struct edid_quirk {
 
 
 /* Valid EDID header has these bytes */
-static u8 edid_header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
+static const u8 edid_header[] = {
+	0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
+};
 
 /**
  * edid_is_valid - sanity check EDID data
-- 
1.6.4.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/4] drm/edid: Ignore bad standard timings.
  2009-09-23 16:01 [PATCH 1/4] drm/edid: const cleanup Adam Jackson
@ 2009-09-23 16:01 ` Adam Jackson
  2009-09-23 16:01   ` [PATCH 3/4] drm/edid: Detailed standard timing blocks have six timings, not five Adam Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Jackson @ 2009-09-23 16:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Adam Jackson

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3326987..dd35dc1 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -502,6 +502,19 @@ static struct drm_display_mode *drm_find_dmt(struct drm_device *dev,
 	}
 	return mode;
 }
+
+/*
+ * 0 is reserved.  The spec says 0x01 fill for unused timings.  Some old
+ * monitors fill with ascii space (0x20) instead.
+ */
+static int
+bad_std_timing(u8 a, u8 b)
+{
+	return (a == 0x00 && b == 0x00) ||
+	       (a == 0x01 && b == 0x01) ||
+	       (a == 0x20 && b == 0x20);
+}
+
 /**
  * drm_mode_std - convert standard mode info (width, height, refresh) into mode
  * @t: standard timing params
@@ -525,6 +538,9 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev,
 	unsigned vfreq = (t->vfreq_aspect & EDID_TIMING_VFREQ_MASK)
 		>> EDID_TIMING_VFREQ_SHIFT;
 
+	if (bad_std_timing(t->hsize, t->vfreq_aspect))
+		return NULL;
+
 	/* According to the EDID spec, the hdisplay = hsize * 8 + 248 */
 	hsize = t->hsize * 8 + 248;
 	/* vrefresh_rate = vfreq + 60 */
-- 
1.6.4.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/4] drm/edid: Detailed standard timing blocks have six timings, not five.
  2009-09-23 16:01 ` [PATCH 2/4] drm/edid: Ignore bad standard timings Adam Jackson
@ 2009-09-23 16:01   ` Adam Jackson
  2009-09-23 16:01     ` [PATCH 4/4] drm/edid: Fix standard timing parse for EDID <= 1.2 Adam Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Jackson @ 2009-09-23 16:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Adam Jackson

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index dd35dc1..8ed732a 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -847,8 +847,7 @@ static int add_detailed_info(struct drm_connector *connector,
 			case EDID_DETAIL_MONITOR_CPDATA:
 				break;
 			case EDID_DETAIL_STD_MODES:
-				/* Five modes per detailed section */
-				for (j = 0; j < 5; i++) {
+				for (j = 0; j < 6; i++) {
 					struct std_timing *std;
 					struct drm_display_mode *newmode;
 
-- 
1.6.4.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 4/4] drm/edid: Fix standard timing parse for EDID <= 1.2
  2009-09-23 16:01   ` [PATCH 3/4] drm/edid: Detailed standard timing blocks have six timings, not five Adam Jackson
@ 2009-09-23 16:01     ` Adam Jackson
  0 siblings, 0 replies; 4+ messages in thread
From: Adam Jackson @ 2009-09-23 16:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Adam Jackson

Aspect ratio code of 0 means 1:1 before EDID 1.3.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 8ed732a..9888c20 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -528,6 +528,7 @@ bad_std_timing(u8 a, u8 b)
  */
 struct drm_display_mode *drm_mode_std(struct drm_device *dev,
 				      struct std_timing *t,
+				      int revision,
 				      int timing_level)
 {
 	struct drm_display_mode *mode;
@@ -546,9 +547,12 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev,
 	/* vrefresh_rate = vfreq + 60 */
 	vrefresh_rate = vfreq + 60;
 	/* the vdisplay is calculated based on the aspect ratio */
-	if (aspect_ratio == 0)
-		vsize = (hsize * 10) / 16;
-	else if (aspect_ratio == 1)
+	if (aspect_ratio == 0) {
+		if (revision < 3)
+			vsize = hsize;
+		else
+			vsize = (hsize * 10) / 16;
+	} else if (aspect_ratio == 1)
 		vsize = (hsize * 3) / 4;
 	else if (aspect_ratio == 2)
 		vsize = (hsize * 4) / 5;
@@ -797,7 +801,7 @@ static int add_standard_modes(struct drm_connector *connector, struct edid *edid
 			continue;
 
 		newmode = drm_mode_std(dev, &edid->standard_timings[i],
-					timing_level);
+				       edid->revision, timing_level);
 		if (newmode) {
 			drm_mode_probed_add(connector, newmode);
 			modes++;
@@ -853,6 +857,7 @@ static int add_detailed_info(struct drm_connector *connector,
 
 					std = &data->data.timings[j];
 					newmode = drm_mode_std(dev, std,
+							       edid->revision,
 							       timing_level);
 					if (newmode) {
 						drm_mode_probed_add(connector, newmode);
@@ -981,7 +986,9 @@ static int add_detailed_info_eedid(struct drm_connector *connector,
 				struct drm_display_mode *newmode;
 
 				std = &data->data.timings[j];
-				newmode = drm_mode_std(dev, std, timing_level);
+				newmode = drm_mode_std(dev, std,
+						       edid->revision,
+						       timing_level);
 				if (newmode) {
 					drm_mode_probed_add(connector, newmode);
 					modes++;
-- 
1.6.4.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-23 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-23 16:01 [PATCH 1/4] drm/edid: const cleanup Adam Jackson
2009-09-23 16:01 ` [PATCH 2/4] drm/edid: Ignore bad standard timings Adam Jackson
2009-09-23 16:01   ` [PATCH 3/4] drm/edid: Detailed standard timing blocks have six timings, not five Adam Jackson
2009-09-23 16:01     ` [PATCH 4/4] drm/edid: Fix standard timing parse for EDID <= 1.2 Adam Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®