Skip to contentSkip to conversation

drm/bochs: add edid present check

PATCH Superseded Gerd Hoffmann 2 participants 5 messages Dec 20, 2018

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/bochs: add edid present check

Check first two header bytes before trying to read the edid blob, to avoid the log being spammed in case qemu has no edid support (old qemu or edid turned off).

Fixes 01f23459cf drm/bochs: add edid support.
---
 drivers/gpu/drm/bochs/bochs_hw.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +8 -0
index c90a0d492f..e1f8ffce00 100644
@@ -89,6 +89,14 @@ int bochs_hw_load_edid(struct bochs_device *bochs)
 	if (!bochs->mmio)
 		return -1;
 
+	/*
+	 * Check first two EDID blob header bytes to figure whenever
+	 * edid support is enabled in qemu.
+	 */
+	if (readb(bochs->mmio + 0) != 0x00 ||
+	    readb(bochs->mmio + 1) != 0xff)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 1 line
2.9.3
Acked-by on v2 1/1
#1 lore raw
Quoted 6 lines · Gerd Hoffmann

Check first two header bytes before trying to read the edid blob, to avoid the log being spammed in case qemu has no edid support (old qemu or edid turned off).

Fixes 01f23459cf drm/bochs: add edid support.

It's a bit a hack, but makes sense.

Quoted 30 lines
---
 drivers/gpu/drm/bochs/bochs_hw.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +8 -0
index c90a0d492f..e1f8ffce00 100644
@@ -89,6 +89,14 @@ int bochs_hw_load_edid(struct bochs_device *bochs)
 	if (!bochs->mmio)
 		return -1;
 
+	/*
+	 * Check first two EDID blob header bytes to figure whenever
+	 * edid support is enabled in qemu.
+	 */
+	if (readb(bochs->mmio + 0) != 0x00 ||
+	    readb(bochs->mmio + 1) != 0xff)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw
Quoted 9 lines · Daniel Vetter
Quoted 6 lines · Gerd Hoffmann

Check first two header bytes before trying to read the edid blob, to avoid the log being spammed in case qemu has no edid support (old qemu or edid turned off).

Fixes 01f23459cf drm/bochs: add edid support.

It's a bit a hack, but makes sense.

On 2nd thought, maybe make it less of a hack by reading all 8 bytes of the header and checking it with drm_edit_is_valid().
-Daniel

Quoted 37 lines
Quoted 30 lines
---
 drivers/gpu/drm/bochs/bochs_hw.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +8 -0
index c90a0d492f..e1f8ffce00 100644
@@ -89,6 +89,14 @@ int bochs_hw_load_edid(struct bochs_device *bochs)
 	if (!bochs->mmio)
 		return -1;
 
+	/*
+	 * Check first two EDID blob header bytes to figure whenever
+	 * edid support is enabled in qemu.
+	 */
+	if (readb(bochs->mmio + 0) != 0x00 ||
+	    readb(bochs->mmio + 1) != 0xff)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#3 lore raw
In reply to Daniel Vetter
Quoted 9 lines · Daniel Vetter
Quoted 6 lines · Gerd Hoffmann

Check first two header bytes before trying to read the edid blob, to avoid the log being spammed in case qemu has no edid support (old qemu or edid turned off).

Fixes 01f23459cf drm/bochs: add edid support.

It's a bit a hack, but makes sense.

On 2nd thought, maybe make it less of a hack by reading all 8 bytes of the header and checking it with drm_edit_is_valid().
-Daniel

Quoted 37 lines
Quoted 30 lines
---
 drivers/gpu/drm/bochs/bochs_hw.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +8 -0
index c90a0d492f..e1f8ffce00 100644
@@ -89,6 +89,14 @@ int bochs_hw_load_edid(struct bochs_device *bochs)
 	if (!bochs->mmio)
 		return -1;
 
+	/*
+	 * Check first two EDID blob header bytes to figure whenever
+	 * edid support is enabled in qemu.
+	 */
+	if (readb(bochs->mmio + 0) != 0x00 ||
+	    readb(bochs->mmio + 1) != 0xff)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Acked-by on v2 1/1
#4 lore raw
In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann

Check first two header bytes before trying to read the edid blob, to avoid the log being spammed in case qemu has no edid support (old qemu or edid turned off).

Fixes 01f23459cf drm/bochs: add edid support.

It's a bit a hack, but makes sense.

Quoted 30 lines
---
 drivers/gpu/drm/bochs/bochs_hw.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +8 -0
index c90a0d492f..e1f8ffce00 100644
@@ -89,6 +89,14 @@ int bochs_hw_load_edid(struct bochs_device *bochs)
 	if (!bochs->mmio)
 		return -1;
 
+	/*
+	 * Check first two EDID blob header bytes to figure whenever
+	 * edid support is enabled in qemu.
+	 */
+	if (readb(bochs->mmio + 0) != 0x00 ||
+	    readb(bochs->mmio + 1) != 0xff)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch