All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DRM: ignore invalid EDID extensions
@ 2010-10-28  9:12 sam tygier
  2010-10-28 13:41 ` Marius Gröger
  0 siblings, 1 reply; 8+ messages in thread
From: sam tygier @ 2010-10-28  9:12 UTC (permalink / raw)
  To: dri-devel

Without this patch i get no display (X or VT) on myEIZO S2242W monitor when using KMS

This was discussed back in september, this is the second version of the patch based on ajax's comments. i have opened a bug for the issue:
https://bugs.freedesktop.org/show_bug.cgi?id=31154

Thanks

Sam

---

 From 33d4041a583c417c00f71a5453fed6cff5278de5 Mon Sep 17 00:00:00 2001
From: Sam Tygier <samtygier@yahoo.co.uk>
Date: Thu, 23 Sep 2010 10:11:01 +0100
Subject: [PATCH] DRM: ignore invalid EDID extensions

Currently an invalid EDID extension will cause the whole EDID to be considered invalid. Instead just drop the invalid extensions, and return the valid ones. The base block is modified to claim to have the number valid extensions, and the check sum is updated.

For my EIZO S2242W the base block is fine, but the extension block is all zeros. Without this patch I get no X and no VTs.

  Signed-off-by: Sam Tygier <samtygier@yahoo.co.uk>

---
  drivers/gpu/drm/drm_edid.c |   26 ++++++++++++++++++++------
  1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 96e9631..2e208fa 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -241,7 +241,7 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
              .addr    = DDC_ADDR,
              .flags    = I2C_M_RD,
              .len    = len,
-            .buf    = buf + start,
+            .buf    = buf,
          }
      };
  
@@ -254,7 +254,7 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
  static u8 *
  drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
  {
-    int i, j = 0;
+    int i, j = 0, valid_extensions = 0;
      u8 *block, *new;
  
      if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
@@ -281,14 +281,28 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
  
      for (j = 1; j <= block[0x7e]; j++) {
          for (i = 0; i < 4; i++) {
-            if (drm_do_probe_ddc_edid(adapter, block, j,
-                          EDID_LENGTH))
+            if (drm_do_probe_ddc_edid(adapter,
+                  block + (valid_extensions + 1) * EDID_LENGTH,
+                  j, EDID_LENGTH))
                  goto out;
-            if (drm_edid_block_valid(block + j * EDID_LENGTH))
+            if (drm_edid_block_valid(block + (valid_extensions + 1) * EDID_LENGTH)) {
+                valid_extensions++;
                  break;
+            }
          }
          if (i == 4)
-            goto carp;
+            dev_warn(connector->dev->dev,
+             "%s: Ignoring invalid EDID block %d.\n",
+             drm_get_connector_name(connector), j);
+    }
+
+    if (valid_extensions != block[0x7e]) {
+        block[EDID_LENGTH-1] += block[0x7e] - valid_extensions;
+        block[0x7e] = valid_extensions;
+        new = krealloc(block, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
+        if (!new)
+            goto out;
+        block = new;
      }
  
      return block;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] DRM: ignore invalid EDID extensions
@ 2010-09-21 22:02 Sam Tygier
  2010-09-22 20:59 ` Adam Jackson
  0 siblings, 1 reply; 8+ messages in thread
From: Sam Tygier @ 2010-09-21 22:02 UTC (permalink / raw)
  To: dri-devel

Currently an invalid EDID extension will cause the whole EDID to be considered invalid. Instead just drop the extension, and return the valid base block. The base block is modified to not claim to have extensions, and update the checksum.

For my EIZO S2242W the base block is fine, but the extension block is all zeros. Without this patch I get no X and no VTs.

Signed-off-by: Sam Tygier <samtygier@yahoo.co.uk>
---
  drivers/gpu/drm/drm_edid.c |    9 +++++++++
  1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index f87bf10..5ade343 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -285,6 +285,15 @@ carp:
  	dev_warn(connector->dev->dev, "%s: EDID block %d invalid.\n",
  		 drm_get_connector_name(connector), j);
  
+	/* Invalid extension, so set block[0x7e] to zero, and return
+	 * the base block */
+	block[EDID_LENGTH-1] += block[0x7e];
+	block[0x7e] = 0;
+	new = krealloc(block, EDID_LENGTH, GFP_KERNEL);
+	if (!new)
+		goto out;
+	block = new;
+	return block;
  out:
  	kfree(block);
  	return NULL;
-- 
1.7.1

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

end of thread, other threads:[~2010-10-28 13:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28  9:12 [PATCH] DRM: ignore invalid EDID extensions sam tygier
2010-10-28 13:41 ` Marius Gröger
  -- strict thread matches above, loose matches on Subject: below --
2010-09-21 22:02 Sam Tygier
2010-09-22 20:59 ` Adam Jackson
2010-09-22 21:42   ` Sam Tygier
2010-09-22 21:55     ` Adam Jackson
2010-09-23 10:05       ` Sam Tygier
2010-10-01 11:15       ` Sam Tygier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.