Skip to contentSkip to conversation

drm/i915/cnl: Respect VBT max dp rate.

PATCH In review Rodrigo Vivi 4 participants 7 messages Jan 31, 2018 – Feb 1, 2018

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/1 drm/i915/cnl: Respect VBT max dp rate.

Since commit 'c4fb60b9aba9 ("drm/i915/bios: add DP max link rate to VBT child device struct")' we have the new entry defined for max dp rate that is in use for CNL.

Let's start using it for all VBT 216+ and also organize the cnl adjusted rates in terms of rate and not array size.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_bios.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c   | 37 +++++++++++++++++++++++++++++--------
 3 files changed, 33 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index c676269ed843..66dea5c9b10e 100644
@@ -1282,6 +1282,7 @@ struct ddi_vbt_port_info {
 
 	uint8_t dp_boost_level;
 	uint8_t hdmi_boost_level;
+	uint8_t dp_max_link_rate;
 };
 
 enum psr_lines_to_wait {
drivers/gpu/drm/i915/intel_bios.c +3 -0
index cf3f8f1ba6f7..c885daf4cc8d 100644
@@ -1230,6 +1230,9 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		info->alternate_aux_channel = aux_channel;
 
 		sanitize_aux_ch(dev_priv, port);
+
+		if (bdb_version >= 216 && child->dp_max_link_rate)
+			info->dp_max_link_rate = child->dp_max_link_rate;
 	}
 
 	if (bdb_version >= 158) {
drivers/gpu/drm/i915/intel_dp.c +29 -8
index 03d86ff9b805..1e34d7954355 100644
@@ -220,7 +220,7 @@ intel_dp_downstream_max_dotclock(struct intel_dp *intel_dp)
 	return max_dotclk;
 }
 
-static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size)
+static int cnl_adjusted_max_rate(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
@@ -230,17 +230,33 @@ static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size)
 
 	/* Low voltage SKUs are limited to max of 5.4G */
 	if (voltage == VOLTAGE_INFO_0_85V)
-		return size - 2;
+		return 540000;
 
 	/* For this SKU 8.1G is supported in all ports */
 	if (IS_CNL_WITH_PORT_F(dev_priv))
-		return size;
+		return 810000;
 
 	/* For other SKUs, max rate on ports A and B is 5.4G */
 	if (port == PORT_A || port == PORT_D)
-		return size - 2;
+		return 540000;
 
-	return size;
+	return 810000;
+}
+
+static int intel_dp_adjusted_max_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	const struct ddi_vbt_port_info *info =
+		&dev_priv->vbt.ddi_port_info[dig_port->base.port];
+
+	if (info->dp_max_link_rate)
+		return info->dp_max_link_rate;
+
+	if (IS_CANNONLAKE(dev_priv))
+		return cnl_adjusted_max_rate(intel_dp);
+
+	return INT_MAX; /* No adjusted limit */
 }
 
 static void
@@ -249,7 +265,8 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
 	const int *source_rates;
-	int size;
+	int i, size;
+	int max_rate = intel_dp_adjusted_max_rate(intel_dp);
 
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp->num_source_rates);
@@ -259,7 +276,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 		size = ARRAY_SIZE(bxt_rates);
 	} else if (IS_CANNONLAKE(dev_priv)) {
 		source_rates = cnl_rates;
-		size = cnl_adjusted_max_rate(intel_dp, ARRAY_SIZE(cnl_rates));
+		size = ARRAY_SIZE(cnl_rates);
 	} else if (IS_GEN9_BC(dev_priv)) {
 		source_rates = skl_rates;
 		size = ARRAY_SIZE(skl_rates);
@@ -272,8 +289,12 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 		size = ARRAY_SIZE(default_rates) - 1;
 	}
 
+	for (i = 0; i < size; i++)
+		if (source_rates[i] > max_rate)
+			break;
+
+	intel_dp->num_source_rates = i;
 	intel_dp->source_rates = source_rates;
