drm/i915: cache the EDID for eDP panels
Subsystems (2)
PATCH 1/1 drm/i915: cache the EDID for eDP panels
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.
v2: fix potential NULL derefs in intel_dp_get_edid_modes and
intel_dp_get_edid (Jani)
copy full EDID length, including extension blocks (Takashi) free EDID on teardown (Takashi)
v3: malloc a new EDID buffer that's big enough for the memcpy (Chris)
v4: change handling of NULL EDIDs, just preserve the NULL behavior
across detects and mode list fetches rather than trying to re-fetch the EDID (Chris)
v5: be glad that Chris is around to remind me to hit C-x C-s before
committing.
References: https://bugs.freedesktop.org/show_bug.cgi?id=46856
--- drivers/gpu/drm/i915/intel_dp.c | 49 ++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +43 -6
@@ -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; };/**
@@ -2121,10 +2124,22 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) {struct intel_dp *intel_dp =intel_attached_dp (connector);struct edid *edid; +int size; + +if (is_edp (intel_dp)) { +if (!intel_dp->edid) +return NULL ; + + size = (intel_dp->edid->extensions +1 ) *EDID_LENGTH ; + edid =kmalloc (size,GFP_KERNEL ); +if (!edid) +return NULL ; + +memcpy (edid, intel_dp->edid, size); +return edid; + } -ironlake_edp_panel_vdd_on (intel_dp); edid =drm_get_edid (connector, adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return edid; }
@@ -2134,9 +2149,17 @@ intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *adastruct intel_dp *intel_dp =intel_attached_dp (connector);int ret; -ironlake_edp_panel_vdd_on (intel_dp); +if (is_edp (intel_dp)) { +drm_mode_connector_update_edid_property (connector, + intel_dp->edid); + ret =drm_add_edid_modes (connector, intel_dp->edid); +drm_edid_to_eld (connector, + intel_dp->edid); + connector->display_info.raw_edid =NULL ; +return intel_dp->edid_mode_count; + } + ret =intel_ddc_get_modes (connector, adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return ret; }
@@ -2326,6 +2349,7 @@ static void intel_dp_encoder_destroy(struct drm_encoder *encoder)i2c_del_adapter (&intel_dp->adapter);drm_encoder_cleanup (encoder);if (is_edp (intel_dp)) { +kfree (intel_dp->edid);cancel_delayed_work_sync (&intel_dp->panel_vdd_work);ironlake_panel_vdd_off_sync (intel_dp); }
@@ -2509,11 +2533,14 @@ intel_dp_init(struct drm_device *dev, int output_reg)break ; } +intel_dp_i2c_init (intel_dp, intel_connector, name); +/* Cache some DPCD data in the eDP case */ if (is_edp (intel_dp)) {bool ret;struct edp_power_seq cur, vbt;u32 pp_on, pp_off, pp_div; +struct edid *edid; pp_on =I915_READ (PCH_PP_ON_DELAYS ); pp_off =I915_READ (PCH_PP_OFF_DELAYS );
@@ -2581,9 +2608,19 @@ intel_dp_init(struct drm_device *dev, int output_reg)intel_dp_destroy (&intel_connector->base);return ; } - } -intel_dp_i2c_init (intel_dp, intel_connector, name); +ironlake_edp_panel_vdd_on (intel_dp); + edid =drm_get_edid (connector, &intel_dp->adapter); +if (edid) { +drm_mode_connector_update_edid_property (connector, + edid); + intel_dp->edid_mode_count = +drm_add_edid_modes (connector, edid); +drm_edid_to_eld (connector, edid); + intel_dp->edid = edid; + } +ironlake_edp_panel_vdd_off (intel_dp, false); + } intel_encoder->hot_plug = intel_dp_hot_plug;
Signature · 1 line
1.7.9.5
Quoted 13 lines · Jesse Barnes
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.
v2: fix potential NULL derefs in
intel_dp_get_edid_modesand
intel_dp_get_edid(Jani)
copy full EDID length, including extension blocks (Takashi) free EDID on teardown (Takashi)
v3: malloc a new EDID buffer that's big enough for the memcpy (Chris)
v4: change handling of NULL EDIDs, just preserve the NULL behavior
across detects and mode list fetches rather than trying to re-fetch the EDID (Chris)
v5: be glad that Chris is around to remind me to hit C-x C-s before
committing.
I do 'git add' reminders as well; by appointment only.
And now to really pour rain on your fire. Why are we repeating quite obscure logic from intel_modes.c? Can we not export a function to attach an edid to a connector and then refactor intel_dp.c to only have a single edid reader where you could add your magic eDP EDID cache handling in single place.
So intel_dp_get_edid_modes calls intel_dp_get_edid() and intel_connector_attach_edid() rather the single-shot intel_ddc_get_modes().
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 23 lines · On Thu, 14 Jun 2012 20:42:15 +0100 Chris Wilson <[email protected]>…
Quoted 13 lines · Jesse Barnes
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.
v2: fix potential NULL derefs in
intel_dp_get_edid_modesand
intel_dp_get_edid(Jani)
copy full EDID length, including extension blocks (Takashi) free EDID on teardown (Takashi)
v3: malloc a new EDID buffer that's big enough for the memcpy (Chris)
v4: change handling of NULL EDIDs, just preserve the NULL behavior
across detects and mode list fetches rather than trying to re-fetch the EDID (Chris)
v5: be glad that Chris is around to remind me to hit C-x C-s before
committing.I do 'git add' reminders as well; by appointment only.
And now to really pour rain on your fire. Why are we repeating quite obscure logic from
intel_modes.c? Can we not export a function to attach an edid to a connector and then refactorintel_dp.cto only have a single edid reader where you could add your magic eDP EDID cache handling in single place.
Quoted 3 lines
So
intel_dp_get_edid_modescallsintel_dp_get_edid()andintel_connector_attach_edid()rather the single-shotintel_ddc_get_modes().
I totally agree this can be more generic. However, Daniel wanted something for -fixes that's fairly self-contained. I think we should push this for the current kernel (and potentially stable) since it fixes a bug, and your stuff or Daniel's stuff can go into -next that makes every connector better.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Jani Nikula
maintainerQuoted 67 lines · Jesse Barnes
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.
v2: fix potential NULL derefs in
intel_dp_get_edid_modesand
intel_dp_get_edid(Jani)
copy full EDID length, including extension blocks (Takashi) free EDID on teardown (Takashi)
v3: malloc a new EDID buffer that's big enough for the memcpy (Chris)
v4: change handling of NULL EDIDs, just preserve the NULL behavior
across detects and mode list fetches rather than trying to re-fetch the EDID (Chris)
v5: be glad that Chris is around to remind me to hit C-x C-s before
committing.References: https://bugs.freedesktop.org/show_bug.cgi?id=46856
Signed-off-by Jesse Barnes <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 49 ++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +17
-2@@ -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; };/** @@ -2121,10 +2124,22 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) {struct intel_dp *intel_dp =intel_attached_dp (connector);struct edid *edid; +int size; + +if (is_edp (intel_dp)) { +if (!intel_dp->edid) +return NULL ; + + size = (intel_dp->edid->extensions +1 ) *EDID_LENGTH ; + edid =kmalloc (size,GFP_KERNEL ); +if (!edid) +return NULL ; + +memcpy (edid, intel_dp->edid, size); +return edid; + } -ironlake_edp_panel_vdd_on (intel_dp); edid =drm_get_edid (connector, adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return edid; }
drivers/gpu/drm/i915/intel_dp.c intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada · line 2155
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +4
-1@@ -2134,9 +2149,17 @@ intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *adastruct intel_dp *intel_dp =intel_attached_dp (connector);int ret; -ironlake_edp_panel_vdd_on (intel_dp); +if (is_edp (intel_dp)) { +drm_mode_connector_update_edid_property (connector, + intel_dp->edid); + ret =drm_add_edid_modes (connector, intel_dp->edid);
Hi Jesse, I'm sure you meant to do *something* with that return value. I presume it should be equal to intel_dp->edid_mode_count, but is it possible it's not? Is it better to return ret or intel_dp->edid_mode_count from this function?
BR,
Jani.
Quoted 63 lines
drivers/gpu/drm/i915/intel_dp.c +22
-3+drm_edid_to_eld (connector, + intel_dp->edid); + connector->display_info.raw_edid =NULL ; +return intel_dp->edid_mode_count; + } + ret =intel_ddc_get_modes (connector, adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return ret; }@@ -2326,6 +2349,7 @@ static void intel_dp_encoder_destroy(struct drm_encoder *encoder)i2c_del_adapter (&intel_dp->adapter);drm_encoder_cleanup (encoder);if (is_edp (intel_dp)) { +kfree (intel_dp->edid);cancel_delayed_work_sync (&intel_dp->panel_vdd_work);ironlake_panel_vdd_off_sync (intel_dp); }@@ -2509,11 +2533,14 @@ intel_dp_init(struct drm_device *dev, int output_reg)break ; } +intel_dp_i2c_init (intel_dp, intel_connector, name); +/* Cache some DPCD data in the eDP case */ if (is_edp (intel_dp)) {bool ret;struct edp_power_seq cur, vbt;u32 pp_on, pp_off, pp_div; +struct edid *edid; pp_on =I915_READ (PCH_PP_ON_DELAYS ); pp_off =I915_READ (PCH_PP_OFF_DELAYS );@@ -2581,9 +2608,19 @@ intel_dp_init(struct drm_device *dev, int output_reg)intel_dp_destroy (&intel_connector->base);return ; } - } -intel_dp_i2c_init (intel_dp, intel_connector, name); +ironlake_edp_panel_vdd_on (intel_dp); + edid =drm_get_edid (connector, &intel_dp->adapter); +if (edid) { +drm_mode_connector_update_edid_property (connector, + edid); + intel_dp->edid_mode_count = +drm_add_edid_modes (connector, edid); +drm_edid_to_eld (connector, edid); + intel_dp->edid = edid; + } +ironlake_edp_panel_vdd_off (intel_dp, false); + } intel_encoder->hot_plug = intel_dp_hot_plug;Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 71 lines · On Fri, 15 Jun 2012 10:34:22 +0300 Jani Nikula <[email protected]>…
Quoted 70 lines · Jesse Barnes
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.
v2: fix potential NULL derefs in
intel_dp_get_edid_modesand
intel_dp_get_edid(Jani)
copy full EDID length, including extension blocks (Takashi) free EDID on teardown (Takashi)
v3: malloc a new EDID buffer that's big enough for the memcpy (Chris)
v4: change handling of NULL EDIDs, just preserve the NULL behavior
across detects and mode list fetches rather than trying to re-fetch the EDID (Chris)
v5: be glad that Chris is around to remind me to hit C-x C-s before
committing.References: https://bugs.freedesktop.org/show_bug.cgi?id=46856
Signed-off-by Jesse Barnes <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 49 ++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +17
-2@@ -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; };/** @@ -2121,10 +2124,22 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) {struct intel_dp *intel_dp =intel_attached_dp (connector);struct edid *edid; +int size; + +if (is_edp (intel_dp)) { +if (!intel_dp->edid) +return NULL ; + + size = (intel_dp->edid->extensions +1 ) *EDID_LENGTH ; + edid =kmalloc (size,GFP_KERNEL ); +if (!edid) +return NULL ; + +memcpy (edid, intel_dp->edid, size); +return edid; + } -ironlake_edp_panel_vdd_on (intel_dp); edid =drm_get_edid (connector, adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return edid; }@@ -2134,9 +2149,17 @@ intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *adastruct intel_dp *intel_dp =intel_attached_dp (connector);int ret;
Quoted 11 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada · line 2155
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +4
-1-ironlake_edp_panel_vdd_on (intel_dp); +if (is_edp (intel_dp)) { +drm_mode_connector_update_edid_property (connector, + intel_dp->edid); + ret =drm_add_edid_modes (connector, intel_dp->edid);Hi Jesse, I'm sure you meant to do *something* with that return value. I presume it should be equal to
intel_dp->edid_mode_count, but is it possible it's not? Is it better to return ret orintel_dp->edid_mode_countfrom this function?
Heh there's always something... but yeah it should be equal to the mode_count; I should either drop the ret= or use it. Maybe as a cleanup on top since I'm tired of respinning this one? :p
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Quoted 11 lines · Jesse Barnes
Quoted 5 lines · On Fri, 15 Jun 2012 10:34:22 +0300 Jani Nikula <[email protected]>…
Hi Jesse, I'm sure you meant to do *something* with that return value. I presume it should be equal to
intel_dp->edid_mode_count, but is it possible it's not? Is it better to return ret orintel_dp->edid_mode_countfrom this function?Heh there's always something... but yeah it should be equal to the
mode_count; I should either drop the ret= or use it. Maybe as a cleanup on top since I'm tired of respinning this one? :p
I guess we can mend that bikeshed when we unify the panel handling some more between lvds and eDP. Patch merged for -fixes, thanks. -Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
PATCH 1/1 drm/i915: cache the EDID for eDP panels
In reply to Jesse BarnesThey 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.
Jesse's patch revamped. Gotta love those display_info.raw_edid = NULL!
--- drivers/gpu/drm/i915/intel_dp.c | 48 +++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_modes.c | 24 ++++++++++++------ 3 files changed, 54 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +37 -11
@@ -67,6 +67,7 @@ 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 for eDP */ };/**
@@ -2095,26 +2096,50 @@ g4x_dp_detect(struct intel_dp *intel_dp) }static struct edid * -intel_dp_get_edid (struct drm_connector *connector,struct i2c_adapter *adapter) +_drm_edid_duplicate (struct edid *edid) +{ +struct edid *copy; +int size; + +if (edid ==NULL ) +return NULL ; + + size =EDID_LENGTH * (1 + edid->extensions); + *copy =kmalloc (size,GFP_KERNEL ); +if (copy) +memcpy (copy, edid, size); + +return copy; +} + +static struct edid * +intel_dp_get_edid (struct drm_connector *connector) {struct intel_dp *intel_dp =intel_attached_dp (connector); -struct edid *edid; +struct edid *edid; + +if (is_edp (intel_dp)) +return _drm_edid_duplicate (intel_dp->edid);ironlake_edp_panel_vdd_on (intel_dp); - edid =drm_get_edid (connector, adapter); + edid =drm_get_edid (connector, &intel_dp->adapter);ironlake_edp_panel_vdd_off (intel_dp, false); +return edid; }static int -intel_dp_get_edid_modes (struct drm_connector *connector,struct i2c_adapter *adapter) +intel_dp_get_edid_modes (struct drm_connector *connector) {struct intel_dp *intel_dp =intel_attached_dp (connector); -int ret; +struct edid *edid; +int ret; + + edid =intel_dp_get_edid (intel_dp); + ret =intel_connector_attach_edid (connector, edid); + connector->display_info.raw_edid =NULL ; +kfree (edid); -ironlake_edp_panel_vdd_on (intel_dp); - ret =intel_ddc_get_modes (connector, adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return ret; }
@@ -2172,7 +2197,7 @@ static int intel_dp_get_modes(struct drm_connector *connector)/* We should parse the EDID data and find out if it has an audio sink */ - ret =intel_dp_get_edid_modes (connector, &intel_dp->adapter); + ret =intel_dp_get_edid_modes (connector);if (ret) {if (is_edp (intel_dp) && !intel_dp->panel_fixed_mode) {struct drm_display_mode *newmode;
@@ -2485,6 +2510,8 @@ intel_dp_init(struct drm_device *dev, int output_reg)break ; } +intel_dp_i2c_init (intel_dp, intel_connector, name); +/* Cache some DPCD data in the eDP case */ if (is_edp (intel_dp)) {bool ret;
@@ -2543,6 +2570,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)ironlake_edp_panel_vdd_on (intel_dp); ret =intel_dp_get_dpcd (intel_dp); + intel_dp->edid =drm_get_edid (connector, &intel_dp->adapter);ironlake_edp_panel_vdd_off (intel_dp, false);if (ret) {
@@ -2559,8 +2587,6 @@ intel_dp_init(struct drm_device *dev, int output_reg) } } -intel_dp_i2c_init (intel_dp, intel_connector, name); - intel_encoder->hot_plug = intel_dp_hot_plug;if (is_edp (intel_dp)) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -336,6 +336,7 @@ struct intel_fbc_work {int intel_ddc_get_modes (struct drm_connector *c,struct i2c_adapter *adapter);extern bool intel_ddc_probe (struct intel_encoder *intel_encoder,int ddc_bus); +int intel_connector_attach_edid (struct drm_connector *connector,struct edid *edid);extern void intel_attach_force_audio_property (struct drm_connector *connector);extern void intel_attach_broadcast_rgb_property (struct drm_connector *connector);
drivers/gpu/drm/i915/intel_modes.c +16 -8
@@ -60,6 +60,18 @@ bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus) msgs, 2) == 2; } +int intel_connector_attach_edid (struct drm_connector *connector, +struct edid *edid) +{ +int ret; + +drm_mode_connector_update_edid_property (connector, edid); + ret =drm_add_edid_modes (connector, edid); +drm_edid_to_eld (connector, edid); + +return ret; +} +/** * intel_ddc_get_modes - get modelist from monitor * @connector: DRM connector device to use
@@ -71,16 +83,12 @@ int intel_ddc_get_modes(struct drm_connector *connector, struct i2c_adapter *adapter) {struct edid *edid; -int ret =0 ; +int ret; edid =drm_get_edid (connector, adapter); -if (edid) { -drm_mode_connector_update_edid_property (connector, edid); - ret =drm_add_edid_modes (connector, edid); -drm_edid_to_eld (connector, edid); - connector->display_info.raw_edid =NULL ; -kfree (edid); - } + ret =intel_connector_attach_edid (connector, edid); + connector->display_info.raw_edid =NULL ; +kfree (edid);return ret; }
Signature · 1 line
1.7.10
Jani Nikula
maintainerQuoted 27 lines · Chris Wilson
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.
Jesse's patch revamped. Gotta love those display_info.raw_edid = NULL!
--- drivers/gpu/drm/i915/intel_dp.c | 48 +++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_modes.c | 24 ++++++++++++------ 3 files changed, 54 insertions(+), 19 deletions(-)drivers/gpu/drm/i915/intel_dp.c +1
-1@@ -67,6 +67,7 @@ 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 for eDP */ };/** @@ -2095,26 +2096,50 @@ g4x_dp_detect(struct intel_dp *intel_dp) } static struct edid * -intel_dp_get_edid (struct drm_connector *connector,struct i2c_adapter *adapter)
drivers/gpu/drm/i915/intel_dp.c g4x_dp_detect(struct intel_dp *intel_dp) · line 2108
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+_drm_edid_duplicate(struct edid *edid) +{ +struct edid *copy; +int size; + +if (edid ==NULL ) +return NULL ; + + size =EDID_LENGTH * (1 + edid->extensions); + *copy =kmalloc (size,GFP_KERNEL );
You may want to remove that '*' there...
Jani.
Quoted 142 lines
drivers/gpu/drm/i915/intel_dp.c +26
-10+if (copy) +memcpy (copy, edid, size); + +return copy; +} + +static struct edid * +intel_dp_get_edid (struct drm_connector *connector) {struct intel_dp *intel_dp =intel_attached_dp (connector); -struct edid *edid; +struct edid *edid; + +if (is_edp (intel_dp)) +return _drm_edid_duplicate (intel_dp->edid);ironlake_edp_panel_vdd_on (intel_dp); - edid =drm_get_edid (connector, adapter); + edid =drm_get_edid (connector, &intel_dp->adapter);ironlake_edp_panel_vdd_off (intel_dp, false); +return edid; }static int -intel_dp_get_edid_modes (struct drm_connector *connector,struct i2c_adapter *adapter) +intel_dp_get_edid_modes (struct drm_connector *connector) {struct intel_dp *intel_dp =intel_attached_dp (connector); -int ret; +struct edid *edid; +int ret; + + edid =intel_dp_get_edid (intel_dp); + ret =intel_connector_attach_edid (connector, edid); + connector->display_info.raw_edid =NULL ; +kfree (edid); -ironlake_edp_panel_vdd_on (intel_dp); - ret =intel_ddc_get_modes (connector, adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return ret; }@@ -2172,7 +2197,7 @@ static int intel_dp_get_modes(struct drm_connector *connector)/* We should parse the EDID data and find out if it has an audio sink */ - ret =intel_dp_get_edid_modes (connector, &intel_dp->adapter); + ret =intel_dp_get_edid_modes (connector);if (ret) {if (is_edp (intel_dp) && !intel_dp->panel_fixed_mode) {struct drm_display_mode *newmode;@@ -2485,6 +2510,8 @@ intel_dp_init(struct drm_device *dev, int output_reg)break ; } +intel_dp_i2c_init (intel_dp, intel_connector, name); +/* Cache some DPCD data in the eDP case */ if (is_edp (intel_dp)) {bool ret;@@ -2543,6 +2570,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)ironlake_edp_panel_vdd_on (intel_dp); ret =intel_dp_get_dpcd (intel_dp); + intel_dp->edid =drm_get_edid (connector, &intel_dp->adapter);ironlake_edp_panel_vdd_off (intel_dp, false);if (ret) {@@ -2559,8 +2587,6 @@ intel_dp_init(struct drm_device *dev, int output_reg) } } -intel_dp_i2c_init (intel_dp, intel_connector, name); - intel_encoder->hot_plug = intel_dp_hot_plug;if (is_edp (intel_dp)) {drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -336,6 +336,7 @@ struct intel_fbc_work {int intel_ddc_get_modes (struct drm_connector *c,struct i2c_adapter *adapter);extern bool intel_ddc_probe (struct intel_encoder *intel_encoder,int ddc_bus); +int intel_connector_attach_edid (struct drm_connector *connector,struct edid *edid);extern void intel_attach_force_audio_property (struct drm_connector *connector);extern void intel_attach_broadcast_rgb_property (struct drm_connector *connector);drivers/gpu/drm/i915/intel_modes.c +16
-8@@ -60,6 +60,18 @@ bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus) msgs, 2) == 2; } +int intel_connector_attach_edid (struct drm_connector *connector, +struct edid *edid) +{ +int ret; + +drm_mode_connector_update_edid_property (connector, edid); + ret =drm_add_edid_modes (connector, edid); +drm_edid_to_eld (connector, edid); + +return ret; +} +/** * intel_ddc_get_modes - get modelist from monitor * @connector: DRM connector device to use @@ -71,16 +83,12 @@ int intel_ddc_get_modes(struct drm_connector *connector, struct i2c_adapter *adapter) {struct edid *edid; -int ret =0 ; +int ret; edid =drm_get_edid (connector, adapter); -if (edid) { -drm_mode_connector_update_edid_property (connector, edid); - ret =drm_add_edid_modes (connector, edid); -drm_edid_to_eld (connector, edid); - connector->display_info.raw_edid =NULL ; -kfree (edid); - } + ret =intel_connector_attach_edid (connector, edid); + connector->display_info.raw_edid =NULL ; +kfree (edid);return ret; }Signature · 6 lines
1.7.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · Jani Nikula
Quoted 25 lines · Chris Wilson
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.
Jesse's patch revamped. Gotta love those display_info.raw_edid = NULL!
--- drivers/gpu/drm/i915/intel_dp.c | 48 +++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_modes.c | 24 ++++++++++++------ 3 files changed, 54 insertions(+), 19 deletions(-)drivers/gpu/drm/i915/intel_dp.c +1
-0@@ -67,6 +67,7 @@ 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 for eDP */ };/** @@ -2095,26 +2096,50 @@ g4x_dp_detect(struct intel_dp *intel_dp) }
Quoted 14 lines
drivers/gpu/drm/i915/intel_dp.c g4x_dp_detect(struct intel_dp *intel_dp) · line 2108
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +10
-1static struct edid * -intel_dp_get_edid (struct drm_connector *connector,struct i2c_adapter *adapter) +_drm_edid_duplicate (struct edid *edid) +{ +struct edid *copy; +int size; + +if (edid ==NULL ) +return NULL ; + + size =EDID_LENGTH * (1 + edid->extensions); + *copy =kmalloc (size,GFP_KERNEL );You may want to remove that '*' there...
And free the cached edid upon destroy. :)
Mainly seeing if I could convince Jesse that we could do a nice patch for -fixes.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre