From: Jani Nikula <jani.nikula@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v2 5/8] drm/edid: use the new displayid iterator for finding CEA extension
Date: Mon, 29 Mar 2021 16:37:19 +0300 [thread overview]
Message-ID: <e50f876cecbfee369da887ad19350eee0d89b87f.1617024940.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1617024940.git.jani.nikula@intel.com>
Neatly reduce displayid boilerplate in code. No functional changes.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/drm_edid.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fbaa7d679cb2..4526e2557dca 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3266,35 +3266,28 @@ const u8 *drm_find_edid_extension(const struct edid *edid,
static const u8 *drm_find_cea_extension(const struct edid *edid)
{
- int length, idx;
const struct displayid_block *block;
+ struct displayid_iter iter;
const u8 *cea;
- const u8 *displayid;
- int ext_index;
+ int ext_index = 0;
/* Look for a top level CEA extension block */
/* FIXME: make callers iterate through multiple CEA ext blocks? */
- ext_index = 0;
cea = drm_find_edid_extension(edid, CEA_EXT, &ext_index);
if (cea)
return cea;
/* CEA blocks can also be found embedded in a DisplayID block */
- ext_index = 0;
- for (;;) {
- displayid = drm_find_displayid_extension(edid, &length, &idx,
- &ext_index);
- if (!displayid)
- return NULL;
-
- idx += sizeof(struct displayid_hdr);
- for_each_displayid_db(displayid, block, idx, length) {
- if (block->tag == DATA_BLOCK_CTA)
- return (const u8 *)block;
+ displayid_iter_edid_begin(edid, &iter);
+ displayid_iter_for_each(block, &iter) {
+ if (block->tag == DATA_BLOCK_CTA) {
+ cea = (const u8 *)block;
+ break;
}
}
+ displayid_iter_end(&iter);
- return NULL;
+ return cea;
}
static __always_inline const struct drm_display_mode *cea_mode_for_vic(u8 vic)
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2021-03-29 13:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 13:37 [Intel-gfx] [PATCH v2 0/8] drm/edid: overhaul displayid iterator Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 1/8] drm/edid: make a number of functions, parameters and variables const Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 2/8] drm/displayid: add separate drm_displayid.c Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 3/8] drm/displayid: add new displayid section/block iterators Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 4/8] drm/edid: use the new displayid iterator for detailed modes Jani Nikula
2021-03-29 13:37 ` Jani Nikula [this message]
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 6/8] drm/edid: use the new displayid iterator for tile info Jani Nikula
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 7/8] drm/displayid: allow data blocks with 0 payload length Jani Nikula
2021-03-29 19:36 ` Ville Syrjälä
2021-03-29 13:37 ` [Intel-gfx] [PATCH v2 8/8] drm/displayid: rename displayid_hdr to displayid_header Jani Nikula
2021-03-29 19:37 ` Ville Syrjälä
2021-03-29 14:04 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: overhaul displayid iterator (rev3) Patchwork
2021-03-29 14:06 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-03-29 14:10 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2021-03-29 14:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-03-29 16:42 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-03-31 16:23 ` [Intel-gfx] [PATCH v2 0/8] drm/edid: overhaul displayid iterator 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=e50f876cecbfee369da887ad19350eee0d89b87f.1617024940.git.jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@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