All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 08/10] drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld()
Date: Wed, 28 Sep 2016 16:51:41 +0300	[thread overview]
Message-ID: <1475070703-6435-9-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1475070703-6435-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_edid_to_eld() is just mean to cook up the ELD for the audio driver,
so having it parse non-audio related stuff seems just wrong, and
potentially could lead to that information not being even filled out
if the function doesn't even get called. Let's move that stuff to the
place where we parse the color formats and whatnot from the CEA ext
block.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/drm_edid.c | 64 +++++++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 48e529df344e..ec77bd3e1f08 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3253,17 +3253,12 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
 }
 
 static void
-parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db)
+drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
 {
-	struct drm_display_info *info = &connector->display_info;
 	u8 len = cea_db_payload_len(db);
 
-	if (len >= 6) {
+	if (len >= 6)
 		connector->eld[5] |= (db[6] >> 7) << 1;  /* Supports_AI */
-		info->dvi_dual = db[6] & 1;
-	}
-	if (len >= 7)
-		info->max_tmds_clock = db[7] * 5000;
 	if (len >= 8) {
 		connector->latency_present[0] = db[8] >> 7;
 		connector->latency_present[1] = (db[8] >> 6) & 1;
@@ -3277,19 +3272,15 @@ parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db)
 	if (len >= 12)
 		connector->audio_latency[1] = db[12];
 
-	DRM_DEBUG_KMS("HDMI: DVI dual %d, "
-		    "max TMDS clock %d, "
-		    "latency present %d %d, "
-		    "video latency %d %d, "
-		    "audio latency %d %d\n",
-		    info->dvi_dual,
-		    info->max_tmds_clock,
-	      (int) connector->latency_present[0],
-	      (int) connector->latency_present[1],
-		    connector->video_latency[0],
-		    connector->video_latency[1],
-		    connector->audio_latency[0],
-		    connector->audio_latency[1]);
+	DRM_DEBUG_KMS("HDMI: latency present %d %d, "
+		      "video latency %d %d, "
+		      "audio latency %d %d\n",
+		      connector->latency_present[0],
+		      connector->latency_present[1],
+		      connector->video_latency[0],
+		      connector->video_latency[1],
+		      connector->audio_latency[0],
+		      connector->audio_latency[1]);
 }
 
 static void
@@ -3350,7 +3341,6 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name);
  */
 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 {
-	struct drm_display_info *info = &connector->display_info;
 	uint8_t *eld = connector->eld;
 	u8 *cea;
 	u8 *db;
@@ -3367,9 +3357,6 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 	connector->video_latency[1] = 0;
 	connector->audio_latency[1] = 0;
 
-	info->max_tmds_clock = 0;
-	info->dvi_dual = false;
-
 	cea = drm_find_cea_extension(edid);
 	if (!cea) {
 		DRM_DEBUG_KMS("ELD: no CEA Extension found\n");
@@ -3419,7 +3406,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 			case VENDOR_BLOCK:
 				/* HDMI Vendor-Specific Data Block */
 				if (cea_db_is_hdmi_vsdb(db))
-					parse_hdmi_vsdb(connector, db);
+					drm_parse_hdmi_vsdb_audio(connector, db);
 				break;
 			default:
 				break;
@@ -3800,6 +3787,25 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 	}
 }
 
+static void
+drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
+{
+	struct drm_display_info *info = &connector->display_info;
+	u8 len = cea_db_payload_len(db);
+
+	if (len >= 6)
+		info->dvi_dual = db[6] & 1;
+	if (len >= 7)
+		info->max_tmds_clock = db[7] * 5000;
+
+	DRM_DEBUG_KMS("HDMI: DVI dual %d, "
+		      "max TMDS clock %d kHz\n",
+		      info->dvi_dual,
+		      info->max_tmds_clock);
+
+	drm_parse_hdmi_deep_color_info(connector, db);
+}
+
 static void drm_parse_cea_ext(struct drm_connector *connector,
 			      struct edid *edid)
 {
@@ -3826,10 +3832,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
 	for_each_cea_db(edid_ext, i, start, end) {
 		const u8 *db = &edid_ext[i];
 
-		if (!cea_db_is_hdmi_vsdb(db))
-			continue;
-
-		drm_parse_hdmi_deep_color_info(connector, db);
+		if (cea_db_is_hdmi_vsdb(db))
+			drm_parse_hdmi_vsdb_video(connector, db);
 	}
 }
 
@@ -3845,6 +3849,8 @@ static void drm_add_display_info(struct drm_connector *connector,
 	info->bpc = 0;
 	info->color_formats = 0;
 	info->cea_rev = 0;
+	info->max_tmds_clock = 0;
+	info->dvi_dual = false;
 
 	if (edid->revision < 3)
 		return;
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-09-28 13:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
2016-09-28 13:51 ` [PATCH 01/10] drm/edid: Clear old audio latency values before parsing the new EDID ville.syrjala
2016-09-28 13:51 ` [PATCH 02/10] drm/edid: Clear old dvi_dual/max_tmds_clock " ville.syrjala
2016-09-28 13:51 ` [PATCH v2 03/10] drm/edid: Make max_tmds_clock kHz instead of MHz ville.syrjala
2016-09-28 13:51 ` [PATCH v2 04/10] drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info ville.syrjala
2016-09-28 13:51 ` [PATCH 05/10] drm/edid: Don't pass around drm_display_info needlessly ville.syrjala
2016-09-28 13:51 ` [PATCH 06/10] drm/edid: Reduce the number of times we parse the CEA extension block ville.syrjala
2016-09-28 13:51 ` [PATCH 07/10] drm/edid: Clear the old cea_rev when there's no CEA extension in the new EDID ville.syrjala
2016-09-28 13:51 ` ville.syrjala [this message]
2016-09-28 13:51 ` [PATCH 09/10] drm/i915: Replace a bunch of connector->base.display_info with a local variable ville.syrjala
2016-09-29  8:18   ` Ander Conselvan De Oliveira
2016-09-28 13:51 ` [PATCH 10/10] drm/i915: Account for sink max TMDS clock when checking the port clock ville.syrjala
2016-09-29  8:21   ` Ander Conselvan De Oliveira
2016-09-28 14:20 ` ✗ Fi.CI.BAT: warning for drm/edid: Clean up display_info stuff (rev2) Patchwork
2016-09-28 19:28 ` [PATCH v2 00/10] drm/edid: Clean up display_info stuff Alex Deucher
  -- strict thread matches above, loose matches on Subject: below --
2016-08-03  6:33 [PATCH " ville.syrjala
2016-08-03  6:33 ` [PATCH 08/10] drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld() ville.syrjala

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=1475070703-6435-9-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.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 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.