All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] drm/edid: Clean up display_info stuff
@ 2016-09-28 13:51 ville.syrjala
  2016-09-28 13:51 ` [PATCH 01/10] drm/edid: Clear old audio latency values before parsing the new EDID ville.syrjala
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

Rebased the series (previous version [1]) mostly due to code
shuffling. i915 specific bits still need to be eyeballed by someone.

Series available here:
git://github.com/vsyrjala/linux.git hdmi_sink_tmds_limit_4

[1] https://lists.freedesktop.org/archives/dri-devel/2016-August/114634.html

Ville Syrjälä (10):
  drm/edid: Clear old audio latency values before parsing the new EDID
  drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new
    EDID
  drm/edid: Make max_tmds_clock kHz instead of MHz
  drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info
  drm/edid: Don't pass around drm_display_info needlessly
  drm/edid: Reduce the number of times we parse the CEA extension block
  drm/edid: Clear the old cea_rev when there's no CEA extension in the
    new EDID
  drm/edid: Move dvi_dual/max_tmds_clock parsing out from
    drm_edid_to_eld()
  drm/i915: Replace a bunch of connector->base.display_info with a local
    variable
  drm/i915: Account for sink max TMDS clock when checking the port clock

 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |   4 +-
 drivers/gpu/drm/drm_edid.c                     | 248 +++++++++++++------------
 drivers/gpu/drm/i915/intel_display.c           |  14 +-
 drivers/gpu/drm/i915/intel_hdmi.c              |   9 +-
 drivers/gpu/drm/radeon/radeon_connectors.c     |   4 +-
 include/drm/drm_connector.h                    |  15 +-
 6 files changed, 159 insertions(+), 135 deletions(-)

-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/10] drm/edid: Clear old audio latency values before parsing the new EDID
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
@ 2016-09-28 13:51 ` ville.syrjala
  2016-09-28 13:51 ` [PATCH 02/10] drm/edid: Clear old dvi_dual/max_tmds_clock " ville.syrjala
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

Clear out stale audio latency information (potentially from a previous
EDID) before constructing the ELD from the EDID.

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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 50541324a4ab..065896add86e 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3358,6 +3358,13 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 
 	memset(eld, 0, sizeof(connector->eld));
 
+	connector->latency_present[0] = false;
+	connector->latency_present[1] = false;
+	connector->video_latency[0] = 0;
+	connector->audio_latency[0] = 0;
+	connector->video_latency[1] = 0;
+	connector->audio_latency[1] = 0;
+
 	cea = drm_find_cea_extension(edid);
 	if (!cea) {
 		DRM_DEBUG_KMS("ELD: no CEA Extension found\n");
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/10] drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new EDID
  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 ` ville.syrjala
  2016-09-28 13:51 ` [PATCH v2 03/10] drm/edid: Make max_tmds_clock kHz instead of MHz ville.syrjala
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

Clear out old max_tmds_clock and dvi_dual information (possibly from a
previous EDID) before parsing the current EDID. Tne current EDID might
not even have these in its HDMI VSDB, which would mean that we'd leave
the old stale values in place.

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 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 065896add86e..d0166cc990cb 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3365,6 +3365,9 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 	connector->video_latency[1] = 0;
 	connector->audio_latency[1] = 0;
 
+	connector->max_tmds_clock = 0;
+	connector->dvi_dual = false;
+
 	cea = drm_find_cea_extension(edid);
 	if (!cea) {
 		DRM_DEBUG_KMS("ELD: no CEA Extension found\n");
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 03/10] drm/edid: Make max_tmds_clock kHz instead of MHz
  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 ` 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
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: Alex Deucher, intel-gfx, Christian König

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

We generally store clocks in kHz, so let's do that for the
HDMI max TMDS clock value as well. Less surpising.

v2: Deal with superfluous code shuffling

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 2 +-
 drivers/gpu/drm/drm_edid.c                     | 2 +-
 drivers/gpu/drm/radeon/radeon_connectors.c     | 2 +-
 include/drm/drm_connector.h                    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index 319a5e1d9389..ef63ab944fec 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -173,7 +173,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
 			mode_clock = amdgpu_connector->pixelclock_for_modeset;
 
 			/* Maximum allowable input clock in kHz */
-			max_tmds_clock = connector->max_tmds_clock * 1000;
+			max_tmds_clock = connector->max_tmds_clock;
 
 			DRM_DEBUG("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n",
 				  connector->name, mode_clock, max_tmds_clock);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index d0166cc990cb..b144d5ee66ea 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3262,7 +3262,7 @@ parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db)
 		connector->dvi_dual = db[6] & 1;
 	}
 	if (len >= 7)
-		connector->max_tmds_clock = db[7] * 5;
+		connector->max_tmds_clock = db[7] * 5000;
 	if (len >= 8) {
 		connector->latency_present[0] = db[8] >> 7;
 		connector->latency_present[1] = (db[8] >> 6) & 1;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index b79f3b002471..db5488732e31 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -203,7 +203,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
 			mode_clock = radeon_connector->pixelclock_for_modeset;
 
 			/* Maximum allowable input clock in kHz */
-			max_tmds_clock = connector->max_tmds_clock * 1000;
+			max_tmds_clock = connector->max_tmds_clock;
 
 			DRM_DEBUG("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n",
 					  connector->name, mode_clock, max_tmds_clock);
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 51a15deda161..5928cb74a06d 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -651,7 +651,7 @@ struct drm_connector {
 	/* EDID bits */
 	uint8_t eld[MAX_ELD_BYTES];
 	bool dvi_dual;
-	int max_tmds_clock;	/* in MHz */
+	int max_tmds_clock;	/* in kHz */
 	bool latency_present[2];
 	int video_latency[2];	/* [0]: progressive, [1]: interlaced */
 	int audio_latency[2];
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 04/10] drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (2 preceding siblings ...)
  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 ` ville.syrjala
  2016-09-28 13:51 ` [PATCH 05/10] drm/edid: Don't pass around drm_display_info needlessly ville.syrjala
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: Alex Deucher, intel-gfx, Christian König

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

We have the drm_display_info for storing information about the sink, so
let's move dvi_dual and max_tmds_clock in there.

v2: Deal with superfluous code shuffling
    Document dvi_dual and max_tmds_clock too

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |  4 ++--
 drivers/gpu/drm/drm_edid.c                     | 14 ++++++++------
 drivers/gpu/drm/radeon/radeon_connectors.c     |  4 ++--
 include/drm/drm_connector.h                    | 15 +++++++++++----
 4 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index ef63ab944fec..31dbf6c5445e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -168,12 +168,12 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
 		}
 
 		/* Any defined maximum tmds clock limit we must not exceed? */
-		if (connector->max_tmds_clock > 0) {
+		if (connector->display_info.max_tmds_clock > 0) {
 			/* mode_clock is clock in kHz for mode to be modeset on this connector */
 			mode_clock = amdgpu_connector->pixelclock_for_modeset;
 
 			/* Maximum allowable input clock in kHz */
-			max_tmds_clock = connector->max_tmds_clock;
+			max_tmds_clock = connector->display_info.max_tmds_clock;
 
 			DRM_DEBUG("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n",
 				  connector->name, mode_clock, max_tmds_clock);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b144d5ee66ea..81b9ef82af73 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3255,14 +3255,15 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
 static void
 parse_hdmi_vsdb(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) {
 		connector->eld[5] |= (db[6] >> 7) << 1;  /* Supports_AI */
-		connector->dvi_dual = db[6] & 1;
+		info->dvi_dual = db[6] & 1;
 	}
 	if (len >= 7)
-		connector->max_tmds_clock = db[7] * 5000;
+		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;
@@ -3281,8 +3282,8 @@ parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db)
 		    "latency present %d %d, "
 		    "video latency %d %d, "
 		    "audio latency %d %d\n",
-		    connector->dvi_dual,
-		    connector->max_tmds_clock,
+		    info->dvi_dual,
+		    info->max_tmds_clock,
 	      (int) connector->latency_present[0],
 	      (int) connector->latency_present[1],
 		    connector->video_latency[0],
@@ -3349,6 +3350,7 @@ 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;
@@ -3365,8 +3367,8 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 	connector->video_latency[1] = 0;
 	connector->audio_latency[1] = 0;
 
-	connector->max_tmds_clock = 0;
-	connector->dvi_dual = false;
+	info->max_tmds_clock = 0;
+	info->dvi_dual = false;
 
 	cea = drm_find_cea_extension(edid);
 	if (!cea) {
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index db5488732e31..50e96d2c593d 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -198,12 +198,12 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
 		}
 
 		/* Any defined maximum tmds clock limit we must not exceed? */
-		if (connector->max_tmds_clock > 0) {
+		if (connector->display_info.max_tmds_clock > 0) {
 			/* mode_clock is clock in kHz for mode to be modeset on this connector */
 			mode_clock = radeon_connector->pixelclock_for_modeset;
 
 			/* Maximum allowable input clock in kHz */
-			max_tmds_clock = connector->max_tmds_clock;
+			max_tmds_clock = connector->display_info.max_tmds_clock;
 
 			DRM_DEBUG("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n",
 					  connector->name, mode_clock, max_tmds_clock);
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 5928cb74a06d..287a610f464e 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -167,6 +167,17 @@ struct drm_display_info {
 	u32 bus_flags;
 
 	/**
+	 * @max_tmds_clock: Maximum TMDS clock rate supported by the
+	 * sink in kHz. 0 means undefined.
+	 */
+	int max_tmds_clock;
+
+	/**
+	 * @dvi_dual: Dual-link DVI sink?
+	 */
+	bool dvi_dual;
+
+	/**
 	 * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even
 	 * more stuff redundant with @bus_formats.
 	 */
@@ -515,8 +526,6 @@ struct drm_cmdline_mode {
  * @encoder_ids: valid encoders for this connector
  * @encoder: encoder driving this connector, if any
  * @eld: EDID-like data, if present
- * @dvi_dual: dual link DVI, if found
- * @max_tmds_clock: max clock rate, if found
  * @latency_present: AV delay info from ELD, if found
  * @video_latency: video latency info from ELD, if found
  * @audio_latency: audio latency info from ELD, if found
@@ -650,8 +659,6 @@ struct drm_connector {
 #define MAX_ELD_BYTES	128
 	/* EDID bits */
 	uint8_t eld[MAX_ELD_BYTES];
-	bool dvi_dual;
-	int max_tmds_clock;	/* in kHz */
 	bool latency_present[2];
 	int video_latency[2];	/* [0]: progressive, [1]: interlaced */
 	int audio_latency[2];
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/10] drm/edid: Don't pass around drm_display_info needlessly
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (3 preceding siblings ...)
  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 ` 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
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

We already pass the connector to drm_add_display_info() and
drm_assign_hdmi_deep_color_info(), so passing the
connector->display_info also is pointless.

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 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 81b9ef82af73..caa84a056779 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3738,9 +3738,9 @@ EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
  * Return true if HDMI deep color supported, false if not or unknown.
  */
 static bool drm_assign_hdmi_deep_color_info(struct edid *edid,
-                                            struct drm_display_info *info,
                                             struct drm_connector *connector)
 {
+	struct drm_display_info *info = &connector->display_info;
 	u8 *edid_ext, *hdmi;
 	int i;
 	int start_offset, end_offset;
@@ -3828,9 +3828,9 @@ static bool drm_assign_hdmi_deep_color_info(struct edid *edid,
 }
 
 static void drm_add_display_info(struct edid *edid,
-                                 struct drm_display_info *info,
                                  struct drm_connector *connector)
 {
+	struct drm_display_info *info = &connector->display_info;
 	u8 *edid_ext;
 
 	info->width_mm = edid->width_cm * 10;
@@ -3860,7 +3860,7 @@ static void drm_add_display_info(struct edid *edid,
 	}
 
 	/* HDMI deep color modes supported? Assign to info, if so */
-	drm_assign_hdmi_deep_color_info(edid, info, connector);
+	drm_assign_hdmi_deep_color_info(edid, connector);
 
 	/*
 	 * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3?
@@ -4096,7 +4096,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
 	if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
 		edid_fixup_preferred(connector, quirks);
 
-	drm_add_display_info(edid, &connector->display_info, connector);
+	drm_add_display_info(edid, connector);
 
 	if (quirks & EDID_QUIRK_FORCE_6BPC)
 		connector->display_info.bpc = 6;
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/10] drm/edid: Reduce the number of times we parse the CEA extension block
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (4 preceding siblings ...)
  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 ` 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
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

Instead of parsing parts of the CEA extension block in two places
to determine supported color formats and whatnot, let's just
consolidate it to one function. This also makes it possible to neatly
flatten drm_assign_hdmi_deep_color_info().

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 | 185 +++++++++++++++++++++------------------------
 1 file changed, 88 insertions(+), 97 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index caa84a056779..ef8ae691f7aa 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3733,105 +3733,110 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
-/*
- * Parse the CEA extension according to CEA-861-B.
- * Return true if HDMI deep color supported, false if not or unknown.
- */
-static bool drm_assign_hdmi_deep_color_info(struct edid *edid,
-                                            struct drm_connector *connector)
+static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
+					   const u8 *hdmi)
 {
 	struct drm_display_info *info = &connector->display_info;
-	u8 *edid_ext, *hdmi;
-	int i;
-	int start_offset, end_offset;
 	unsigned int dc_bpc = 0;
 
-	edid_ext = drm_find_cea_extension(edid);
-	if (!edid_ext)
-		return false;
+	/* HDMI supports at least 8 bpc */
+	info->bpc = 8;
 
-	if (cea_db_offsets(edid_ext, &start_offset, &end_offset))
-		return false;
+	if (cea_db_payload_len(hdmi) < 6)
+		return;
+
+	if (hdmi[6] & DRM_EDID_HDMI_DC_30) {
+		dc_bpc = 10;
+		info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_30;
+		DRM_DEBUG("%s: HDMI sink does deep color 30.\n",
+			  connector->name);
+	}
+
+	if (hdmi[6] & DRM_EDID_HDMI_DC_36) {
+		dc_bpc = 12;
+		info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_36;
+		DRM_DEBUG("%s: HDMI sink does deep color 36.\n",
+			  connector->name);
+	}
+
+	if (hdmi[6] & DRM_EDID_HDMI_DC_48) {
+		dc_bpc = 16;
+		info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_48;
+		DRM_DEBUG("%s: HDMI sink does deep color 48.\n",
+			  connector->name);
+	}
+
+	if (dc_bpc == 0) {
+		DRM_DEBUG("%s: No deep color support on this HDMI sink.\n",
+			  connector->name);
+		return;
+	}
+
+	DRM_DEBUG("%s: Assigning HDMI sink color depth as %d bpc.\n",
+		  connector->name, dc_bpc);
+	info->bpc = dc_bpc;
 
 	/*
-	 * Because HDMI identifier is in Vendor Specific Block,
-	 * search it from all data blocks of CEA extension.
+	 * Deep color support mandates RGB444 support for all video
+	 * modes and forbids YCRCB422 support for all video modes per
+	 * HDMI 1.3 spec.
 	 */
-	for_each_cea_db(edid_ext, i, start_offset, end_offset) {
-		if (cea_db_is_hdmi_vsdb(&edid_ext[i])) {
-			/* HDMI supports at least 8 bpc */
-			info->bpc = 8;
-
-			hdmi = &edid_ext[i];
-			if (cea_db_payload_len(hdmi) < 6)
-				return false;
-
-			if (hdmi[6] & DRM_EDID_HDMI_DC_30) {
-				dc_bpc = 10;
-				info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_30;
-				DRM_DEBUG("%s: HDMI sink does deep color 30.\n",
-						  connector->name);
-			}
+	info->color_formats = DRM_COLOR_FORMAT_RGB444;
 
-			if (hdmi[6] & DRM_EDID_HDMI_DC_36) {
-				dc_bpc = 12;
-				info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_36;
-				DRM_DEBUG("%s: HDMI sink does deep color 36.\n",
-						  connector->name);
-			}
+	/* YCRCB444 is optional according to spec. */
+	if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) {
+		info->color_formats |= DRM_COLOR_FORMAT_YCRCB444;
+		DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n",
+			  connector->name);
+	}
 
-			if (hdmi[6] & DRM_EDID_HDMI_DC_48) {
-				dc_bpc = 16;
-				info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_48;
-				DRM_DEBUG("%s: HDMI sink does deep color 48.\n",
-						  connector->name);
-			}
+	/*
+	 * Spec says that if any deep color mode is supported at all,
+	 * then deep color 36 bit must be supported.
+	 */
+	if (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) {
+		DRM_DEBUG("%s: HDMI sink should do DC_36, but does not!\n",
+			  connector->name);
+	}
+}
 
-			if (dc_bpc > 0) {
-				DRM_DEBUG("%s: Assigning HDMI sink color depth as %d bpc.\n",
-						  connector->name, dc_bpc);
-				info->bpc = dc_bpc;
-
-				/*
-				 * Deep color support mandates RGB444 support for all video
-				 * modes and forbids YCRCB422 support for all video modes per
-				 * HDMI 1.3 spec.
-				 */
-				info->color_formats = DRM_COLOR_FORMAT_RGB444;
-
-				/* YCRCB444 is optional according to spec. */
-				if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) {
-					info->color_formats |= DRM_COLOR_FORMAT_YCRCB444;
-					DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n",
-							  connector->name);
-				}
+static void drm_parse_cea_ext(struct drm_connector *connector,
+			      struct edid *edid)
+{
+	struct drm_display_info *info = &connector->display_info;
+	const u8 *edid_ext;
+	int i, start, end;
 
-				/*
-				 * Spec says that if any deep color mode is supported at all,
-				 * then deep color 36 bit must be supported.
-				 */
-				if (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) {
-					DRM_DEBUG("%s: HDMI sink should do DC_36, but does not!\n",
-							  connector->name);
-				}
+	edid_ext = drm_find_cea_extension(edid);
+	if (!edid_ext)
+		return;
 
-				return true;
-			}
-			else {
-				DRM_DEBUG("%s: No deep color support on this HDMI sink.\n",
-						  connector->name);
-			}
-		}
-	}
+	info->cea_rev = edid_ext[1];
 
-	return false;
+	/* The existence of a CEA block should imply RGB support */
+	info->color_formats = DRM_COLOR_FORMAT_RGB444;
+	if (edid_ext[3] & EDID_CEA_YCRCB444)
+		info->color_formats |= DRM_COLOR_FORMAT_YCRCB444;
+	if (edid_ext[3] & EDID_CEA_YCRCB422)
+		info->color_formats |= DRM_COLOR_FORMAT_YCRCB422;
+
+	if (cea_db_offsets(edid_ext, &start, &end))
+		return;
+
+	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);
+	}
 }
 
-static void drm_add_display_info(struct edid *edid,
-                                 struct drm_connector *connector)
+static void drm_add_display_info(struct drm_connector *connector,
+				 struct edid *edid)
 {
 	struct drm_display_info *info = &connector->display_info;
-	u8 *edid_ext;
 
 	info->width_mm = edid->width_cm * 10;
 	info->height_mm = edid->height_cm * 10;
@@ -3846,21 +3851,7 @@ static void drm_add_display_info(struct edid *edid,
 	if (!(edid->input & DRM_EDID_INPUT_DIGITAL))
 		return;
 
-	/* Get data from CEA blocks if present */
-	edid_ext = drm_find_cea_extension(edid);
-	if (edid_ext) {
-		info->cea_rev = edid_ext[1];
-
-		/* The existence of a CEA block should imply RGB support */
-		info->color_formats = DRM_COLOR_FORMAT_RGB444;
-		if (edid_ext[3] & EDID_CEA_YCRCB444)
-			info->color_formats |= DRM_COLOR_FORMAT_YCRCB444;
-		if (edid_ext[3] & EDID_CEA_YCRCB422)
-			info->color_formats |= DRM_COLOR_FORMAT_YCRCB422;
-	}
-
-	/* HDMI deep color modes supported? Assign to info, if so */
-	drm_assign_hdmi_deep_color_info(edid, connector);
+	drm_parse_cea_ext(connector, edid);
 
 	/*
 	 * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3?
@@ -4096,7 +4087,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
 	if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
 		edid_fixup_preferred(connector, quirks);
 
-	drm_add_display_info(edid, connector);
+	drm_add_display_info(connector, edid);
 
 	if (quirks & EDID_QUIRK_FORCE_6BPC)
 		connector->display_info.bpc = 6;
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/10] drm/edid: Clear the old cea_rev when there's no CEA extension in the new EDID
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (5 preceding siblings ...)
  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 ` ville.syrjala
  2016-09-28 13:51 ` [PATCH 08/10] drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld() ville.syrjala
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

It's not a good idea to leave stale cea_rev in the drm_display_info. The
current EDID might not even have a CEA ext block in which case we'd end
up leaving the stale value in place.

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index ef8ae691f7aa..48e529df344e 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3844,6 +3844,7 @@ static void drm_add_display_info(struct drm_connector *connector,
 	/* driver figures it out in this case */
 	info->bpc = 0;
 	info->color_formats = 0;
+	info->cea_rev = 0;
 
 	if (edid->revision < 3)
 		return;
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/10] drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld()
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (6 preceding siblings ...)
  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
  2016-09-28 13:51 ` [PATCH 09/10] drm/i915: Replace a bunch of connector->base.display_info with a local variable ville.syrjala
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/10] drm/i915: Replace a bunch of connector->base.display_info with a local variable
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (7 preceding siblings ...)
  2016-09-28 13:51 ` [PATCH 08/10] drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld() ville.syrjala
@ 2016-09-28 13:51 ` 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
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

Reduce the eyesore with a local variable.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8e464e089794..34ca03e621ba 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12657,22 +12657,22 @@ static void
 connected_sink_compute_bpp(struct intel_connector *connector,
 			   struct intel_crtc_state *pipe_config)
 {
+	const struct drm_display_info *info = &connector->base.display_info;
 	int bpp = pipe_config->pipe_bpp;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] checking for sink bpp constrains\n",
-		connector->base.base.id,
-		connector->base.name);
+		      connector->base.base.id,
+		      connector->base.name);
 
 	/* Don't use an invalid EDID bpc value */
-	if (connector->base.display_info.bpc &&
-	    connector->base.display_info.bpc * 3 < bpp) {
+	if (info->bpc != 0 && info->bpc * 3 < bpp) {
 		DRM_DEBUG_KMS("clamping display bpp (was %d) to EDID reported max of %d\n",
-			      bpp, connector->base.display_info.bpc*3);
-		pipe_config->pipe_bpp = connector->base.display_info.bpc*3;
+			      bpp, info->bpc * 3);
+		pipe_config->pipe_bpp = info->bpc * 3;
 	}
 
 	/* Clamp bpp to 8 on screens without EDID 1.4 */
-	if (connector->base.display_info.bpc == 0 && bpp > 24) {
+	if (info->bpc == 0 && bpp > 24) {
 		DRM_DEBUG_KMS("clamping display bpp (was %d) to default limit of 24\n",
 			      bpp);
 		pipe_config->pipe_bpp = 24;
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/10] drm/i915: Account for sink max TMDS clock when checking the port clock
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (8 preceding siblings ...)
  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-28 13:51 ` 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
  11 siblings, 1 reply; 16+ messages in thread
From: ville.syrjala @ 2016-09-28 13:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

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

It's perfectly legal for the sink to support 12bpc only for
some lower resolution modes, while the higher resolution modes
can only be used with 8bpc. So let's take the sink's max TMDS clock
into account before we go and decide that a particular mode can
be used with 12bpc.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 8d49800064df..8d46f5836746 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1220,10 +1220,17 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
 	int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
 
 	if (respect_downstream_limits) {
+		struct intel_connector *connector = hdmi->attached_connector;
+		const struct drm_display_info *info = &connector->base.display_info;
+
 		if (hdmi->dp_dual_mode.max_tmds_clock)
 			max_tmds_clock = min(max_tmds_clock,
 					     hdmi->dp_dual_mode.max_tmds_clock);
-		if (!hdmi->has_hdmi_sink)
+
+		if (info->max_tmds_clock)
+			max_tmds_clock = min(max_tmds_clock,
+					     info->max_tmds_clock);
+		else if (!hdmi->has_hdmi_sink)
 			max_tmds_clock = min(max_tmds_clock, 165000);
 	}
 
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* ✗ Fi.CI.BAT: warning for drm/edid: Clean up display_info stuff (rev2)
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (9 preceding siblings ...)
  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-28 14:20 ` Patchwork
  2016-09-28 19:28 ` [PATCH v2 00/10] drm/edid: Clean up display_info stuff Alex Deucher
  11 siblings, 0 replies; 16+ messages in thread
From: Patchwork @ 2016-09-28 14:20 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm/edid: Clean up display_info stuff (rev2)
URL   : https://patchwork.freedesktop.org/series/10580/
State : warning

== Summary ==

Series 10580v2 drm/edid: Clean up display_info stuff
https://patchwork.freedesktop.org/api/1.0/series/10580/revisions/2/mbox/

Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                dmesg-warn -> PASS       (fi-ilk-650)
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                pass       -> DMESG-WARN (fi-skl-6700hq)

fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:202  dwarn:0   dfail:0   fail:0   skip:42 
fi-bxt-t5700     total:244  pass:214  dwarn:0   dfail:0   fail:0   skip:30 
fi-hsw-4770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-hsw-4770r     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ilk-650       total:244  pass:182  dwarn:0   dfail:0   fail:2   skip:60 
fi-ivb-3520m     total:244  pass:219  dwarn:0   dfail:0   fail:0   skip:25 
fi-ivb-3770      total:244  pass:207  dwarn:0   dfail:0   fail:0   skip:37 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:221  dwarn:1   dfail:0   fail:0   skip:22 
fi-skl-6700k     total:244  pass:219  dwarn:1   dfail:0   fail:0   skip:24 
fi-skl-6770hq    total:244  pass:228  dwarn:1   dfail:0   fail:1   skip:14 
fi-snb-2520m     total:244  pass:208  dwarn:0   dfail:0   fail:0   skip:36 
fi-snb-2600      total:244  pass:207  dwarn:0   dfail:0   fail:0   skip:37 

Results at /archive/results/CI_IGT_test/Patchwork_2586/

bdb6dbd5e9c1a8dc3ccdd7964092cf5d6bc08ca2 drm-intel-nightly: 2016y-09m-28d-12h-10m-04s UTC integration manifest
15c5806 drm/i915: Account for sink max TMDS clock when checking the port clock
368d203 drm/i915: Replace a bunch of connector->base.display_info with a local variable
f2ccacf drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld()
69b7719 drm/edid: Clear the old cea_rev when there's no CEA extension in the new EDID
055e966 drm/edid: Reduce the number of times we parse the CEA extension block
a240775 drm/edid: Don't pass around drm_display_info needlessly
e7b391b drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info
49c7407 drm/edid: Make max_tmds_clock kHz instead of MHz
35a8d87 drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new EDID
46aae61 drm/edid: Clear old audio latency values before parsing the new EDID

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 00/10] drm/edid: Clean up display_info stuff
  2016-09-28 13:51 [PATCH v2 00/10] drm/edid: Clean up display_info stuff ville.syrjala
                   ` (10 preceding siblings ...)
  2016-09-28 14:20 ` ✗ Fi.CI.BAT: warning for drm/edid: Clean up display_info stuff (rev2) Patchwork
@ 2016-09-28 19:28 ` Alex Deucher
  11 siblings, 0 replies; 16+ messages in thread
From: Alex Deucher @ 2016-09-28 19:28 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Intel Graphics Development, Maling list - DRI developers

On Wed, Sep 28, 2016 at 9:51 AM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Rebased the series (previous version [1]) mostly due to code
> shuffling. i915 specific bits still need to be eyeballed by someone.
>
> Series available here:
> git://github.com/vsyrjala/linux.git hdmi_sink_tmds_limit_4
>
> [1] https://lists.freedesktop.org/archives/dri-devel/2016-August/114634.html

Patches 1-8 are:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> Ville Syrjälä (10):
>   drm/edid: Clear old audio latency values before parsing the new EDID
>   drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new
>     EDID
>   drm/edid: Make max_tmds_clock kHz instead of MHz
>   drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info
>   drm/edid: Don't pass around drm_display_info needlessly
>   drm/edid: Reduce the number of times we parse the CEA extension block
>   drm/edid: Clear the old cea_rev when there's no CEA extension in the
>     new EDID
>   drm/edid: Move dvi_dual/max_tmds_clock parsing out from
>     drm_edid_to_eld()
>   drm/i915: Replace a bunch of connector->base.display_info with a local
>     variable
>   drm/i915: Account for sink max TMDS clock when checking the port clock
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |   4 +-
>  drivers/gpu/drm/drm_edid.c                     | 248 +++++++++++++------------
>  drivers/gpu/drm/i915/intel_display.c           |  14 +-
>  drivers/gpu/drm/i915/intel_hdmi.c              |   9 +-
>  drivers/gpu/drm/radeon/radeon_connectors.c     |   4 +-
>  include/drm/drm_connector.h                    |  15 +-
>  6 files changed, 159 insertions(+), 135 deletions(-)
>
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 09/10] drm/i915: Replace a bunch of connector->base.display_info with a local variable
  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
  0 siblings, 0 replies; 16+ messages in thread
From: Ander Conselvan De Oliveira @ 2016-09-29  8:18 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx

On Wed, 2016-09-28 at 16:51 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Reduce the eyesore with a local variable.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index 8e464e089794..34ca03e621ba 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12657,22 +12657,22 @@ static void
>  connected_sink_compute_bpp(struct intel_connector *connector,
>  			   struct intel_crtc_state *pipe_config)
>  {
> +	const struct drm_display_info *info = &connector->base.display_info;
>  	int bpp = pipe_config->pipe_bpp;
>  
>  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] checking for sink bpp constrains\n",
> -		connector->base.base.id,
> -		connector->base.name);
> +		      connector->base.base.id,
> +		      connector->base.name);
>  
>  	/* Don't use an invalid EDID bpc value */
> -	if (connector->base.display_info.bpc &&
> -	    connector->base.display_info.bpc * 3 < bpp) {
> +	if (info->bpc != 0 && info->bpc * 3 < bpp) {
>  		DRM_DEBUG_KMS("clamping display bpp (was %d) to EDID reported
> max of %d\n",
> -			      bpp, connector->base.display_info.bpc*3);
> -		pipe_config->pipe_bpp = connector->base.display_info.bpc*3;
> +			      bpp, info->bpc * 3);
> +		pipe_config->pipe_bpp = info->bpc * 3;
>  	}
>  
>  	/* Clamp bpp to 8 on screens without EDID 1.4 */
> -	if (connector->base.display_info.bpc == 0 && bpp > 24) {
> +	if (info->bpc == 0 && bpp > 24) {
>  		DRM_DEBUG_KMS("clamping display bpp (was %d) to default limit
> of 24\n",
>  			      bpp);
>  		pipe_config->pipe_bpp = 24;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 10/10] drm/i915: Account for sink max TMDS clock when checking the port clock
  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
  0 siblings, 0 replies; 16+ messages in thread
From: Ander Conselvan De Oliveira @ 2016-09-29  8:21 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx

On Wed, 2016-09-28 at 16:51 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> It's perfectly legal for the sink to support 12bpc only for
> some lower resolution modes, while the higher resolution modes
> can only be used with 8bpc. So let's take the sink's max TMDS clock
> into account before we go and decide that a particular mode can
> be used with 12bpc.

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdmi.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> b/drivers/gpu/drm/i915/intel_hdmi.c
> index 8d49800064df..8d46f5836746 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1220,10 +1220,17 @@ static int hdmi_port_clock_limit(struct intel_hdmi
> *hdmi,
>  	int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
>  
>  	if (respect_downstream_limits) {
> +		struct intel_connector *connector = hdmi->attached_connector;
> +		const struct drm_display_info *info = &connector-
> >base.display_info;
> +
>  		if (hdmi->dp_dual_mode.max_tmds_clock)
>  			max_tmds_clock = min(max_tmds_clock,
>  					     hdmi-
> >dp_dual_mode.max_tmds_clock);
> -		if (!hdmi->has_hdmi_sink)
> +
> +		if (info->max_tmds_clock)
> +			max_tmds_clock = min(max_tmds_clock,
> +					     info->max_tmds_clock);
> +		else if (!hdmi->has_hdmi_sink)
>  			max_tmds_clock = min(max_tmds_clock, 165000);
>  	}
>  
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 09/10] drm/i915: Replace a bunch of connector->base.display_info with a local variable
  2016-08-03  6:33 [PATCH " ville.syrjala
@ 2016-08-03  6:33 ` ville.syrjala
  0 siblings, 0 replies; 16+ messages in thread