-	intel_dp->num_source_rates = size;
 }
 
 static int intersect_rates(const int *source_rates, int source_len,
Signature · 6 lines
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915/cnl: Respect VBT max dp rate.

== Series Details ==

== Series Details ==

Series: drm/i915/cnl: Respect VBT max dp rate.
URL : https://patchwork.freedesktop.org/series/37441/
State : success

== Summary ==

Series 37441v1 drm/i915/cnl: Respect VBT max dp rate.
https://patchwork.freedesktop.org/api/1.0/series/37441/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> DMESG-FAIL (fi-elk-e7500) fdo#103989
Test kms_chamelium:
        Subgroup common-hpd-after-suspend:
                dmesg-warn -> PASS       (fi-skl-6700k2) fdo#104108
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:418s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:425s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:372s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:488s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:481s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:471s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:463s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:566s
fi-elk-e7500     total:224  pass:168  dwarn:9   dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:298s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:512s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:391s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:403s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:413s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:452s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:421s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:455s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:502s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:456s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:499s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:582s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:432s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:511s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:528s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:487s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:483s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:416s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:431s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:550s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:402s

Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:465s

ae93f9b9acf3e9cdbb2be1b68a97c3cc6db66fad drm-tip: 2018y-01m-31d-16h-31m-38s UTC integration manifest bd80bbf3d0d9 drm/i915/cnl: Respect VBT max dp rate.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7844/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.IGT: success for drm/i915/cnl: Respect VBT max dp rate.

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: drm/i915/cnl: Respect VBT max dp rate.
URL : https://patchwork.freedesktop.org/series/37441/
State : success

== Summary ==

Test kms_sysfs_edid_timing:

                warn       -> PASS       (shard-apl) fdo#100047
Test kms_flip:
        Subgroup modeset-vs-vblank-race-interruptible:
                pass       -> FAIL       (shard-snb) fdo#103060 +1
        Subgroup basic-plain-flip:
                skip       -> PASS       (shard-apl)
        Subgroup wf_vblank-ts-check-interruptible:
                fail       -> PASS       (shard-apl) fdo#100368
Test gem_eio:
        Subgroup in-flight-suspend:
                pass       -> FAIL       (shard-hsw) fdo#104676 +1
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-primscrn-shrfb-pgflip-blt:
                fail       -> PASS       (shard-apl) fdo#101623 +2
        Subgroup fbc-1p-primscrn-spr-indfb-draw-render:
                skip       -> PASS       (shard-apl) fdo#103167 +1
        Subgroup fbc-rgb101010-draw-mmap-gtt:
                skip       -> PASS       (shard-apl)
Test kms_plane_multiple:
        Subgroup atomic-pipe-b-tiling-yf:
                fail       -> PASS       (shard-apl)
        Subgroup legacy-pipe-a-tiling-x:
                skip       -> PASS       (shard-apl)
Test perf:
        Subgroup enable-disable:
                pass       -> FAIL       (shard-apl) fdo#103715
        Subgroup oa-exponents:
                fail       -> PASS       (shard-apl) fdo#102254
Test kms_vblank:
        Subgroup pipe-c-ts-continuation-suspend:
                dmesg-warn -> PASS       (shard-apl)
        Subgroup pipe-a-query-busy:
                skip       -> PASS       (shard-apl)
        Subgroup pipe-b-accuracy-idle:
                skip       -> PASS       (shard-apl)
        Subgroup pipe-c-wait-forked-busy:
                skip       -> PASS       (shard-apl)
        Subgroup crtc-id:
                skip       -> PASS       (shard-apl)
Test kms_draw_crc:
        Subgroup draw-method-xrgb8888-render-untiled:
                skip       -> PASS       (shard-apl)
        Subgroup draw-method-xrgb2101010-render-xtiled:
                skip       -> PASS       (shard-apl)
Test kms_color:
        Subgroup pipe-a-ctm-0-75:
                skip       -> PASS       (shard-apl)
Test kms_cursor_crc:
        Subgroup cursor-256x256-rapid-movement:
                skip       -> PASS       (shard-apl) fdo#103326
        Subgroup cursor-256x256-dpms:
                skip       -> PASS       (shard-apl)
        Subgroup cursor-128x42-random:
                skip       -> PASS       (shard-apl)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                skip       -> PASS       (shard-apl) fdo#103481
        Subgroup read-crc-pipe-c:
                skip       -> PASS       (shard-apl) fdo#103191
        Subgroup read-crc-pipe-a:
                skip       -> PASS       (shard-apl)
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-c:
                skip       -> PASS       (shard-apl)
        Subgroup extended-modeset-hang-oldfb-with-reset-render-c:
                skip       -> PASS       (shard-apl) fdo#103336
Test kms_plane_scaling:
        Subgroup pipe-c-plane-scaling:
                skip       -> PASS       (shard-apl)
Test kms_rotation_crc:
        Subgroup primary-rotation-90-y-tiled:
                skip       -> PASS       (shard-apl)
Test kms_cursor_legacy:
        Subgroup basic-flip-after-cursor-varying-size:
                skip       -> PASS       (shard-apl) fdo#102670
        Subgroup cursora-vs-flipa-atomic:
                skip       -> PASS       (shard-apl)
Test kms_chv_cursor_fail:
        Subgroup pipe-a-128x128-bottom-edge:
                skip       -> PASS       (shard-apl)
Test kms_rmfb:
        Subgroup rmfb-ioctl:
                skip       -> PASS       (shard-apl)
Test kms_ccs:
        Subgroup pipe-b-bad-pixel-format:
                skip       -> PASS       (shard-apl)

fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103715 https://bugs.freedesktop.org/show_bug.cgi?id=103715
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#103326 https://bugs.freedesktop.org/show_bug.cgi?id=103326
fdo#103481 https://bugs.freedesktop.org/show_bug.cgi?id=103481
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103336 https://bugs.freedesktop.org/show_bug.cgi?id=103336
fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670

shard-apl        total:2838 pass:1750 dwarn:1   dfail:0   fail:23  skip:1064 time:12621s
shard-hsw        total:2838 pass:1733 dwarn:1   dfail:0   fail:13  skip:1090 time:12012s
shard-snb        total:2838 pass:1329 dwarn:1   dfail:0   fail:11  skip:1497 time:6564s

Blacklisted hosts:
shard-kbl total:2838 pass:1806 dwarn:66 dfail:0 fail:22 skip:944 time:9653s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7844/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Rodrigo Vivi
Quoted 16 lines · Rodrigo Vivi

Since commit 'c4fb60b9aba9 ("drm/i915/bios: add DP max link rate to VBT child device struct")' we have the new entry defined for max dp rate that is in use for CNL.

Let's start using it for all VBT 216+ and also organize the cnl adjusted rates in terms of rate and not array size.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_bios.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c   | 37 +++++++++++++++++++++++++++++--------
 3 files changed, 33 insertions(+), 8 deletions(-)

<snip>

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 254

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
+static int intel_dp_adjusted_max_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	const struct ddi_vbt_port_info *info =
+		&dev_priv->vbt.ddi_port_info[dig_port->base.port];
+
+	if (info->dp_max_link_rate)
+		return info->dp_max_link_rate;

What if this value is higher than cnl_adjusted_max_rate() ?

-DK

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 260

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+
+	if (IS_CANNONLAKE(dev_priv))
+		return cnl_adjusted_max_rate(intel_dp);
+
+	return INT_MAX; /* No adjusted limit */
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#4 lore raw
Quoted 23 lines · Dhinakaran
Quoted 16 lines · Rodrigo Vivi

Since commit 'c4fb60b9aba9 ("drm/i915/bios: add DP max link rate to VBT child device struct")' we have the new entry defined for max dp rate that is in use for CNL.

Let's start using it for all VBT 216+ and also organize the cnl adjusted rates in terms of rate and not array size.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_bios.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c   | 37 +++++++++++++++++++++++++++++--------
 3 files changed, 33 insertions(+), 8 deletions(-)

<snip>

Quoted 11 lines

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 254

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
+static int intel_dp_adjusted_max_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	const struct ddi_vbt_port_info *info =
+		&dev_priv->vbt.ddi_port_info[dig_port->base.port];
+
+	if (info->dp_max_link_rate)
+		return info->dp_max_link_rate;

What if this value is higher than cnl_adjusted_max_rate() ?

Then VBT knows something about that SKU that we don't?! *shrug*

My understanding is that the purpose of that new VBT field is
to workaround bugs they know for certain combination and limit the max rate even more.

bugs like the one I had in a part here:

https://bugs.freedesktop.org/show_bug.cgi?id=103963

in this case flicker was gone by limiting the max rate.

But yeap, maybe vbt is bugged, so are you suggesting min(vbt, bspec) ?

Quoted 4 lines

-DK

Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 260

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+
+	if (IS_CANNONLAKE(dev_priv))
+		return cnl_adjusted_max_rate(intel_dp);
+
+	return INT_MAX; /* No adjusted limit */
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 36 lines · Rodrigo Vivi
Quoted 23 lines · Dhinakaran
Quoted 16 lines · Rodrigo Vivi

Since commit 'c4fb60b9aba9 ("drm/i915/bios: add DP max link rate to VBT child device struct")' we have the new entry defined for max dp rate that is in use for CNL.

Let's start using it for all VBT 216+ and also organize the cnl adjusted rates in terms of rate and not array size.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_bios.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c   | 37 +++++++++++++++++++++++++++++--------
 3 files changed, 33 insertions(+), 8 deletions(-)

<snip>

Quoted 11 lines

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 254

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
+static int intel_dp_adjusted_max_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	const struct ddi_vbt_port_info *info =
+		&dev_priv->vbt.ddi_port_info[dig_port->base.port];
+
+	if (info->dp_max_link_rate)
+		return info->dp_max_link_rate;

What if this value is higher than cnl_adjusted_max_rate() ?

Quoted 2 lines

Then VBT knows something about that SKU that we don't?! *shrug*

I have very little idea of how reliable VBT's are on SDP's or if they are always updated with the correct values. Having those fall back checks based on SKU and ports, which we know are definite HW limits, I feel is safer. However, I'll leave this to you as my knowledge is fairly limited.

Quoted 11 lines

My understanding is that the purpose of that new VBT field is
to workaround bugs they know for certain combination and limit the max rate even more.

bugs like the one I had in a part here:

https://bugs.freedesktop.org/show_bug.cgi?id=103963

in this case flicker was gone by limiting the max rate.

But yeap, maybe vbt is bugged, so are you suggesting min(vbt, bspec) ?

Yes.

Quoted 13 lines
Quoted 5 lines

-DK

Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 260

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+
+	if (IS_CANNONLAKE(dev_priv))
+		return cnl_adjusted_max_rate(intel_dp);
+
+	return INT_MAX; /* No adjusted limit */
 }
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Rodrigo Vivi
Quoted 7 lines · Rodrigo Vivi

