diff mbox

uxa/display: Keep the EDID blob around for the lifetime of an output

Message ID 1375293051-17664-1-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien July 31, 2013, 5:50 p.m. UTC
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@intel.com>
---
 src/uxa/intel_display.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Chris Wilson July 31, 2013, 5:58 p.m. UTC | #1
On Wed, Jul 31, 2013 at 06:50:51PM +0100, Damien Lespiau wrote:
> 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@intel.com>

Pushed, thanks a lot for the patch.
-Chris
diff mbox

Patch

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);