From: ville.syrjala @ 2016-08-03  6:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Tomeu Vizoso

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

Reduce the eyesore with a local variable.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a8e8cc8dfae9..b9cdf9060da6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12090,22 +12090,22 @@ static void
 connected_sink_compute_bpp(struct intel_connector *connector,
 			   struct intel_crtc_state *pipe_config)
 {
+	const struct drm_display_info *info = &connector->base.display_info;
 	int bpp = pipe_config->pipe_bpp;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] checking for sink bpp constrains\n",
-		connector->base.base.id,
-		connector->base.name);
+		      connector->base.base.id,
+		      connector->base.name);
 
 	/* Don't use an invalid EDID bpc value */
-	if (connector->base.display_info.bpc &&
-	    connector->base.display_info.bpc * 3 < bpp) {
+	if (info->bpc != 0 && info->bpc * 3 < bpp) {
 		DRM_DEBUG_KMS("clamping display bpp (was %d) to EDID reported max of %d\n",
-			      bpp, connector->base.display_info.bpc*3);
-		pipe_config->pipe_bpp = connector->base.display_info.bpc*3;
+			      bpp, info->bpc * 3);
+		pipe_config->pipe_bpp = info->bpc * 3;
 	}
 
 	/* Clamp bpp to default limit on screens without EDID 1.4 */
-	if (connector->base.display_info.bpc == 0) {
+	if (info->bpc == 0) {
 		int type = connector->base.connector_type;
 		int clamp_bpp = 24;
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-09-29  8:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 08/10] drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld() ville.syrjala
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 09/10] drm/i915: Replace a bunch of connector->base.display_info with a local variable ville.syrjala

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.