Skip to contentSkip to conversation

drm/bochs: add edid present check

PATCH Superseded Gerd Hoffmann 3 participants 4 messages Dec 20, 2018

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

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

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

Fixes 01f23459cf drm/bochs: add edid support.
---
 drivers/gpu/drm/bochs/bochs_hw.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +7 -0
index c90a0d492f..d0b4e1cee8 100644
@@ -86,9 +86,16 @@ static int bochs_get_edid_block(void *data, u8 *buf,
 
 int bochs_hw_load_edid(struct bochs_device *bochs)
 {
+	u8 header[8];
+
 	if (!bochs->mmio)
 		return -1;
 
+	/* check header to detect whenever edid support is enabled in qemu */
+	bochs_get_edid_block(bochs, header, 0, ARRAY_SIZE(header));
+	if (drm_edid_header_is_valid(header) != 8)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 1 line
2.9.3
Reviewed-by on v3 1/1
#1 lore raw
Quoted 6 lines · Gerd Hoffmann

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

Fixes 01f23459cf drm/bochs: add edid support.
Quoted 28 lines
---
 drivers/gpu/drm/bochs/bochs_hw.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +7 -0
index c90a0d492f..d0b4e1cee8 100644
@@ -86,9 +86,16 @@ static int bochs_get_edid_block(void *data, u8 *buf,
 
 int bochs_hw_load_edid(struct bochs_device *bochs)
 {
+	u8 header[8];
+
 	if (!bochs->mmio)
 		return -1;
 
+	/* check header to detect whenever edid support is enabled in qemu */
+	bochs_get_edid_block(bochs, header, 0, ARRAY_SIZE(header));
+	if (drm_edid_header_is_valid(header) != 8)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 1 line
2.9.3
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Gerd Hoffmann

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

Fixes 01f23459cf drm/bochs: add edid support.
Quoted 29 lines
Quoted 29 lines
---
  drivers/gpu/drm/bochs/bochs_hw.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +7 -0
index c90a0d492f..d0b4e1cee8 100644
@@ -86,9 +86,16 @@ static int bochs_get_edid_block(void *data, u8 *buf,
 
  int bochs_hw_load_edid(struct bochs_device *bochs)
  {
+	u8 header[8];
+
  	if (!bochs->mmio)
  		return -1;
 
+	/* check header to detect whenever edid support is enabled in qemu */
+	bochs_get_edid_block(bochs, header, 0, ARRAY_SIZE(header));
+	if (drm_edid_header_is_valid(header) != 8)
+		return -1;
+
  	kfree(bochs->edid);
  	bochs->edid = drm_do_get_edid(&bochs->connector,
  				      bochs_get_edid_block, bochs);
Signature · 1 line
2.9.3
Reviewed-by on v3 1/1
#3 lore raw
In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann

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

Fixes 01f23459cf drm/bochs: add edid support.
Quoted 28 lines
---
 drivers/gpu/drm/bochs/bochs_hw.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/bochs/bochs_hw.c +7 -0
index c90a0d492f..d0b4e1cee8 100644
@@ -86,9 +86,16 @@ static int bochs_get_edid_block(void *data, u8 *buf,
 
 int bochs_hw_load_edid(struct bochs_device *bochs)
 {
+	u8 header[8];
+
 	if (!bochs->mmio)
 		return -1;
 
+	/* check header to detect whenever edid support is enabled in qemu */
+	bochs_get_edid_block(bochs, header, 0, ARRAY_SIZE(header));
+	if (drm_edid_header_is_valid(header) != 8)
+		return -1;
+
 	kfree(bochs->edid);
 	bochs->edid = drm_do_get_edid(&bochs->connector,
 				      bochs_get_edid_block, bochs);
Signature · 1 line
2.9.3
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch