* [PATCH] Give up on edid retries when i2c bus is not responding [not found] <1319547788-8812-1-git-send-email-eugeni.dodonov@intel.com> @ 2011-10-26 17:06 ` Eugeni Dodonov 2011-10-26 17:18 ` Chris Wilson 0 siblings, 1 reply; 3+ messages in thread From: Eugeni Dodonov @ 2011-10-26 17:06 UTC (permalink / raw) To: dri-devel; +Cc: intel-gfx, alexdeucher, mb, khali, Eugeni Dodonov This allows to avoid talking to a non-responding bus repeatedly until we finally timeout after 15 attempts. We can do this by catching the -ENXIO error, provided by i2c_algo_bit:bit_doAddress call. Within the bit_doAddress we already try 3 times to get the edid data, so if the routine tells us that bus is not responding, it is mostly pointless to keep re-trying those attempts over and over again until we reach final number of retries. This change should fix https://bugs.freedesktop.org/show_bug.cgi?id=41059 and improve overall edid detection timing by 10-30% in most cases, and by a much larger margin in case of phantom outputs. Timing results for i915-powered machines for 'time xrandr' command: Machine 1: from 0.840s to 0.290s Machine 2: from 0.315s to 0.280s Machine 3: from +/- 1s to 0.184s Timing results for HD5770 with 'time xrandr' command: Machine 4: from 3.210s to 1.060s v2: added a module parameter to control this behavior. The idea came from discussion with Jean Delvare. v3: added external tested-by's and timing results. Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com> Tested-By: Sean Finney <seanius@seanius.net> Tested-By: Soren Hansen <soren@linux2go.dk> Tested-By: Hernando Torque <sirius@sonnenkinder.org> --- drivers/gpu/drm/drm_edid.c | 5 +++++ drivers/gpu/drm/drm_stub.c | 5 +++++ include/drm/drmP.h | 2 ++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 7425e5c..c7426ab 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -265,6 +265,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, } }; ret = i2c_transfer(adapter, msgs, 2); + if (drm_ignore_unresponsive_edid && ret == -ENXIO) { + DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n", + adapter->name); + break; + } } while (ret != 2 && --retries); return ret == 2 ? 0 : -1; diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 6d7b083..b1013fe 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -46,16 +46,21 @@ EXPORT_SYMBOL(drm_vblank_offdelay); unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */ EXPORT_SYMBOL(drm_timestamp_precision); +unsigned int drm_ignore_unresponsive_edid = 1; /* Ignore non-responding edid by default */ +EXPORT_SYMBOL(drm_ignore_unresponsive_edid); + MODULE_AUTHOR(CORE_AUTHOR); MODULE_DESCRIPTION(CORE_DESC); MODULE_LICENSE("GPL and additional rights"); MODULE_PARM_DESC(debug, "Enable debug output"); MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs]"); MODULE_PARM_DESC(timestamp_precision_usec, "Max. error on timestamps [usecs]"); +MODULE_PARM_DESC(ignore_unresponsive_edid, "Automatically ignore outputs which do not provide EDID after 3 attempts"); module_param_named(debug, drm_debug, int, 0600); module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600); module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600); +module_param_named(ignore_unresponsive_edid, drm_ignore_unresponsive_edid, int, 0600); struct idr drm_minors_idr; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 9b7c2bb..d7b0286 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1465,6 +1465,8 @@ extern unsigned int drm_debug; extern unsigned int drm_vblank_offdelay; extern unsigned int drm_timestamp_precision; +extern unsigned int drm_ignore_unresponsive_edid; + extern struct class *drm_class; extern struct proc_dir_entry *drm_proc_root; extern struct dentry *drm_debugfs_root; -- 1.7.7.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Give up on edid retries when i2c bus is not responding 2011-10-26 17:06 ` [PATCH] Give up on edid retries when i2c bus is not responding Eugeni Dodonov @ 2011-10-26 17:18 ` Chris Wilson 2011-10-26 17:35 ` Eugeni Dodonov 0 siblings, 1 reply; 3+ messages in thread From: Chris Wilson @ 2011-10-26 17:18 UTC (permalink / raw) To: dri-devel; +Cc: intel-gfx, Eugeni Dodonov, mb, khali On Wed, 26 Oct 2011 15:06:24 -0200, Eugeni Dodonov <eugeni.dodonov@intel.com> wrote: > This allows to avoid talking to a non-responding bus repeatedly until we > finally timeout after 15 attempts. We can do this by catching the -ENXIO > error, provided by i2c_algo_bit:bit_doAddress call. > > Within the bit_doAddress we already try 3 times to get the edid data, so > if the routine tells us that bus is not responding, it is mostly pointless > to keep re-trying those attempts over and over again until we reach final > number of retries. > > This change should fix > https://bugs.freedesktop.org/show_bug.cgi?id=41059 and improve overall > edid detection timing by 10-30% in most cases, and by a much larger margin > in case of phantom outputs. > > Timing results for i915-powered machines for 'time xrandr' command: > Machine 1: from 0.840s to 0.290s > Machine 2: from 0.315s to 0.280s > Machine 3: from +/- 1s to 0.184s > > Timing results for HD5770 with 'time xrandr' command: > Machine 4: from 3.210s to 1.060s > > v2: added a module parameter to control this behavior. The idea came from > discussion with Jean Delvare. > Just one minor nitpick here... Otherwise it looks a very tasty patch. > +unsigned int drm_ignore_unresponsive_edid = 1; /* Ignore non-responding edid by default */ > +EXPORT_SYMBOL(drm_ignore_unresponsive_edid); This comment would be better in the user-facing description, i.e. (default: true). Do we have a candidate user for exporting the symbol? > + > MODULE_AUTHOR(CORE_AUTHOR); > MODULE_DESCRIPTION(CORE_DESC); > MODULE_LICENSE("GPL and additional rights"); > MODULE_PARM_DESC(debug, "Enable debug output"); > MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs]"); > MODULE_PARM_DESC(timestamp_precision_usec, "Max. error on timestamps [usecs]"); > +MODULE_PARM_DESC(ignore_unresponsive_edid, "Automatically ignore outputs which do not provide EDID after 3 attempts"); -- Chris Wilson, Intel Open Source Technology Centre ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Give up on edid retries when i2c bus is not responding 2011-10-26 17:18 ` Chris Wilson @ 2011-10-26 17:35 ` Eugeni Dodonov 0 siblings, 0 replies; 3+ messages in thread From: Eugeni Dodonov @ 2011-10-26 17:35 UTC (permalink / raw) To: dri-devel; +Cc: intel-gfx, mb, khali, Eugeni Dodonov This allows to avoid talking to a non-responding bus repeatedly until we finally timeout after 15 attempts. We can do this by catching the -ENXIO error, provided by i2c_algo_bit:bit_doAddress call. Within the bit_doAddress we already try 3 times to get the edid data, so if the routine tells us that bus is not responding, it is mostly pointless to keep re-trying those attempts over and over again until we reach final number of retries. This change should fix https://bugs.freedesktop.org/show_bug.cgi?id=41059 and improve overall edid detection timing by 10-30% in most cases, and by a much larger margin in case of phantom outputs. Timing results for i915-powered machines for 'time xrandr' command: Machine 1: from 0.840s to 0.290s Machine 2: from 0.315s to 0.280s Machine 3: from +/- 1s to 0.184s Timing results for HD5770 with 'time xrandr' command: Machine 4: from 3.210s to 1.060s v2: added a module parameter to control this behavior. The idea came from discussion with Jean Delvare. v3: added external tested-by's and timing results. v4: changed module parameter to bool, added default value description Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com> Reviewed-By: Chris Wilson <chris@chris-wilson.co.uk> Tested-By: Sean Finney <seanius@seanius.net> Tested-By: Soren Hansen <soren@linux2go.dk> Tested-By: Hernando Torque <sirius@sonnenkinder.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41059 --- drivers/gpu/drm/drm_edid.c | 5 +++++ drivers/gpu/drm/drm_stub.c | 5 +++++ include/drm/drmP.h | 2 ++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 7425e5c..c7426ab 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -265,6 +265,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, } }; ret = i2c_transfer(adapter, msgs, 2); + if (drm_ignore_unresponsive_edid && ret == -ENXIO) { + DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n", + adapter->name); + break; + } } while (ret != 2 && --retries); return ret == 2 ? 0 : -1; diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 6d7b083..dea0fcd 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -46,16 +46,21 @@ EXPORT_SYMBOL(drm_vblank_offdelay); unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */ EXPORT_SYMBOL(drm_timestamp_precision); +unsigned int drm_ignore_unresponsive_edid = 1; /* Ignore non-responding edid by default */ +EXPORT_SYMBOL(drm_ignore_unresponsive_edid); + MODULE_AUTHOR(CORE_AUTHOR); MODULE_DESCRIPTION(CORE_DESC); MODULE_LICENSE("GPL and additional rights"); MODULE_PARM_DESC(debug, "Enable debug output"); MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs]"); MODULE_PARM_DESC(timestamp_precision_usec, "Max. error on timestamps [usecs]"); +MODULE_PARM_DESC(ignore_unresponsive_edid, "Automatically ignore outputs which do not provide EDID after 3 attempts (default: true)"); module_param_named(debug, drm_debug, int, 0600); module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600); module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600); +module_param_named(ignore_unresponsive_edid, drm_ignore_unresponsive_edid, bool, 0600); struct idr drm_minors_idr; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 9b7c2bb..d7b0286 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1465,6 +1465,8 @@ extern unsigned int drm_debug; extern unsigned int drm_vblank_offdelay; extern unsigned int drm_timestamp_precision; +extern unsigned int drm_ignore_unresponsive_edid; + extern struct class *drm_class; extern struct proc_dir_entry *drm_proc_root; extern struct dentry *drm_debugfs_root; -- 1.7.7.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-26 17:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1319547788-8812-1-git-send-email-eugeni.dodonov@intel.com>
2011-10-26 17:06 ` [PATCH] Give up on edid retries when i2c bus is not responding Eugeni Dodonov
2011-10-26 17:18 ` Chris Wilson
2011-10-26 17:35 ` Eugeni Dodonov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox