From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/4] drm/displayid: Iterate over all DisplayID blocks
Date: Tue, 10 May 2016 11:20:18 +1000 [thread overview]
Message-ID: <1462843220-15092-2-git-send-email-airlied@gmail.com> (raw)
In-Reply-To: <1462843220-15092-1-git-send-email-airlied@gmail.com>
From: Tomas Bzatek <tomas@bzatek.net>
This will iterate over all DisplayID blocks found in the buffer.
Previously only the first block was parsed.
https://bugs.freedesktop.org/show_bug.cgi?id=95207
Signed-off-by: Tomas Bzatek <tomas@bzatek.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/drm_edid.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 9dbaaf4..3cf17a3 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4237,18 +4237,24 @@ static int drm_parse_display_id(struct drm_connector *connector,
return -EINVAL;
}
- block = (struct displayid_block *)&displayid[idx + 4];
- DRM_DEBUG_KMS("block id %d, rev %d, len %d\n",
- block->tag, block->rev, block->num_bytes);
-
- switch (block->tag) {
- case DATA_BLOCK_TILED_DISPLAY:
- ret = drm_parse_tiled_block(connector, block);
- if (ret)
- return ret;
- default:
- printk("unknown displayid tag %d\n", block->tag);
- break;
+ idx += sizeof(struct displayid_hdr);
+ while (block = (struct displayid_block *)&displayid[idx],
+ idx + sizeof(struct displayid_block) <= length &&
+ idx + sizeof(struct displayid_block) + block->num_bytes <= length &&
+ block->num_bytes > 0) {
+ idx += block->num_bytes + sizeof(struct displayid_block);
+ DRM_DEBUG_KMS("block id 0x%x, rev %d, len %d\n",
+ block->tag, block->rev, block->num_bytes);
+
+ switch (block->tag) {
+ case DATA_BLOCK_TILED_DISPLAY:
+ ret = drm_parse_tiled_block(connector, block);
+ if (ret)
+ return ret;
+ default:
+ DRM_DEBUG_KMS("found DisplayID tag 0x%x, unhandled\n", block->tag);
+ break;
+ }
}
return 0;
}
--
2.5.5
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-05-10 1:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 1:20 [PATCH 1/4] drm/edid: move displayid tiled block parsing into separate function Dave Airlie
2016-05-10 1:20 ` Dave Airlie [this message]
2016-05-10 9:02 ` [PATCH 2/4] drm/displayid: Iterate over all DisplayID blocks Jani Nikula
2016-05-10 1:20 ` [PATCH 3/4] drm/edid: move displayid validation to it's own function Dave Airlie
2016-05-10 9:14 ` Jani Nikula
2016-05-10 1:20 ` [PATCH 4/4] drm/edid: add displayid detailed 1 timings to the modelist. (v1.1) Dave Airlie
2016-05-10 8:15 ` [PATCH 1/4] drm/edid: move displayid tiled block parsing into separate function Jani Nikula
2016-05-10 9:01 ` Jani Nikula
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=1462843220-15092-2-git-send-email-airlied@gmail.com \
--to=airlied@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.