From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 03/12] drm/edid: refactor EDID block status printing
Date: Mon, 11 Apr 2022 12:49:12 +0300 [thread overview]
Message-ID: <87ilrghrvr.fsf@intel.com> (raw)
In-Reply-To: <Yk7Q5fJoe7Dv/XOB@intel.com>
On Thu, 07 Apr 2022, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Apr 07, 2022 at 12:14:29PM +0300, Jani Nikula wrote:
>> Split out a function to log EDID block status. The printouts get changed
>> slightly.
>>
>> Unfortunately, not all users will have struct drm_device available, so
>> we convert to pr_* debug logging instead of drm device based logging.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>> drivers/gpu/drm/drm_edid.c | 75 ++++++++++++++++++++++++++------------
>> 1 file changed, 51 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index f062d1715ec3..3d04d63464ba 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -1729,6 +1729,50 @@ static bool edid_block_valid(const void *block, bool base)
>> edid_block_tag(block));
>> }
>>
>> +static void edid_block_status_print(enum edid_block_status status,
>> + const struct edid *block,
>> + int block_num)
>> +{
>> + switch (status) {
>> + case EDID_BLOCK_OK:
>> + break;
>> + case EDID_BLOCK_NULL:
>> + pr_debug("EDID block %d pointer is NULL\n", block_num);
>> + break;
>> + case EDID_BLOCK_ZERO:
>> + pr_notice("EDID block %d is all zeroes\n", block_num);
>> + break;
>> + case EDID_BLOCK_HEADER_CORRUPT:
>> + pr_notice("EDID has corrupt header\n");
>> + break;
>> + case EDID_BLOCK_HEADER_REPAIR:
>> + pr_debug("EDID corrupt header needs repair\n");
>> + break;
>> + case EDID_BLOCK_HEADER_FIXED:
>> + pr_debug("EDID corrupt header fixed\n");
>> + break;
>> + case EDID_BLOCK_CHECKSUM:
>> + if (edid_block_status_valid(status, edid_block_tag(block))) {
>> + pr_debug("EDID block %d (tag 0x%02x) checksum is invalid, remainder is %d, ignoring\n",
>> + block_num, edid_block_tag(block),
>> + edid_block_compute_checksum(block));
>> + } else {
>> + pr_notice("EDID block %d (tag 0x%02x) checksum is invalid, remainder is %d\n",
>> + block_num, edid_block_tag(block),
>> + edid_block_compute_checksum(block));
>> + }
>> + break;
>> + case EDID_BLOCK_VERSION:
>> + pr_notice("EDID has major version %d, instead of 1\n",
>> + block->version);
>> + break;
>> + default:
>> + pr_debug("EDID block %d unknown edid block status code %d\n",
>> + block_num, status);
>
> Maybe this should complaing a bit more loudly. Indicates a bug in the
> code no?
Sent v2 with WARN().
Thanks,
Jani
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
>> + break;
>> + }
>> +}
>> +
>> /**
>> * drm_edid_block_valid - Sanity check the EDID block (base or extension)
>> * @raw_edid: pointer to raw EDID block
>> @@ -1775,33 +1819,16 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
>> *edid_corrupt = true;
>> }
>>
>> + edid_block_status_print(status, block, block_num);
>> +
>> /* Determine whether we can use this block with this status. */
>> valid = edid_block_status_valid(status, edid_block_tag(block));
>>
>> - /* Some fairly random status printouts. */
>> - if (status == EDID_BLOCK_CHECKSUM) {
>> - if (valid) {
>> - DRM_DEBUG("EDID block checksum is invalid, remainder is %d\n",
>> - edid_block_compute_checksum(block));
>> - DRM_DEBUG("Assuming a KVM switch modified the block but left the original checksum\n");
>> - } else if (print_bad_edid) {
>> - DRM_NOTE("EDID block checksum is invalid, remainder is %d\n",
>> - edid_block_compute_checksum(block));
>> - }
>> - } else if (status == EDID_BLOCK_VERSION) {
>> - DRM_NOTE("EDID has major version %d, instead of 1\n",
>> - block->version);
>> - }
>> -
>> - if (!valid && print_bad_edid) {
>> - if (status == EDID_BLOCK_ZERO) {
>> - pr_notice("EDID block is all zeroes\n");
>> - } else {
>> - pr_notice("Raw EDID:\n");
>> - print_hex_dump(KERN_NOTICE,
>> - " \t", DUMP_PREFIX_NONE, 16, 1,
>> - block, EDID_LENGTH, false);
>> - }
>> + if (!valid && print_bad_edid && status != EDID_BLOCK_ZERO) {
>> + pr_notice("Raw EDID:\n");
>> + print_hex_dump(KERN_NOTICE,
>> + " \t", DUMP_PREFIX_NONE, 16, 1,
>> + block, EDID_LENGTH, false);
>> }
>>
>> return valid;
>> --
>> 2.30.2
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2022-04-11 9:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 9:14 [Intel-gfx] [PATCH 00/12] drm/edid: low level EDID block read refactoring etc Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 01/12] drm/edid: convert edid_is_zero() to edid_block_is_zero() for blocks Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 02/12] drm/edid: have edid_block_check() detect blocks that are all zero Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 03/12] drm/edid: refactor EDID block status printing Jani Nikula
2022-04-07 11:54 ` Ville Syrjälä
2022-04-11 9:49 ` Jani Nikula [this message]
2022-04-07 9:14 ` [Intel-gfx] [PATCH 04/12] drm/edid: add a helper to log dump an EDID block Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 05/12] drm/edid: pass struct edid to connector_bad_edid() Jani Nikula
2022-04-07 11:56 ` Ville Syrjälä
2022-04-07 9:14 ` [Intel-gfx] [PATCH 06/12] drm/edid: add typedef for block read function Jani Nikula
2022-04-07 12:06 ` Ville Syrjälä
2022-04-11 9:48 ` Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 07/12] drm/edid: abstract an EDID block read helper Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 08/12] drm/edid: use EDID block read helper in drm_do_get_edid() Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 09/12] drm/edid: convert extension block read to EDID block read helper Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 10/12] drm/edid: drop extra local var Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 11/12] drm/edid: add single point of return to drm_do_get_edid() Jani Nikula
2022-04-07 9:14 ` [Intel-gfx] [PATCH 12/12] drm/edid: add EDID block count and size helpers Jani Nikula
2022-04-07 15:07 ` [Intel-gfx] [PATCH v2] " Jani Nikula
2022-04-07 12:24 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/edid: low level EDID block read refactoring etc Patchwork
2022-04-07 12:41 ` Jani Nikula
2022-04-07 12:44 ` [Intel-gfx] [PATCH 00/12] " Ville Syrjälä
2022-04-11 9:51 ` Jani Nikula
2022-04-07 17:43 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/edid: low level EDID block read refactoring etc. (rev2) Patchwork
2022-04-07 23:17 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/edid: low level EDID block read refactoring etc. (rev3) Patchwork
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=87ilrghrvr.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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