dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/edid: Only print the bad edid when aborting
Date: Mon, 17 Oct 2016 14:07:28 +0300	[thread overview]
Message-ID: <20161017110728.GL4329@intel.com> (raw)
In-Reply-To: <20161017083514.21772-3-chris@chris-wilson.co.uk>

On Mon, Oct 17, 2016 at 09:35:14AM +0100, Chris Wilson wrote:
> Currently, if drm.debug is enabled, we get a DRM_ERROR message on the
> intermediate edid reads. This causes transient failures in CI which
> flags up the sporadic EDID read failures, which are recovered by
> rereading the EDID automatically. This patch combines the reporting done
> by drm_do_get_edid() itself with the bad block printing from
> get_edid_block(), into a single warning associated with the connector
> once all attempts to retrieve the EDID fail.
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=98228
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/drm_edid.c | 42 +++++++++++++++++++++++++-----------------
>  1 file changed, 25 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 95de47ba1e77..51dd10c65b53 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1260,6 +1260,26 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
>  	return ret == xfers ? 0 : -1;
>  }
>  
> +static void connector_add_bad_edid(struct drm_connector *connector,
> +				   u8 *block, int num)
> +{
> +	if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
> +		return;
> +
> +	if (drm_edid_is_zero(block, EDID_LENGTH)) {
> +		dev_warn(connector->dev->dev,
> +			 "%s: EDID block %d is all zeroes.\n",
> +			 connector->name, num);
> +	} else {
> +		dev_warn(connector->dev->dev,
> +			 "%s: EDID block %d invalid:\n",
> +			 connector->name, num);
> +		print_hex_dump(KERN_WARNING,
> +			       " \t", DUMP_PREFIX_NONE, 16, 1,
> +			       block, EDID_LENGTH, false);
> +	}
> +}
> +
>  /**
>   * drm_do_get_edid - get EDID data using a custom EDID block read function
>   * @connector: connector we're probing
> @@ -1283,7 +1303,6 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
>  {
>  	int i, j = 0, valid_extensions = 0;
>  	u8 *edid, *new;
> -	bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
>  
>  	if ((edid = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
>  		return NULL;
> @@ -1292,7 +1311,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
>  	for (i = 0; i < 4; i++) {
>  		if (get_edid_block(data, edid, 0, EDID_LENGTH))
>  			goto out;
> -		if (drm_edid_block_valid(edid, 0, print_bad_edid,
> +		if (drm_edid_block_valid(edid, 0, false,
>  					 &connector->edid_corrupt))
>  			break;
>  		if (i == 0 && drm_edid_is_zero(edid, EDID_LENGTH)) {
> @@ -1318,20 +1337,14 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
>  		for (i = 0; i < 4; i++) {
>  			if (get_edid_block(data, block, j, EDID_LENGTH))
>  				goto out;
> -			if (drm_edid_block_valid(block, j,
> -						 print_bad_edid, NULL)) {
> +			if (drm_edid_block_valid(block, j, false, NULL)) {
>  				valid_extensions++;
>  				break;
>  			}
>  		}
>  
> -		if (i == 4 && print_bad_edid) {
> -			dev_warn(connector->dev->dev,
> -			 "%s: Ignoring invalid EDID block %d.\n",
> -			 connector->name, j);
> -
> -			connector->bad_edid_counter++;
> -		}
> +		if (i == 4)
> +			connector_add_bad_edid(connector, block, j);

Hmm. So this will only print the first bad block we find. Should we
perhaps just dump out the entire EDID at the end, with the bad blocks
clearly marked as such?

>  	}
>  
>  	if (valid_extensions != edid[0x7e]) {
> @@ -1346,12 +1359,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
>  	return (struct edid *)edid;
>  
>  carp:
> -	if (print_bad_edid) {
> -		dev_warn(connector->dev->dev, "%s: EDID block %d invalid.\n",
> -			 connector->name, j);
> -	}
> -	connector->bad_edid_counter++;
> -
> +	connector_add_bad_edid(connector, edid, 0);
>  out:
>  	kfree(edid);
>  	return NULL;
> -- 
> 2.9.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-10-17 11:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13 19:43 [PATCH] drm/edid: Only print the bad edid when aborting Chris Wilson
2016-10-14 10:46 ` Ville Syrjälä
2016-10-14 10:59   ` Chris Wilson
2016-10-17  6:19 ` Daniel Vetter
2016-10-17  8:35   ` [PATCH 1/3] drm/edid: Rename local variable block to edid Chris Wilson
2016-10-17  8:35     ` [PATCH 2/3] drm/edid: Use block local to refer to the block Chris Wilson
2016-10-17 12:28       ` Daniel Vetter
2016-10-17  8:35     ` [PATCH 3/3] drm/edid: Only print the bad edid when aborting Chris Wilson
2016-10-17 11:07       ` Ville Syrjälä [this message]
2016-10-24 11:33         ` [PATCH v2] " Chris Wilson
2016-10-24 11:36           ` Chris Wilson
2016-10-24 11:38         ` [PATCH v3] " Chris Wilson
2016-10-24 18:48           ` Sean Paul

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=20161017110728.GL4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).