From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] drm/i915: cache the EDID for eDP panels Date: Wed, 06 Jun 2012 09:36:44 +0200 Message-ID: References: <1338929667-6814-1-git-send-email-jbarnes@virtuousgeek.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTP id EB0549EB32 for ; Wed, 6 Jun 2012 00:36:45 -0700 (PDT) In-Reply-To: <1338929667-6814-1-git-send-email-jbarnes@virtuousgeek.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Jesse Barnes Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.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 > --- > 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