All of lore.kernel.org
 help / color / mirror / Atom feed
From: <mikita.lipski@amd.com>
To: amd-gfx@lists.freedesktop.org
Cc: David Francis <David.Francis@amd.com>,
	Jerry Zuo <Jerry.Zuo@amd.com>,
	dri-devel@lists.freedesktop.org,
	Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Subject: [PATCH 10/15] drm/amd/display: Use correct helpers to compute timeslots
Date: Wed, 18 Sep 2019 16:26:47 -0400	[thread overview]
Message-ID: <97921519cf0c4f0684fa11c81693f077930662d7.1568833906.git.mikita.lipski@amd.com> (raw)
In-Reply-To: <cover.1568833906.git.mikita.lipski@amd.com>

From: David Francis <David.Francis@amd.com>

We were using drm helpers to convert a timing into its
bandwidth, its bandwidth into pbn, and its pbn into timeslots

These helpers
-Did not take DSC timings into account
-Used the link rate and lane count of the link's aux device,
which are not the same as the link's current cap
-Did not take FEC into account (FEC reduces the PBN per timeslot)

For converting timing into PBN, use the new function
drm_dp_calc_pbn_mode_dsc that handles the DSC case

For converting PBN into time slots, amdgpu doesn't use the
'correct' atomic method (drm_dp_atomic_find_vcpi_slots), so
don't add a new helper to cover our approach. Use the same
means of calculating pbn per time slot as the DSC code.

Cc: Jerry Zuo <Jerry.Zuo@amd.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index b151a5a51a94..aaf3158534ab 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -188,8 +188,8 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
 	int slots = 0;
 	bool ret;
 	int clock;
-	int bpp = 0;
 	int pbn = 0;
+	int pbn_per_timeslot, bpp = 0;
 
 	aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
 
@@ -233,11 +233,19 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
 
 		bpp = bpp * 3;
 
-		/* TODO need to know link rate */
-
-		pbn = drm_dp_calc_pbn_mode(clock, bpp, false);
+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+		if (stream->timing.flags.DSC)
+			pbn = drm_dp_calc_pbn_mode(clock,
+						   stream->timing.dsc_cfg.bits_per_pixel,
+						   true);
+		else
+#endif
+			pbn = drm_dp_calc_pbn_mode(clock, bpp, false);
 
-		slots = drm_dp_find_vcpi_slots(mst_mgr, pbn);
+		/* Convert kilobits per second / 64 (for 64 timeslots) to pbn (54/64 megabytes per second) */
+		pbn_per_timeslot = dc_link_bandwidth_kbps(
+				stream->link, dc_link_get_link_cap(stream->link)) / (8 * 1000 * 54);
+		slots = DIV_ROUND_UP(pbn, pbn_per_timeslot);
 		ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, slots);
 
 		if (!ret)
-- 
2.17.1

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

  parent reply	other threads:[~2019-09-18 20:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 20:26 [PATCH 00/15] DSC MST support for AMDGPU mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26 ` [PATCH 02/15] drm/amdgpu: Add connector atomic check mikita.lipski
     [not found]   ` <c33861b3983fe3bb3dbd9c7026cec960f4ce1a6e.1568833906.git.mikita.lipski-5C7GfCeVMHo@public.gmane.org>
2019-09-19 23:38     ` Lyude Paul
2019-09-18 20:26 ` [PATCH 08/15] drm/dp_mst: Add helpers for MST DSC and virtual DPCD aux mikita.lipski
     [not found]   ` <8c8b8ad55ea714ef5c7f48ff5cd9b889dcead76b.1568833906.git.mikita.lipski-5C7GfCeVMHo@public.gmane.org>
2019-09-19 23:41     ` Lyude Paul
2019-09-18 20:26 ` mikita.lipski [this message]
2019-09-18 20:26 ` [PATCH 12/15] drm/amd/display: Validate DSC caps on MST endpoints mikita.lipski
     [not found] ` <cover.1568833906.git.mikita.lipski-5C7GfCeVMHo@public.gmane.org>
2019-09-18 20:26   ` [PATCH 01/15] drm/amdgpu: Add encoder atomic check mikita.lipski-5C7GfCeVMHo
2019-09-18 22:55     ` Lyude Paul
     [not found]     ` <0dba0e8b72c146cc1d27c8895b1c732e719fc371.1568833906.git.mikita.lipski-5C7GfCeVMHo@public.gmane.org>
2019-09-19 23:37       ` Lyude Paul
2019-09-18 20:26   ` [PATCH 03/15] drm/amdgpu: validate mst topology in " mikita.lipski-5C7GfCeVMHo
2019-09-19 23:40     ` Lyude Paul
2019-09-18 20:26   ` [PATCH 04/15] drm/dp_mst: Add PBN calculation for DSC modes mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26   ` [PATCH 05/15] drm/dp_mst: Parse FEC capability on MST ports mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26   ` [PATCH 06/15] drm/dp_mst: Add MST support to DP DPCD R/W functions mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26   ` [PATCH 07/15] drm/dp_mst: Fill branch->num_ports mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26   ` [PATCH 09/15] drm/dp_mst: Add new quirk for Synaptics MST hubs mikita.lipski-5C7GfCeVMHo
     [not found]     ` <6b11214d7aaa5bff6ba60846a1569b6f2ac25b0b.1568833906.git.mikita.lipski-5C7GfCeVMHo@public.gmane.org>
2019-09-19 23:44       ` Lyude Paul
2019-09-18 20:26   ` [PATCH 11/15] drm/amd/display: Initialize DSC PPS variables to 0 mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26   ` [PATCH 13/15] drm/amd/display: Write DSC enable to MST DPCD mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26   ` [PATCH 14/15] drm/amd/display: MST DSC compute fair share mikita.lipski-5C7GfCeVMHo
2019-09-18 20:26   ` [PATCH 15/15] drm/amd/display: Trigger modesets on MST DSC connectors mikita.lipski-5C7GfCeVMHo
2019-09-20  0:08     ` Lyude Paul
     [not found]       ` <2a8d122361f414101ef618cbf4fbd8fee29aabc9.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-10-01 14:04         ` Mikita Lipski

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=97921519cf0c4f0684fa11c81693f077930662d7.1568833906.git.mikita.lipski@amd.com \
    --to=mikita.lipski@amd.com \
    --cc=David.Francis@amd.com \
    --cc=Jerry.Zuo@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nicholas.kazlauskas@amd.com \
    /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.