Since commit 'c4fb60b9aba9 ("drm/i915/bios: add DP max link rate to VBT child device struct")' we have the new entry defined for max dp rate that is in use for CNL.

Let's start using it for all VBT 216+ and also organize the cnl adjusted rates in terms of rate and not array size.

Rodrigo, I took the liberty of rewriting this into three patches [1]. I hope you don't mind. I had some of this in mind way back when I rewrote the source/sink rate handling.

Some notes inline below. I've taken them into account in my series.

BR,
Jani.

[1] http://patchwork.freedesktop.org/patch/msgid/40f37f08cad33234cd86337d39e823ac6e55805f.1517482774.git.jani.nikula@intel.com

Quoted 27 lines
Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_bios.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c   | 37 +++++++++++++++++++++++++++++--------
 3 files changed, 33 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index c676269ed843..66dea5c9b10e 100644
@@ -1282,6 +1282,7 @@ struct ddi_vbt_port_info {
 
 	uint8_t dp_boost_level;
 	uint8_t hdmi_boost_level;
+	uint8_t dp_max_link_rate;
 };
 
 enum psr_lines_to_wait {
drivers/gpu/drm/i915/intel_bios.c +0 -0
index cf3f8f1ba6f7..c885daf4cc8d 100644

drivers/gpu/drm/i915/intel_bios.c static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, · line 1235

Quoted 6 lines
drivers/gpu/drm/i915/intel_bios.c +3 -0
@@ -1230,6 +1230,9 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		info->alternate_aux_channel = aux_channel;
 
 		sanitize_aux_ch(dev_priv, port);
+
+		if (bdb_version >= 216 && child->dp_max_link_rate)
+			info->dp_max_link_rate = child->dp_max_link_rate;

The info is two bits in VBT and needs to be translated to rates.

Quoted 36 lines
drivers/gpu/drm/i915/intel_bios.c +0 -0
 	}
 
 	if (bdb_version >= 158) {
drivers/gpu/drm/i915/intel_dp.c +6 -5
index 03d86ff9b805..1e34d7954355 100644
@@ -220,7 +220,7 @@ intel_dp_downstream_max_dotclock(struct intel_dp *intel_dp)
 	return max_dotclk;
 }
 
