From: Lee Shawn C <shawn.c.lee@intel.com> To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org, Drew Davenport <ddavenport@chromium.org>, ankit.k.nautiyal@intel.com, Lee Shawn C <shawn.c.lee@intel.com> Subject: [v7 4/5] drm/edid: parse HF-EEODB CEA extension block Date: Sun, 13 Mar 2022 21:47:01 +0800 [thread overview] Message-ID: <20220313134702.24175-5-shawn.c.lee@intel.com> (raw) In-Reply-To: <20220313134702.24175-1-shawn.c.lee@intel.com> While adding CEA modes, try to get available EEODB block number. Then based on it to parse numbers of ext blocks, retrieve CEA information and add more CEA modes. Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Cc: Drew Davenport <ddavenport@chromium.org> Cc: intel-gfx <intel-gfx@lists.freedesktop.org> Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com> --- drivers/gpu/drm/drm_displayid.c | 5 ++- drivers/gpu/drm/drm_edid.c | 68 +++++++++++++++++++++++++-------- include/drm/drm_edid.h | 2 +- 3 files changed, 58 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c index 31c3e6d7d549..a769c55146f4 100644 --- a/drivers/gpu/drm/drm_displayid.c +++ b/drivers/gpu/drm/drm_displayid.c @@ -37,7 +37,10 @@ static const u8 *drm_find_displayid_extension(const struct edid *edid, int *length, int *idx, int *ext_index) { - const u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT, ext_index); + const u8 *displayid = drm_find_edid_extension(edid, + DISPLAYID_EXT, + ext_index, + edid->extensions); const struct displayid_header *base; int ret; diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5ae4e83fa5e3..5de85ba20bdf 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3360,23 +3360,25 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid, * Search EDID for CEA extension block. */ const u8 *drm_find_edid_extension(const struct edid *edid, - int ext_id, int *ext_index) + int ext_id, + int *ext_index, + int ext_blk_num) { const u8 *edid_ext = NULL; int i; /* No EDID or EDID extensions */ - if (edid == NULL || edid->extensions == 0) + if (edid == NULL || edid->extensions == 0 || *ext_index >= ext_blk_num) return NULL; /* Find CEA extension */ - for (i = *ext_index; i < edid->extensions; i++) { + for (i = *ext_index; i < ext_blk_num; i++) { edid_ext = (const u8 *)edid + EDID_LENGTH * (i + 1); if (edid_ext[0] == ext_id) break; } - if (i >= edid->extensions) + if (i >= ext_blk_num) return NULL; *ext_index = i + 1; @@ -3385,14 +3387,19 @@ const u8 *drm_find_edid_extension(const struct edid *edid, } static const u8 *drm_find_cea_extension(const struct edid *edid, - int *cea_ext_index, int *displayid_ext_index) + int *cea_ext_index, + int *displayid_ext_index, + int ext_blk_num) { const struct displayid_block *block; struct displayid_iter iter; const u8 *cea; /* Look for a CEA extension block from ext_index */ - cea = drm_find_edid_extension(edid, CEA_EXT, cea_ext_index); + cea = drm_find_edid_extension(edid, + CEA_EXT, + cea_ext_index, + ext_blk_num); if (cea) return cea; @@ -3676,7 +3683,10 @@ add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid) int modes = 0, cea_ext_index = 0, displayid_ext_index = 0; /* Don't add CEA modes if the CEA extension block is missing */ - if (!drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index)) + if (!drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions)) return 0; /* @@ -4328,7 +4338,10 @@ size_t drm_edid_read_hf_eeodb_blk_count(const struct edid *edid) int i, start, end, cea_ext_index = 0, displayid_ext_index = 0; if (edid->extensions) { - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (cea && !cea_db_offsets(cea, &start, &end)) for_each_cea_db(cea, i, start, end) @@ -4384,13 +4397,20 @@ static int add_cea_modes(struct drm_connector *connector, struct edid *edid) { int modes = 0, cea_ext_index = 0, displayid_ext_index = 0; + int ext_blk_num = drm_edid_read_hf_eeodb_blk_count(edid); + + if (!ext_blk_num) + ext_blk_num = edid->extensions; for (;;) { const u8 *cea, *db, *hdmi = NULL, *video = NULL; u8 dbl, hdmi_len = 0, video_len = 0; int i, start, end; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + ext_blk_num); if (!cea) break; @@ -4640,7 +4660,10 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) if (!edid) return; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!cea) { DRM_DEBUG_KMS("ELD: no CEA Extension found\n"); return; @@ -4729,7 +4752,10 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) int cea_ext_index = 0, displayid_ext_index = 0; const u8 *cea; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!cea) { DRM_DEBUG_KMS("SAD: no CEA Extension found\n"); return 0; @@ -4792,7 +4818,10 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) int cea_ext_index = 0, displayid_ext_index = 0; const u8 *cea; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!cea) { DRM_DEBUG_KMS("SAD: no CEA Extension found\n"); return 0; @@ -4888,7 +4917,10 @@ bool drm_detect_hdmi_monitor(struct edid *edid) int start_offset, end_offset; int cea_ext_index = 0, displayid_ext_index = 0; - edid_ext = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + edid_ext = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!edid_ext) return false; @@ -4928,7 +4960,10 @@ bool drm_detect_monitor_audio(struct edid *edid) int start_offset, end_offset; int cea_ext_index = 0, displayid_ext_index = 0; - edid_ext = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + edid_ext = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!edid_ext) goto end; @@ -5253,7 +5288,10 @@ static void drm_parse_cea_ext(struct drm_connector *connector, int i, start, end; int cea_ext_index = 0, displayid_ext_index = 0; - edid_ext = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + edid_ext = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!edid_ext) return; diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 585f0ed932d4..fa06f9a468c4 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -591,7 +591,7 @@ struct drm_display_mode * drm_display_mode_from_cea_vic(struct drm_device *dev, u8 video_code); const u8 *drm_find_edid_extension(const struct edid *edid, - int ext_id, int *ext_index); + int ext_id, int *ext_index, int ext_blk_num); size_t drm_edid_read_hf_eeodb_blk_count(const struct edid *edid); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Lee Shawn C <shawn.c.lee@intel.com> To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org, Drew Davenport <ddavenport@chromium.org> Subject: [Intel-gfx] [v7 4/5] drm/edid: parse HF-EEODB CEA extension block Date: Sun, 13 Mar 2022 21:47:01 +0800 [thread overview] Message-ID: <20220313134702.24175-5-shawn.c.lee@intel.com> (raw) In-Reply-To: <20220313134702.24175-1-shawn.c.lee@intel.com> While adding CEA modes, try to get available EEODB block number. Then based on it to parse numbers of ext blocks, retrieve CEA information and add more CEA modes. Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Cc: Drew Davenport <ddavenport@chromium.org> Cc: intel-gfx <intel-gfx@lists.freedesktop.org> Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com> --- drivers/gpu/drm/drm_displayid.c | 5 ++- drivers/gpu/drm/drm_edid.c | 68 +++++++++++++++++++++++++-------- include/drm/drm_edid.h | 2 +- 3 files changed, 58 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c index 31c3e6d7d549..a769c55146f4 100644 --- a/drivers/gpu/drm/drm_displayid.c +++ b/drivers/gpu/drm/drm_displayid.c @@ -37,7 +37,10 @@ static const u8 *drm_find_displayid_extension(const struct edid *edid, int *length, int *idx, int *ext_index) { - const u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT, ext_index); + const u8 *displayid = drm_find_edid_extension(edid, + DISPLAYID_EXT, + ext_index, + edid->extensions); const struct displayid_header *base; int ret; diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5ae4e83fa5e3..5de85ba20bdf 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3360,23 +3360,25 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid, * Search EDID for CEA extension block. */ const u8 *drm_find_edid_extension(const struct edid *edid, - int ext_id, int *ext_index) + int ext_id, + int *ext_index, + int ext_blk_num) { const u8 *edid_ext = NULL; int i; /* No EDID or EDID extensions */ - if (edid == NULL || edid->extensions == 0) + if (edid == NULL || edid->extensions == 0 || *ext_index >= ext_blk_num) return NULL; /* Find CEA extension */ - for (i = *ext_index; i < edid->extensions; i++) { + for (i = *ext_index; i < ext_blk_num; i++) { edid_ext = (const u8 *)edid + EDID_LENGTH * (i + 1); if (edid_ext[0] == ext_id) break; } - if (i >= edid->extensions) + if (i >= ext_blk_num) return NULL; *ext_index = i + 1; @@ -3385,14 +3387,19 @@ const u8 *drm_find_edid_extension(const struct edid *edid, } static const u8 *drm_find_cea_extension(const struct edid *edid, - int *cea_ext_index, int *displayid_ext_index) + int *cea_ext_index, + int *displayid_ext_index, + int ext_blk_num) { const struct displayid_block *block; struct displayid_iter iter; const u8 *cea; /* Look for a CEA extension block from ext_index */ - cea = drm_find_edid_extension(edid, CEA_EXT, cea_ext_index); + cea = drm_find_edid_extension(edid, + CEA_EXT, + cea_ext_index, + ext_blk_num); if (cea) return cea; @@ -3676,7 +3683,10 @@ add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid) int modes = 0, cea_ext_index = 0, displayid_ext_index = 0; /* Don't add CEA modes if the CEA extension block is missing */ - if (!drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index)) + if (!drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions)) return 0; /* @@ -4328,7 +4338,10 @@ size_t drm_edid_read_hf_eeodb_blk_count(const struct edid *edid) int i, start, end, cea_ext_index = 0, displayid_ext_index = 0; if (edid->extensions) { - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (cea && !cea_db_offsets(cea, &start, &end)) for_each_cea_db(cea, i, start, end) @@ -4384,13 +4397,20 @@ static int add_cea_modes(struct drm_connector *connector, struct edid *edid) { int modes = 0, cea_ext_index = 0, displayid_ext_index = 0; + int ext_blk_num = drm_edid_read_hf_eeodb_blk_count(edid); + + if (!ext_blk_num) + ext_blk_num = edid->extensions; for (;;) { const u8 *cea, *db, *hdmi = NULL, *video = NULL; u8 dbl, hdmi_len = 0, video_len = 0; int i, start, end; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + ext_blk_num); if (!cea) break; @@ -4640,7 +4660,10 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) if (!edid) return; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!cea) { DRM_DEBUG_KMS("ELD: no CEA Extension found\n"); return; @@ -4729,7 +4752,10 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) int cea_ext_index = 0, displayid_ext_index = 0; const u8 *cea; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!cea) { DRM_DEBUG_KMS("SAD: no CEA Extension found\n"); return 0; @@ -4792,7 +4818,10 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) int cea_ext_index = 0, displayid_ext_index = 0; const u8 *cea; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + cea = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!cea) { DRM_DEBUG_KMS("SAD: no CEA Extension found\n"); return 0; @@ -4888,7 +4917,10 @@ bool drm_detect_hdmi_monitor(struct edid *edid) int start_offset, end_offset; int cea_ext_index = 0, displayid_ext_index = 0; - edid_ext = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + edid_ext = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!edid_ext) return false; @@ -4928,7 +4960,10 @@ bool drm_detect_monitor_audio(struct edid *edid) int start_offset, end_offset; int cea_ext_index = 0, displayid_ext_index = 0; - edid_ext = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + edid_ext = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!edid_ext) goto end; @@ -5253,7 +5288,10 @@ static void drm_parse_cea_ext(struct drm_connector *connector, int i, start, end; int cea_ext_index = 0, displayid_ext_index = 0; - edid_ext = drm_find_cea_extension(edid, &cea_ext_index, &displayid_ext_index); + edid_ext = drm_find_cea_extension(edid, + &cea_ext_index, + &displayid_ext_index, + edid->extensions); if (!edid_ext) return; diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 585f0ed932d4..fa06f9a468c4 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -591,7 +591,7 @@ struct drm_display_mode * drm_display_mode_from_cea_vic(struct drm_device *dev, u8 video_code); const u8 *drm_find_edid_extension(const struct edid *edid, - int ext_id, int *ext_index); + int ext_id, int *ext_index, int ext_blk_num); size_t drm_edid_read_hf_eeodb_blk_count(const struct edid *edid); -- 2.17.1
next prev parent reply other threads:[~2022-03-13 13:33 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-13 13:46 [v7 0/5] enhanced edid driver compatibility Lee Shawn C 2022-03-13 13:46 ` [Intel-gfx] " Lee Shawn C 2022-03-13 13:45 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for enhanced edid driver compatibility (rev3) Patchwork 2022-03-13 13:46 ` [v7 1/5] drm/edid: seek for available CEA and DisplayID block from specific EDID block index Lee Shawn C 2022-03-13 13:46 ` [Intel-gfx] " Lee Shawn C 2022-03-14 8:40 ` Jani Nikula 2022-03-14 8:40 ` [Intel-gfx] " Jani Nikula 2022-03-14 21:02 ` Drew Davenport 2022-03-14 21:02 ` [Intel-gfx] " Drew Davenport 2022-03-15 12:32 ` Jani Nikula 2022-03-15 12:32 ` [Intel-gfx] " Jani Nikula 2022-03-15 15:21 ` Lee, Shawn C 2022-03-15 15:21 ` [Intel-gfx] " Lee, Shawn C 2022-03-15 17:22 ` Drew Davenport 2022-03-15 17:22 ` [Intel-gfx] " Drew Davenport 2022-03-13 13:46 ` [v7 2/5] drm/edid: parse multiple CEA extension block Lee Shawn C 2022-03-13 13:46 ` [Intel-gfx] " Lee Shawn C 2022-03-13 13:47 ` [v7 3/5] drm/edid: read HF-EEODB ext block Lee Shawn C 2022-03-13 13:47 ` [Intel-gfx] " Lee Shawn C 2022-03-15 11:03 ` Jani Nikula 2022-03-15 11:03 ` [Intel-gfx] " Jani Nikula 2022-03-15 13:43 ` Lee, Shawn C 2022-03-15 13:43 ` [Intel-gfx] " Lee, Shawn C 2022-03-13 13:47 ` Lee Shawn C [this message] 2022-03-13 13:47 ` [Intel-gfx] [v7 4/5] drm/edid: parse HF-EEODB CEA extension block Lee Shawn C 2022-03-13 13:47 ` [v7 5/5] drm/edid: check for HF-SCDB block Lee Shawn C 2022-03-13 13:47 ` [Intel-gfx] " Lee Shawn C 2022-03-13 13:47 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for enhanced edid driver compatibility (rev3) Patchwork 2022-03-13 14:18 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork 2022-03-13 15:24 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=20220313134702.24175-5-shawn.c.lee@intel.com \ --to=shawn.c.lee@intel.com \ --cc=ankit.k.nautiyal@intel.com \ --cc=ddavenport@chromium.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=intel-gfx@lists.freedesktop.org \ --cc=jani.nikula@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: linkBe 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.