public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: cache the EDID for eDP panels
Date: Wed, 06 Jun 2012 09:36:44 +0200	[thread overview]
Message-ID: <s5hy5o07uyb.wl%tiwai@suse.de> (raw)
In-Reply-To: <1338929667-6814-1-git-send-email-jbarnes@virtuousgeek.org>

At Tue,  5 Jun 2012 16:54:27 -0400,
Jesse Barnes wrote:
> 
> They aren't going anywhere, and probing on DDC can cause the panel to
> blank briefly, so read them up front and cache them for later queries.
> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/intel_dp.c |   43 +++++++++++++++++++++++++++++++++------
>  1 file changed, 37 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 9b2effc..e47ae37 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -32,6 +32,7 @@
>  #include "drm.h"
>  #include "drm_crtc.h"
>  #include "drm_crtc_helper.h"
> +#include "drm_edid.h"
>  #include "intel_drv.h"
>  #include "i915_drm.h"
>  #include "i915_drv.h"
> @@ -67,6 +68,8 @@ struct intel_dp {
>  	struct drm_display_mode *panel_fixed_mode;  /* for eDP */
>  	struct delayed_work panel_vdd_work;
>  	bool want_panel_vdd;
> +	struct edid *edid; /* cached EDID for eDP */
> +	int edid_mode_count;
>  };
>  
>  /**
> @@ -2094,9 +2097,16 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
>  	struct intel_dp *intel_dp = intel_attached_dp(connector);
>  	struct edid	*edid;
>  
> -	ironlake_edp_panel_vdd_on(intel_dp);
> +	if (is_edp(intel_dp)) {
> +		edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
> +		if (!edid)
> +			return NULL;
> +
> +		memcpy(edid, intel_dp->edid, EDID_LENGTH);
> +		return edid;

It might be bigger than EDID_LENGTH when it contains extensions.
Better to create a helper function like drm_copy_edid()?

Also, there is no kfree() corresponding to intel_dp->edid, so a small
memory leak when unloading the module.  (Ditto for intel_lvds.c, BTW)


Takashi

  parent reply	other threads:[~2012-06-06  7:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 20:54 [PATCH] drm/i915: cache the EDID for eDP panels Jesse Barnes
2012-06-05 21:02 ` Chris Wilson
2012-06-05 21:26   ` Jesse Barnes
2012-06-05 21:38     ` Chris Wilson
2012-06-05 21:41       ` Jesse Barnes
2012-06-06  7:23         ` Daniel Vetter
2012-06-06  7:23 ` Jani Nikula
2012-06-06  7:36 ` Takashi Iwai [this message]
2012-06-14 17:20   ` Jesse Barnes
  -- strict thread matches above, loose matches on Subject: below --
2012-06-14 17:19 Jesse Barnes
2012-06-14 18:30 Jesse Barnes
2012-06-14 18:37 ` Chris Wilson
2012-06-14 18:55   ` Jesse Barnes
2012-06-14 19:02 Jesse Barnes
2012-06-14 19:28 Jesse Barnes
2012-06-14 19:42 ` Chris Wilson
2012-06-14 19:44   ` Jesse Barnes
2012-06-15  7:34 ` Jani Nikula
2012-06-15 17:31   ` Jesse Barnes
2012-06-15 17:41     ` Daniel Vetter
2012-06-15  8:21 ` Chris Wilson
2012-06-15 10:52   ` Jani Nikula
2012-06-15 10:55     ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hy5o07uyb.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox