All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Francis, David" <David.Francis@amd.com>
To: "Kazlauskas, Nicholas" <Nicholas.Kazlauskas@amd.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Zuo, Jerry" <Jerry.Zuo@amd.com>
Subject: Re: [PATCH 06/14] drm/amd/display: Use dc helpers to compute timeslot distribution
Date: Mon, 19 Aug 2019 19:35:18 +0000	[thread overview]
Message-ID: <BN8PR12MB32175F50627A88D5290A41BAEFA80@BN8PR12MB3217.namprd12.prod.outlook.com> (raw)
In-Reply-To: <0e577846-dd67-5d77-e579-0f69700c86ad@amd.com>

On 8/19/19 11:50 AM, David Francis wrote:
>> 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)
>>
>> Use the DC helpers (dc_bandwidth_in_kbps_from_timing,
>> dc_link_bandwidth_kbps) instead
>>
>> Cc: Jerry Zuo <Jerry.Zuo@amd.com>
>> Signed-off-by: David Francis <David.Francis@amd.com>
>
>Wouldn't this be a good candidate for shared DRM helpers or to modify
>the existing ones to support this usecase?
>
>Seems like this would be shared across drivers.
>
>Nicholas Kazlauskas
>

These functions use information which is not stored in drm structs but tracked in
a driver-specific way
 - Whether or not FEC is enabled
 - Whether or not DSC is enabled, and with what config
 - The current link setting
This could be shifted into drm helpers, but it would require functions with signatures like
drm_dp_calc_pbn_mode(clock, bpp, dsc_bpp)
and
drm_dp_find_vcpi_slots(mst_mgr, pbn, fec_enabled, lane_count, link_rate)
and each driver would need to convert their own structs into those fields
before calling these helpers.

Is that worth it?

>> ---
>>   .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 41 ++++---------------
>>   1 file changed, 8 insertions(+), 33 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 5f2c315b18ba..b32c0790399a 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
>> @@ -189,8 +189,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;
>>
>>        aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
>>
>> @@ -205,40 +205,15 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
>>        mst_port = aconnector->port;
>>
>>        if (enable) {
>> -             clock = stream->timing.pix_clk_100hz / 10;
>> -
>> -             switch (stream->timing.display_color_depth) {
>> -
>> -             case COLOR_DEPTH_666:
>> -                     bpp = 6;
>> -                     break;
>> -             case COLOR_DEPTH_888:
>> -                     bpp = 8;
>> -                     break;
>> -             case COLOR_DEPTH_101010:
>> -                     bpp = 10;
>> -                     break;
>> -             case COLOR_DEPTH_121212:
>> -                     bpp = 12;
>> -                     break;
>> -             case COLOR_DEPTH_141414:
>> -                     bpp = 14;
>> -                     break;
>> -             case COLOR_DEPTH_161616:
>> -                     bpp = 16;
>> -                     break;
>> -             default:
>> -                     ASSERT(bpp != 0);
>> -                     break;
>> -             }
>> -
>> -             bpp = bpp * 3;
>> -
>> -             /* TODO need to know link rate */
>> +             clock = dc_bandwidth_in_kbps_from_timing(&stream->timing);
>>
>> -             pbn = drm_dp_calc_pbn_mode(clock, bpp);
>> +             /* dc_bandwidth_in_kbps_from_timing already takes bpp into account */
>> +             pbn = drm_dp_calc_pbn_mode(clock, 1);
>>
>> -             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)

________________________________________
From: Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>
Sent: August 19, 2019 3:21 PM
To: Francis, David; dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org
Cc: Zuo, Jerry
Subject: Re: [PATCH 06/14] drm/amd/display: Use dc helpers to compute timeslot distribution

On 8/19/19 11:50 AM, David Francis wrote:
> 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)
>
> Use the DC helpers (dc_bandwidth_in_kbps_from_timing,
> dc_link_bandwidth_kbps) instead
>
> Cc: Jerry Zuo <Jerry.Zuo@amd.com>
> Signed-off-by: David Francis <David.Francis@amd.com>

Wouldn't this be a good candidate for shared DRM helpers or to modify
the existing ones to support this usecase?

Seems like this would be shared across drivers.

Nicholas Kazlauskas

