* [PATCH 1/3] udldrmfb: Fix EDID not working with monitors with EDID extension blocks
@ 2013-01-11 11:08 Hans de Goede
2013-01-11 11:08 ` [PATCH 2/3] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack Hans de Goede
2013-01-11 11:08 ` [PATCH 3/3] udldrmfb: udl_get_edid: drop unneeded i-- Hans de Goede
0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2013-01-11 11:08 UTC (permalink / raw)
To: Dave Airlie; +Cc: Hans de Goede, dri-devel
udldrmfb only reads the main EDID block, and if that advertises extensions
the drm_edid code expects them to be present, and starts reading beyond the
buffer udldrmfb passes it.
Although it may be possible to read more EDID info with the udl we simpy don't
know how, and even if trial and error gets it working on one device, that is
no guarantee it will work on other revisions. So this patch does a simple fix
in the form of patching the EDID info to report 0 extension blocks, this
fixes udldrmfb only doing 1024x768 on monitors with EDID extension blocks.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpu/drm/udl/udl_connector.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index b3b2ced..86538c9 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -57,6 +57,14 @@ static int udl_get_modes(struct drm_connector *connector)
edid = (struct edid *)udl_get_edid(udl);
+ /*
+ * We only read the main block, but if the monitor reports extension
+ * blocks then the drm edid code expects them to be present, so patch
+ * the extension count to 0.
+ */
+ edid->checksum += edid->extensions;
+ edid->extensions = 0;
+
drm_mode_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid);
kfree(edid);
--
1.8.0.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack
2013-01-11 11:08 [PATCH 1/3] udldrmfb: Fix EDID not working with monitors with EDID extension blocks Hans de Goede
@ 2013-01-11 11:08 ` Hans de Goede
2013-01-11 11:08 ` [PATCH 3/3] udldrmfb: udl_get_edid: drop unneeded i-- Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2013-01-11 11:08 UTC (permalink / raw)
To: Dave Airlie; +Cc: Hans de Goede, dri-devel
The buffer passed to usb_control_msg may end up in scatter-gather list, and
may thus not be on the stack. Having it on the stack usually works on x86, but
not on other archs.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpu/drm/udl/udl_connector.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index 86538c9..a8c76f4 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -22,13 +22,17 @@
static u8 *udl_get_edid(struct udl_device *udl)
{
u8 *block;
- char rbuf[3];
+ char *rbuf;
int ret, i;
block = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (block == NULL)
return NULL;
+ rbuf = kmalloc(2, GFP_KERNEL);
+ if (rbuf == NULL)
+ goto error;
+
for (i = 0; i < EDID_LENGTH; i++) {
ret = usb_control_msg(udl->ddev->usbdev,
usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02),
@@ -42,10 +46,12 @@ static u8 *udl_get_edid(struct udl_device *udl)
block[i] = rbuf[1];
}
+ kfree(rbuf);
return block;
error:
kfree(block);
+ kfree(rbuf);
return NULL;
}
--
1.8.0.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] udldrmfb: udl_get_edid: drop unneeded i--
2013-01-11 11:08 [PATCH 1/3] udldrmfb: Fix EDID not working with monitors with EDID extension blocks Hans de Goede
2013-01-11 11:08 ` [PATCH 2/3] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack Hans de Goede
@ 2013-01-11 11:08 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2013-01-11 11:08 UTC (permalink / raw)
To: Dave Airlie; +Cc: Hans de Goede, dri-devel
This is a left-over from when udl_get_edid returned the amount of bytes
successfully read, which it no longer does.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpu/drm/udl/udl_connector.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index a8c76f4..6d7acf4 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -40,7 +40,6 @@ static u8 *udl_get_edid(struct udl_device *udl)
HZ);
if (ret < 1) {
DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
- i--;
goto error;
}
block[i] = rbuf[1];
--
1.8.0.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-11 11:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 11:08 [PATCH 1/3] udldrmfb: Fix EDID not working with monitors with EDID extension blocks Hans de Goede
2013-01-11 11:08 ` [PATCH 2/3] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack Hans de Goede
2013-01-11 11:08 ` [PATCH 3/3] udldrmfb: udl_get_edid: drop unneeded i-- Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).