From: Imre Deak <imre.deak@intel.com> To: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/dp_mst: Fix PBN divider calculation for UHBR rates Date: Mon, 13 Nov 2023 22:11:10 +0200 [thread overview] Message-ID: <20231113201110.510724-4-imre.deak@intel.com> (raw) In-Reply-To: <20231113201110.510724-1-imre.deak@intel.com> The current way of calculating the pbn_div value, the link BW per each MTP slot, worked only for DP 1.4 link rates. Fix things up for UHBR rates calculating with the correct channel coding efficiency based on the link rate. On UHBR the resulting pbn_div value is not an integer (vs. DP 1.4 where the value is always an integer), so ideally a scaled value containing the fractional part should be returned, so that the PBN -> MTP slot count (aka TU size) conversion can be done with less error. For now return a rounded-down value - which can result in +1 excess MTP slot getting allocated on UHBR links. Cc: Lyude Paul <lyude@redhat.com> Cc: dri-devel@lists.freedesktop.org Signed-off-by: Imre Deak <imre.deak@intel.com> --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 15 +++++++++++++-- include/drm/display/drm_dp_helper.h | 13 +++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 4d72c9a32026e..940a9fc0d0244 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -3582,12 +3582,23 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr, int drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr, int link_rate, int link_lane_count) { + int ret; + if (link_rate == 0 || link_lane_count == 0) drm_dbg_kms(mgr->dev, "invalid link rate/lane count: (%d / %d)\n", link_rate, link_lane_count); - /* See DP v2.0 2.6.4.2, VCPayload_Bandwidth_for_OneTimeSlotPer_MTP_Allocation */ - return link_rate * link_lane_count / 54000; + /* See DP v2.0 2.6.4.2, 2.7.6.3 VCPayload_Bandwidth_for_OneTimeSlotPer_MTP_Allocation */ + /* + * TODO: Return the value with a higher precision, allowing a better + * slots per MTP allocation granularity. With the current returned + * value +1 slot/MTP can get allocated on UHBR links. + */ + ret = mul_u32_u32(link_rate * link_lane_count, + drm_dp_bw_channel_coding_efficiency(drm_dp_is_uhbr_rate(link_rate))) / + (1000000ULL * 8 * 5400); + + return ret; } EXPORT_SYMBOL(drm_dp_get_vc_payload_bw); diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index caee29d28463c..18ff6af0b5a31 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -251,6 +251,19 @@ drm_edp_backlight_supported(const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE]) return !!(edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP); } +/** + * drm_dp_is_uhbr_rate - Determine if a link rate is UHBR + * @link_rate: link rate in 10kbits/s units + * + * Determine if the provided link rate is an UHBR rate. + * + * Returns: %True if @link_rate is an UHBR rate. + */ +static inline bool drm_dp_is_uhbr_rate(int link_rate) +{ + return link_rate >= 1000000; +} + /* * DisplayPort AUX channel */ -- 2.39.2
WARNING: multiple messages have this Message-ID (diff)
From: Imre Deak <imre.deak@intel.com> To: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 4/4] drm/dp_mst: Fix PBN divider calculation for UHBR rates Date: Mon, 13 Nov 2023 22:11:10 +0200 [thread overview] Message-ID: <20231113201110.510724-4-imre.deak@intel.com> (raw) In-Reply-To: <20231113201110.510724-1-imre.deak@intel.com> The current way of calculating the pbn_div value, the link BW per each MTP slot, worked only for DP 1.4 link rates. Fix things up for UHBR rates calculating with the correct channel coding efficiency based on the link rate. On UHBR the resulting pbn_div value is not an integer (vs. DP 1.4 where the value is always an integer), so ideally a scaled value containing the fractional part should be returned, so that the PBN -> MTP slot count (aka TU size) conversion can be done with less error. For now return a rounded-down value - which can result in +1 excess MTP slot getting allocated on UHBR links. Cc: Lyude Paul <lyude@redhat.com> Cc: dri-devel@lists.freedesktop.org Signed-off-by: Imre Deak <imre.deak@intel.com> --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 15 +++++++++++++-- include/drm/display/drm_dp_helper.h | 13 +++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 4d72c9a32026e..940a9fc0d0244 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -3582,12 +3582,23 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr, int drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr, int link_rate, int link_lane_count) { + int ret; + if (link_rate == 0 || link_lane_count == 0) drm_dbg_kms(mgr->dev, "invalid link rate/lane count: (%d / %d)\n", link_rate, link_lane_count); - /* See DP v2.0 2.6.4.2, VCPayload_Bandwidth_for_OneTimeSlotPer_MTP_Allocation */ - return link_rate * link_lane_count / 54000; + /* See DP v2.0 2.6.4.2, 2.7.6.3 VCPayload_Bandwidth_for_OneTimeSlotPer_MTP_Allocation */ + /* + * TODO: Return the value with a higher precision, allowing a better + * slots per MTP allocation granularity. With the current returned + * value +1 slot/MTP can get allocated on UHBR links. + */ + ret = mul_u32_u32(link_rate * link_lane_count, + drm_dp_bw_channel_coding_efficiency(drm_dp_is_uhbr_rate(link_rate))) / + (1000000ULL * 8 * 5400); + + return ret; } EXPORT_SYMBOL(drm_dp_get_vc_payload_bw); diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index caee29d28463c..18ff6af0b5a31 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -251,6 +251,19 @@ drm_edp_backlight_supported(const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE]) return !!(edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP); } +/** + * drm_dp_is_uhbr_rate - Determine if a link rate is UHBR + * @link_rate: link rate in 10kbits/s units + * + * Determine if the provided link rate is an UHBR rate. + * + * Returns: %True if @link_rate is an UHBR rate. + */ +static inline bool drm_dp_is_uhbr_rate(int link_rate) +{ + return link_rate >= 1000000; +} + /* * DisplayPort AUX channel */ -- 2.39.2
next prev parent reply other threads:[~2023-11-13 20:11 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-13 20:11 [Intel-gfx] [PATCH 1/4] drm/i915/dp: Account for channel coding efficiency on UHBR links Imre Deak 2023-11-13 20:11 ` [Intel-gfx] [PATCH 2/4] drm/i915/dp: Fix UHBR link M/N values Imre Deak 2023-11-14 3:29 ` Murthy, Arun R 2023-11-14 7:43 ` Imre Deak 2023-11-15 13:29 ` Murthy, Arun R 2023-11-13 20:11 ` [Intel-gfx] [PATCH 3/4] drm/i915/dp_mst: Fix PBN / MTP_TU size calculation for UHBR rates Imre Deak 2023-11-15 13:38 ` Imre Deak 2023-11-15 13:41 ` Murthy, Arun R 2023-11-15 14:25 ` Imre Deak 2023-11-16 5:37 ` Murthy, Arun R 2023-11-13 20:11 ` Imre Deak [this message] 2023-11-13 20:11 ` [Intel-gfx] [PATCH 4/4] drm/dp_mst: Fix PBN divider " Imre Deak 2023-11-13 22:54 ` kernel test robot 2023-11-13 22:54 ` [Intel-gfx] " kernel test robot 2023-11-13 22:54 ` kernel test robot 2023-11-13 23:05 ` kernel test robot 2023-11-13 23:05 ` [Intel-gfx] " kernel test robot 2023-11-13 23:05 ` kernel test robot 2023-11-13 22:32 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/4] drm/i915/dp: Account for channel coding efficiency on UHBR links Patchwork 2023-11-13 22:50 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork 2023-11-14 2:07 ` [Intel-gfx] [PATCH 1/4] " Murthy, Arun R 2023-11-14 9:00 ` Jani Nikula 2023-11-14 13:07 ` Imre Deak 2023-11-15 13:42 ` Imre Deak
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=20231113201110.510724-4-imre.deak@intel.com \ --to=imre.deak@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.