[Intel-gfx] [PATCH] uxa/display: Keep the EDID blob around for the lifetime of an output

Damien Lespiau damien.lespiau at intel.com
Wed Jul 31 19:50:51 CEST 2013


xf86InterpretEDID() doesn't copy the EDID raw data in xf86MonPtr but
just stores the given pointer. The DDX driver needs to make sure that
data stays valid.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 src/uxa/intel_display.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c
index 02f2dcb..fa94888 100644
--- a/src/uxa/intel_display.c
+++ b/src/uxa/intel_display.c
@@ -105,6 +105,7 @@ struct intel_output {
 	int output_id;
 	drmModeConnectorPtr mode_output;
 	drmModeEncoderPtr mode_encoder;
+	drmModePropertyBlobPtr edid_blob;
 	int num_props;
 	struct intel_property *props;
 	void *private_data;
@@ -920,7 +921,6 @@ intel_output_attach_edid(xf86OutputPtr output)
 	struct intel_output *intel_output = output->driver_private;
 	drmModeConnectorPtr koutput = intel_output->mode_output;
 	struct intel_mode *mode = intel_output->mode;
-	drmModePropertyBlobPtr edid_blob = NULL;
 	xf86MonPtr mon = NULL;
 	int i;
 
@@ -938,26 +938,24 @@ intel_output_attach_edid(xf86OutputPtr output)
 		}
 
 		if (!strcmp(props->name, "EDID")) {
-			drmModeFreePropertyBlob(edid_blob);
-			edid_blob =
+			drmModeFreePropertyBlob(intel_output->edid_blob);
+			intel_output->edid_blob =
 				drmModeGetPropertyBlob(mode->fd,
 						       koutput->prop_values[i]);
 		}
 		drmModeFreeProperty(props);
 	}
 
-	if (edid_blob) {
+	if (intel_output->edid_blob) {
 		mon = xf86InterpretEDID(output->scrn->scrnIndex,
-					edid_blob->data);
+					intel_output->edid_blob->data);
 
-		if (mon && edid_blob->length > 128)
+		if (mon && intel_output->edid_blob->length > 128)
 			mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
 	}
 
 	xf86OutputSetEDID(output, mon);
 
-	if (edid_blob)
-		drmModeFreePropertyBlob(edid_blob);
 }
 
 static DisplayModePtr
@@ -1061,6 +1059,8 @@ intel_output_destroy(xf86OutputPtr output)
 	struct intel_output *intel_output = output->driver_private;
 	int i;
 
+	drmModeFreePropertyBlob(intel_output->edid_blob);
+
 	for (i = 0; i < intel_output->num_props; i++) {
 		drmModeFreeProperty(intel_output->props[i].mode_prop);
 		free(intel_output->props[i].atoms);
-- 
1.8.3.1




More information about the Intel-gfx mailing list