> ---
>   .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 41 ++++---------------
>   1 file changed, 8 insertions(+), 33 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 5f2c315b18ba..b32c0790399a 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
> @@ -189,8 +189,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;
>
>       aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
>
> @@ -205,40 +205,15 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
>       mst_port = aconnector->port;
>
>       if (enable) {
> -             clock = stream->timing.pix_clk_100hz / 10;
> -
> -             switch (stream->timing.display_color_depth) {
> -
> -             case COLOR_DEPTH_666:
> -                     bpp = 6;
> -                     break;
> -             case COLOR_DEPTH_888:
> -                     bpp = 8;
> -                     break;
> -             case COLOR_DEPTH_101010:
> -                     bpp = 10;
> -                     break;
> -             case COLOR_DEPTH_121212:
> -                     bpp = 12;
> -                     break;
> -             case COLOR_DEPTH_141414:
> -                     bpp = 14;
> -                     break;
> -             case COLOR_DEPTH_161616:
> -                     bpp = 16;
> -                     break;
> -             default:
> -                     ASSERT(bpp != 0);
> -                     break;
> -             }
> -
> -             bpp = bpp * 3;
> -
> -             /* TODO need to know link rate */
> +             clock = dc_bandwidth_in_kbps_from_timing(&stream->timing);
>
> -             pbn = drm_dp_calc_pbn_mode(clock, bpp);
> +             /* dc_bandwidth_in_kbps_from_timing already takes bpp into account */
> +             pbn = drm_dp_calc_pbn_mode(clock, 1);
>
> -             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)
>

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

  reply	other threads:[~2019-08-19 19:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 15:50 [PATCH 00/14] Display Stream Compression (DSC) for AMD Navi David Francis
2019-08-19 15:50 ` [PATCH 02/14] Revert "drm/amd/display: navi10 bring up skip dsc encoder config" David Francis
     [not found] ` <20190819155038.1771-1-David.Francis-5C7GfCeVMHo@public.gmane.org>
2019-08-19 15:50   ` [PATCH 01/14] Revert "drm/amd/display: skip dsc config for navi10 bring up" David Francis
2019-08-19 15:50   ` [PATCH 03/14] Revert "drm/amd/display: add global master update lock for DCN2" David Francis
2019-08-19 15:50   ` [PATCH 04/14] Revert "drm/amd/display: Fix underscan not using proper scaling" David Francis
2019-08-19 15:50   ` [PATCH 05/14] drm/amd/display: Enable SST DSC in DM David Francis
     [not found]     ` <20190819155038.1771-6-David.Francis-5C7GfCeVMHo@public.gmane.org>
2019-08-19 18:46       ` Mikita Lipski
2019-08-19 15:50   ` [PATCH 06/14] drm/amd/display: Use dc helpers to compute timeslot distribution David Francis
     [not found]     ` <20190819155038.1771-7-David.Francis-5C7GfCeVMHo@public.gmane.org>
2019-08-19 19:21       ` Kazlauskas, Nicholas
2019-08-19 19:35         ` Francis, David [this message]
2019-08-19 15:50   ` [PATCH 07/14] drm/amd/display: Initialize DSC PPS variables to 0 David Francis
2019-08-19 19:36     ` Kazlauskas, Nicholas
2019-08-19 15:50   ` [PATCH 08/14] drm/dp-mst: Parse FEC capability on MST ports David Francis
2019-08-19 15:50   ` [PATCH 09/14] drm/dp-mst: Export symbols for dpcd read/write David Francis
2019-08-19 15:50   ` [PATCH 10/14] drm/dp-mst: Fill branch->num_ports David Francis
2019-08-19 15:50   ` [PATCH 11/14] drm/amd/display: Validate DSC caps on MST endpoints David Francis
2019-08-19 15:50   ` [PATCH 12/14] drm/amd/display: Write DSC enable to MST DPCD David Francis
2019-08-19 15:50   ` [PATCH 13/14] drm/amd/display: MST DSC compute fair share David Francis
2019-08-19 15:50   ` [PATCH 14/14] drm/amd/display: Trigger modesets on MST DSC connectors David Francis
     [not found]     ` <20190819155038.1771-15-David.Francis-5C7GfCeVMHo@public.gmane.org>
2019-08-19 19:34       ` Kazlauskas, Nicholas
2019-08-19 19:40         ` Francis, David

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=BN8PR12MB32175F50627A88D5290A41BAEFA80@BN8PR12MB3217.namprd12.prod.outlook.com \
    --to=david.francis@amd.com \
    --cc=Jerry.Zuo@amd.com \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.