-static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size)
+static int cnl_adjusted_max_rate(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
@@ -230,17 +230,33 @@ static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size)
 
 	/* Low voltage SKUs are limited to max of 5.4G */
 	if (voltage == VOLTAGE_INFO_0_85V)
-		return size - 2;
+		return 540000;
 
 	/* For this SKU 8.1G is supported in all ports */
 	if (IS_CNL_WITH_PORT_F(dev_priv))
-		return size;
+		return 810000;
 
 	/* For other SKUs, max rate on ports A and B is 5.4G */
 	if (port == PORT_A || port == PORT_D)
-		return size - 2;
+		return 540000;
 
-	return size;
+	return 810000;
+}

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 254

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+
+static int intel_dp_adjusted_max_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	const struct ddi_vbt_port_info *info =
+		&dev_priv->vbt.ddi_port_info[dig_port->base.port];
+
+	if (info->dp_max_link_rate)
+		return info->dp_max_link_rate;

The VBT value needs mapping, and 0 actually means HBR3 in VBT.

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 257

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+
+	if (IS_CANNONLAKE(dev_priv))
+		return cnl_adjusted_max_rate(intel_dp);

Like DK noted, I think this should be a min() of the two.

drivers/gpu/drm/i915/intel_dp.c static int cnl_adjusted_max_rate(struct intel_dp *intel_dp, int size) · line 259

Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+
+	return INT_MAX; /* No adjusted limit */

