[PATCH 1/3] Extract the EDID blob when adding a DRM output

Richard Hughes hughsient at gmail.com
Fri Apr 19 08:02:10 PDT 2013


---
 src/compositor-drm.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index da1ba79..61ef97e 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -139,6 +139,7 @@ struct drm_output {
 	int pipe;
 	uint32_t connector_id;
 	drmModeCrtcPtr original_crtc;
+	drmModePropertyBlobPtr edid_blob;
 
 	int vblank_pending;
 	int page_flip_pending;
@@ -1011,6 +1012,9 @@ drm_output_destroy(struct weston_output *output_base)
 		(struct drm_compositor *) output->base.compositor;
 	drmModeCrtcPtr origcrtc = output->original_crtc;
 
+	if (output->edid_blob)
+		drmModeFreePropertyBlob(output->edid_blob);
+
 	if (output->backlight)
 		backlight_destroy(output->backlight);
 
@@ -1499,6 +1503,7 @@ create_output_for_connector(struct drm_compositor *ec,
 	drmModeEncoder *encoder;
 	drmModeModeInfo crtc_mode;
 	drmModeCrtc *crtc;
+	drmModePropertyPtr property;
 	int i;
 	char name[32];
 	const char *type_name;
@@ -1642,6 +1647,27 @@ create_output_for_connector(struct drm_compositor *ec,
 
 	wl_list_insert(ec->base.output_list.prev, &output->base.link);
 
+	/* find the EDID blob */
+	for (i = 0; i < connector->count_props && !output->edid_blob; i++) {
+		property = drmModeGetProperty(ec->drm.fd, connector->props[i]);
+		if (!property)
+			continue;
+		if ((property->flags & DRM_MODE_PROP_BLOB) &&
+		    !strcmp(property->name, "EDID")) {
+			output->edid_blob = drmModeGetPropertyBlob(ec->drm.fd,
+								   connector->prop_values[i]);
+		}
+		drmModeFreeProperty(property);
+	}
+
+	/* parse the EDID blob */
+	if (output->edid_blob) {
+		weston_log("Got EDID blob %p of size %u.\n",
+			   output->edid_blob->data,
+			   output->edid_blob->length);
+		/* FIXME: actually parse EDID */
+	}
+
 	output->base.origin = output->base.current;
 	output->base.start_repaint_loop = drm_output_start_repaint_loop;
 	output->base.repaint = drm_output_repaint;
-- 
1.8.2



More information about the wayland-devel mailing list