From patchwork Thu Oct 13 19:43:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9375651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2937960487 for ; Thu, 13 Oct 2016 19:44:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 201AF2A193 for ; Thu, 13 Oct 2016 19:44:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14E3C2A196; Thu, 13 Oct 2016 19:44:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B419B2A193 for ; Thu, 13 Oct 2016 19:44:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 914DD6EB31; Thu, 13 Oct 2016 19:44:04 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F28E6EB30; Thu, 13 Oct 2016 19:44:02 +0000 (UTC) Received: by mail-qk0-x244.google.com with SMTP id f128so6313894qkb.0; Thu, 13 Oct 2016 12:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=OPaNzCw10R+j8Tn7DZK40eabFddiiQhAb2u7iqJnH9s=; b=esLadEhs+vjFzJbgkF0YScNRbFEYwt0zdU8US8kz7TuWzlOFZmd+GjDT+drLHumR3u poIj7FDq10oxf2OzBL4T8fWXXvBwjaf3kLE/AhkLSC0CK92ws07guZ5ciulg8gyX+Nk/ OooMql837s0hV4aPUjLMKzZBjPW9uj664PbeXSFY5C0SN9Wj6YzQ+qlKB4cWvi2z72CQ trkTnJitm/75DuLH+qYxd84+pZ/2S96YmPpW+fnSDuen+E9/p337YdZfnQYNODZU002V +aekNVKz6wQsJzQTSh10radtkeJUMd7vo+tx70AXJwlXkYxmWvqD+2XRn9Q2uDemBSk6 lSvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=OPaNzCw10R+j8Tn7DZK40eabFddiiQhAb2u7iqJnH9s=; b=Fhyc6USsBtWSn92UBcom8T+v58HLFjPwljV3IHsBYpBguqhyzm0uP9Yg2iYunsUd2h CU7gDDjbsYAkxem9TmfBETEoja0anvgfpxOGAw9TtrY1TkHLMRD/1XSpam6ZesRtrhv0 UWQaw14K0g/CjtMevp8D2rELOWh1UJW70DPqLp8hDVCS1qaIq3jHRL4KxVVUJ97d+/mX FaIydLmnWD4DtgbviD0CCdsmK09czl2qKi+8GyuRvaAHG7ZZqiRPrcW35qh2HEztp+mj 2Tte10sCHQBua2/laQ4vwnjOTzxBrvr7Nzi+NxRMBBPn9PvUlHTZMl8SUi+hHOArDPJP D5fw== X-Gm-Message-State: AA6/9RlCxS/dq1wlacL3sbOBrrtsf/drUH7YeYhlZfH1W4pqolqC55U9KVMvpIQGzHKgcg== X-Received: by 10.194.80.74 with SMTP id p10mr7973425wjx.121.1476387841282; Thu, 13 Oct 2016 12:44:01 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id hb5sm25091416wjc.5.2016.10.13.12.44.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 12:44:00 -0700 (PDT) From: Chris Wilson To: dri-devel@lists.freedesktop.org Date: Thu, 13 Oct 2016 20:43:55 +0100 Message-Id: <20161013194355.30669-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.9.3 Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] drm/edid: Only print the bad edid when aborting X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/gpu/drm/drm_edid.c | 82 +++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index ec77bd3e1f08..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 @@ -1282,20 +1302,19 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, void *data) { int i, j = 0, valid_extensions = 0; - u8 *block, *new; - bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS); + u8 *edid, *new; - if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) + if ((edid = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) return NULL; /* base block fetch */ for (i = 0; i < 4; i++) { - if (get_edid_block(data, block, 0, EDID_LENGTH)) + if (get_edid_block(data, edid, 0, EDID_LENGTH)) goto out; - if (drm_edid_block_valid(block, 0, print_bad_edid, + if (drm_edid_block_valid(edid, 0, false, &connector->edid_corrupt)) break; - if (i == 0 && drm_edid_is_zero(block, EDID_LENGTH)) { + if (i == 0 && drm_edid_is_zero(edid, EDID_LENGTH)) { connector->null_edid_counter++; goto carp; } @@ -1304,58 +1323,45 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, goto carp; /* if there's no extensions, we're done */ - if (block[0x7e] == 0) - return (struct edid *)block; + if (edid[0x7e] == 0) + return (struct edid *)edid; - new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL); + new = krealloc(edid, (edid[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL); if (!new) goto out; - block = new; + edid = new; + + for (j = 1; j <= edid[0x7e]; j++) { + u8 *block = edid + (valid_extensions + 1) * EDID_LENGTH; - for (j = 1; j <= block[0x7e]; j++) { for (i = 0; i < 4; i++) { - if (get_edid_block(data, - block + (valid_extensions + 1) * EDID_LENGTH, - j, EDID_LENGTH)) + if (get_edid_block(data, block, j, EDID_LENGTH)) goto out; - if (drm_edid_block_valid(block + (valid_extensions + 1) - * EDID_LENGTH, 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); } - if (valid_extensions != block[0x7e]) { - block[EDID_LENGTH-1] += block[0x7e] - valid_extensions; - block[0x7e] = valid_extensions; - new = krealloc(block, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL); + if (valid_extensions != edid[0x7e]) { + edid[EDID_LENGTH-1] += edid[0x7e] - valid_extensions; + edid[0x7e] = valid_extensions; + new = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL); if (!new) goto out; - block = new; + edid = new; } - return (struct edid *)block; + 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(block); + kfree(edid); return NULL; } EXPORT_SYMBOL_GPL(drm_do_get_edid);