All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v3] drm/edid: detect color formats and CTA revision in all CTA extensions
Date: Thu,  5 May 2022 13:52:42 +0300	[thread overview]
Message-ID: <20220505105242.1198521-1-jani.nikula@intel.com> (raw)
In-Reply-To: <a137d2e272ad1eac5b286784008a4baf91bc2799.1651569697.git.jani.nikula@intel.com>

Convert drm_find_cea_extension() to EDID block iterator in color format
and CTA revision detection. Detect them in all CTA extensions.

Also parse CTA Data Blocks in DisplayID even if there's no CTA EDID
extension.

v2:
- Don't assume DRM_COLOR_FORMAT_RGB444 support if there's only DisplayID
  CTA Data Blocks (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3b18a6e501df..8d737322145c 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5447,26 +5447,31 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
 			      const struct edid *edid)
 {
 	struct drm_display_info *info = &connector->display_info;
+	struct drm_edid_iter edid_iter;
 	const struct cea_db *db;
 	struct cea_db_iter iter;
 	const u8 *edid_ext;
 
-	edid_ext = drm_find_cea_extension(edid);
-	if (!edid_ext)
-		return;
+	drm_edid_iter_begin(edid, &edid_iter);
+	drm_edid_iter_for_each(edid_ext, &edid_iter) {
+		if (edid_ext[0] != CEA_EXT)
+			continue;
 
-	info->cea_rev = edid_ext[1];
+		if (!info->cea_rev)
+			info->cea_rev = edid_ext[1];
 
-	/* The existence of a CEA block should imply RGB support */
-	info->color_formats = DRM_COLOR_FORMAT_RGB444;
+		if (info->cea_rev != edid_ext[1])
+			DRM_DEBUG_KMS("CEA extension version mismatch %u != %u\n",
+				      info->cea_rev, edid_ext[1]);
 
-	/* CTA DisplayID Data Block does not have byte #3 */
-	if (edid_ext[0] == CEA_EXT) {
+		/* The existence of a CTA extension should imply RGB support */
+		info->color_formats = DRM_COLOR_FORMAT_RGB444;
 		if (edid_ext[3] & EDID_CEA_YCRCB444)
 			info->color_formats |= DRM_COLOR_FORMAT_YCBCR444;
 		if (edid_ext[3] & EDID_CEA_YCRCB422)
 			info->color_formats |= DRM_COLOR_FORMAT_YCBCR422;
 	}
+	drm_edid_iter_end(&edid_iter);
 
 	cea_db_iter_edid_begin(edid, &iter);
 	cea_db_iter_for_each(db, &iter) {
-- 
2.30.2


  parent reply	other threads:[~2022-05-05 10:53 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  9:23 [Intel-gfx] [PATCH v2 00/20] drm/edid: CEA data block iterators, and more Jani Nikula
2022-05-03  9:23 ` Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 01/20] drm/edid: reset display info in drm_add_edid_modes() for NULL edid Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 02/20] drm/edid: check for HF-SCDB block Jani Nikula
2022-05-03  9:23   ` Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 03/20] drm/edid: rename HDMI Forum VSDB to SCDS Jani Nikula
2022-05-04 21:45   ` Ville Syrjälä
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 04/20] drm/edid: clean up CTA data block tag definitions Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 05/20] drm/edid: add iterator for EDID base and extension blocks Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 06/20] drm/edid: add iterator for CTA data blocks Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 07/20] drm/edid: clean up cea_db_is_*() functions Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 08/20] drm/edid: convert add_cea_modes() to use cea db iter Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 09/20] drm/edid: convert drm_edid_to_speaker_allocation() " Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 10/20] drm/edid: convert drm_edid_to_sad() " Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 11/20] drm/edid: convert drm_detect_hdmi_monitor() " Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 12/20] drm/edid: convert drm_detect_monitor_audio() " Jani Nikula
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 13/20] drm/edid: convert drm_parse_cea_ext() " Jani Nikula
2022-05-04 22:14   ` Ville Syrjälä
2022-05-03  9:23 ` [Intel-gfx] [PATCH v2 14/20] drm/edid: convert drm_edid_to_eld() " Jani Nikula
2022-05-03  9:24 ` [Intel-gfx] [PATCH v2 15/20] drm/edid: sunset the old unused cea data block iterators Jani Nikula
2022-05-03  9:24 ` [Intel-gfx] [PATCH v2 16/20] drm/edid: restore some type safety to cea_db_*() functions Jani Nikula
2022-05-03  9:24 ` [Intel-gfx] [PATCH v2 17/20] drm/edid: detect basic audio in all CEA extensions Jani Nikula
2022-05-03  9:24 ` [Intel-gfx] [PATCH v2 18/20] drm/edid: detect color formats and CTA revision in all CTA extensions Jani Nikula
2022-05-04 22:11   ` Ville Syrjälä
2022-05-05 10:53     ` Jani Nikula
2022-05-05 10:52   ` Jani Nikula [this message]
2022-05-05 14:32     ` [PATCH v3] " Ville Syrjälä
2022-05-05 14:32       ` [Intel-gfx] " Ville Syrjälä
2022-05-03  9:24 ` [Intel-gfx] [PATCH v2 19/20] drm/edid: skip CTA extension scan in drm_edid_to_eld() just for CTA rev Jani Nikula
2022-05-03  9:24   ` Jani Nikula
2022-05-03  9:24 ` [Intel-gfx] [PATCH v2 20/20] drm/edid: sunset drm_find_cea_extension() Jani Nikula
2022-05-03  9:24   ` Jani Nikula
2022-05-03 12:35 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: CEA data block iterators, and more (rev3) Patchwork
2022-05-03 12:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-05-04  8:10 ` [PATCH v2 00/20] drm/edid: CEA data block iterators, and more Jani Nikula
2022-05-04  8:10   ` [Intel-gfx] " Jani Nikula
2022-05-04 10:49 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for drm/edid: CEA data block iterators, and more (rev3) Patchwork
2022-05-04 22:30 ` [PATCH v2 00/20] drm/edid: CEA data block iterators, and more Ville Syrjälä
2022-05-04 22:30   ` [Intel-gfx] " Ville Syrjälä
2022-05-05 17:40   ` Jani Nikula
2022-05-05 17:40     ` [Intel-gfx] " Jani Nikula
2022-05-05 12:23 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: CEA data block iterators, and more (rev4) Patchwork
2022-05-05 12:46 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-05-05 14:54 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20220505105242.1198521-1-jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --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 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.