I really want functions like this to return the actual max rate. I think returning INT_MAX here is a bit scary.

Quoted 23 lines
drivers/gpu/drm/i915/intel_dp.c +3 -2
 }
 
 static void
@@ -249,7 +265,8 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
 	const int *source_rates;
-	int size;
+	int i, size;
+	int max_rate = intel_dp_adjusted_max_rate(intel_dp);
 
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp->num_source_rates);
@@ -259,7 +276,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 		size = ARRAY_SIZE(bxt_rates);
 	} else if (IS_CANNONLAKE(dev_priv)) {
 		source_rates = cnl_rates;
-		size = cnl_adjusted_max_rate(intel_dp, ARRAY_SIZE(cnl_rates));
+		size = ARRAY_SIZE(cnl_rates);
 	} else if (IS_GEN9_BC(dev_priv)) {
 		source_rates = skl_rates;
 		size = ARRAY_SIZE(skl_rates);

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_source_rates(struct intel_dp *intel_dp) · line 294

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
@@ -272,8 +289,12 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 		size = ARRAY_SIZE(default_rates) - 1;
 	}
 
+	for (i = 0; i < size; i++)
+		if (source_rates[i] > max_rate)
+			break;

We already have code to do this stuff, so I refactored and reused it.

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +2 -1
+
+	intel_dp->num_source_rates = i;
 	intel_dp->source_rates = source_rates;
-	intel_dp->num_source_rates = size;
 }
 
 static int intersect_rates(const int *source_rates, int source_len,
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx