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

David Herrmann dh.herrmann at gmail.com
Fri Apr 19 12:12:37 PDT 2013


Hi

On Fri, Apr 19, 2013 at 5:02 PM, Richard Hughes <hughsient at gmail.com> wrote:
> ---
>  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);
> +

Why do you keep the blob around all the time? Just free it in
create_output_for_connector() after you parsed it. If we somehow need
it later, we can always change it again. But your patches don't depend
on it being around all the time so lets just free it right away.

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

We use "drmXY *" instead of "drmXYPtr" here, so lets be consistent.

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

Regards
David


More information about the wayland-devel mailing list