DSC MST support for DRM and AMDGPU
Subsystems (7)
v8 cover DSC MST support for DRM and AMDGPU
From: Mikita Lipski <[email protected]>
This set of patches is a continuation of DSC enablement patches for AMDGPU. This set enables DSC on MST. It also contains implementation of both encoder and connector atomic check routines.
These patches have been introduced in multiple iterations to the mailing list before. These patches were developed by David Francis as part of his work on DSC.
v2: squashed previously 3 separate atomic check patches, separate atomic check for dsc connectors, track vcpi and pbn on connectors.
v3: Moved modeset trigger on affected MST displays to DRM
v4: Fix warnings, use current mode's bpc rather than display's maximum capable one
v5: Moving branch's bandwidth validation to DRM, Added function to enable DSC per port in DRM
v6: Compute fair share uses DRM helper for BW validation
v7: Add helper to overwrite PBN divider per slot,
Add helper function to trigger modeset on affected DSC connectors
in DRM
v8: Rebased on top of the MST refactor patches that were on DRM-tip
Some cosmetic and cleanup changes
David Francis (9):
drm/dp_mst: Add PBN calculation for DSC modes drm/dp_mst: Parse FEC capability on MST ports drm/dp_mst: Add MST support to DP DPCD R/W functions drm/dp_mst: Fill branch->num_ports
drm/dp_mst: Add helpers for MST DSC and virtual DPCD aux drm/amd/display: Initialize DSC PPS variables to 0 drm/amd/display: Validate DSC caps on MST endpoints drm/amd/display: Write DSC enable to MST DPCD drm/amd/display: MST DSC compute fair share
Mikita Lipski (8):
drm/dp_mst: Add new quirk for Synaptics MST hubs drm/dp_mst: Manually overwrite PBN divider for calculating timeslots drm/dp_mst: Add DSC enablement helpers to DRM
drm/dp_mst: Add branch bandwidth validation to MST atomic check drm/amd/display: Add PBN per slot calculation for DSC drm/amd/display: Recalculate VCPI slots for new DSC connectors drm/dp_mst: Add helper to trigger modeset on affected DSC MST CRTCs drm/amd/display: Trigger modesets on MST DSC connectors
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 117 ++++- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 + .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 19 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 399 +++++++++++++++++- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 5 + .../drm/amd/display/dc/core/dc_link_hwss.c | 3 + .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 3 + .../drm/amd/display/dc/dcn20/dcn20_resource.c | 7 +- .../drm/amd/display/dc/dcn20/dcn20_resource.h | 1 + drivers/gpu/drm/drm_dp_aux_dev.c | 12 +- drivers/gpu/drm/drm_dp_helper.c | 32 +- drivers/gpu/drm/drm_dp_mst_topology.c | 395 ++++++++++++++++- drivers/gpu/drm/i915/display/intel_dp_mst.c | 5 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 5 +- drivers/gpu/drm/radeon/radeon_dp_mst.c | 2 +- include/drm/drm_dp_helper.h | 7 + include/drm/drm_dp_mst_helper.h | 19 +- 17 files changed, 988 insertions(+), 44 deletions(-)
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 1/17 drm/dp_mst: Add PBN calculation for DSC modes
From: David Francis <[email protected]>
With DSC, bpp can be fractional in multiples of 1/16.
Change drm_dp_calc_pbn_mode to reflect this, adding a new parameter bool dsc. When this parameter is true, treat the bpp parameter as having units not of bits per pixel, but 1/16 of a bit per pixel
v2: Don't add separate function for this
v3: Keep the calculation in a single equation
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/drm_dp_mst_topology.c | 38 ++++++++++++++++++- drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- drivers/gpu/drm/radeon/radeon_dp_mst.c | 2 +- include/drm/drm_dp_mst_helper.h | 3 +- 6 files changed, 43 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -4967,7 +4967,7 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, is_y420); bpp =convert_dc_color_depth_into_bpc (color_depth) *3 ; clock = adjusted_mode->clock; - dm_new_connector_state->pbn =drm_dp_calc_pbn_mode (clock, bpp); + dm_new_connector_state->pbn =drm_dp_calc_pbn_mode (clock, bpp, false); } dm_new_connector_state->vcpi_slots = drm_dp_atomic_find_vcpi_slots(state, mst_mgr,
drivers/gpu/drm/drm_dp_mst_topology.c +37 -1
@@ -4342,10 +4342,11 @@ EXPORT_SYMBOL(drm_dp_check_act_status);* drm_dp_calc_pbn_mode() - Calculate the PBN for a mode. * @clock: dot clock for the mode * @bpp: bpp for the mode. +* @dsc: DSC mode. If true, bpp has units of 1/16 of a bit per pixel * * This uses the formula in the spec to calculate the PBN value for a mode. */ -int drm_dp_calc_pbn_mode (int clock,int bpp) +int drm_dp_calc_pbn_mode (int clock,int bpp,bool dsc) {/* * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006
@@ -4356,12 +4357,47 @@ int drm_dp_calc_pbn_mode(int clock, int bpp)* peak_kbps *= (1006/1000) * peak_kbps *= (64/54) * peak_kbps *= 8 convert to bytes +* +* If the bpp is in units of 1/16, further divide by 16. Put this +* factor in the numerator rather than the denominator to avoid +* integer overflow */ + +if (dsc) +return DIV_ROUND_UP_ULL (mul_u32_u32 (clock * bpp,64 *1006 /16 ), +8 *54 *1000 *1000 ); +return DIV_ROUND_UP_ULL (mul_u32_u32 (clock * bpp,64 *1006 ),8 *54 *1000 *1000 ); + }EXPORT_SYMBOL (drm_dp_calc_pbn_mode); +static int test_calc_pbn_mode (void ) +{ +int ret; + ret =drm_dp_calc_pbn_mode (154000 ,30 , false); +if (ret !=689 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +154000 ,30 ,689 , ret); +return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (234000 ,30 , false); +if (ret !=1047 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +234000 ,30 ,1047 , ret); +return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (297000 ,24 , false); +if (ret !=1063 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +297000 ,24 ,1063 , ret); +return -EINVAL ; + } +return 0 ; +} + +/* we want to kick the TX after we've ack the up/down IRQs. */ static void drm_dp_mst_kick_tx (struct drm_dp_mst_topology_mgr *mgr) {
drivers/gpu/drm/i915/display/intel_dp_mst.c +2 -1
@@ -61,7 +61,8 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, crtc_state->pipe_bpp = bpp; crtc_state->pbn =drm_dp_calc_pbn_mode (adjusted_mode->crtc_clock, - crtc_state->pipe_bpp); + crtc_state->pipe_bpp, + false); slots =drm_dp_atomic_find_vcpi_slots (state, &intel_dp->mst_mgr, port, crtc_state->pbn);
drivers/gpu/drm/nouveau/dispnv50/disp.c +1 -1
@@ -782,7 +782,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,const int bpp = connector->display_info.bpc *3 ;const int clock = crtc_state->adjusted_mode.clock; - asyh->dp.pbn =drm_dp_calc_pbn_mode (clock, bpp); + asyh->dp.pbn =drm_dp_calc_pbn_mode (clock, bpp, false); } slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr,
drivers/gpu/drm/radeon/radeon_dp_mst.c +1 -1
@@ -518,7 +518,7 @@ static bool radeon_mst_mode_fixup(struct drm_encoder *encoder, mst_enc = radeon_encoder->enc_priv; - mst_enc->pbn =drm_dp_calc_pbn_mode (adjusted_mode->clock, bpp); + mst_enc->pbn =drm_dp_calc_pbn_mode (adjusted_mode->clock, bpp, false); mst_enc->primary->active_device = mst_enc->primary->devices & mst_enc->connector->devices; DRM_DEBUG_KMS("setting active device to %08x from %08x %08x for encoder %d\n",
include/drm/drm_dp_mst_helper.h +1 -2
@@ -719,8 +719,7 @@ bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,struct edid *drm_dp_mst_get_edid (struct drm_connector *connector,struct drm_dp_mst_topology_mgr *mgr,struct drm_dp_mst_port *port); -int drm_dp_calc_pbn_mode (int clock,int bpp); - +int drm_dp_calc_pbn_mode (int clock,int bpp,bool dsc);bool drm_dp_mst_allocate_vcpi (struct drm_dp_mst_topology_mgr *mgr,struct drm_dp_mst_port *port,int pbn,int slots);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
kbuild test robot
build botRe: [PATCH v8 01/17] drm/dp_mst: Add PBN calculation for DSC modes
Thank you for the patch! Perhaps something to improve:
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20191203]
[cannot apply to drm-intel/for-linux-next linus/master v5.4-rc8 drm-exynos/exynos-drm-next v5.4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/mikita-lipski-amd-com/DSC-MST-support-for-DRM-and-AMDGPU/20191204-020604 base: 1ab75b2e415a29dba9aec94f203c6f88dbfc0ba0 reproduce: # apt-get install sparse # sparse version: v0.6.1-91-g817270f-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:28:43: sparse: sparse: not enough arguments for function drm_dp_calc_pbn_mode
vim +28 drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
7cbce45d624322 Lyude Paul 2019-09-03 13
7cbce45d624322 Lyude Paul 2019-09-03 14 int igt_dp_mst_calc_pbn_mode(void *ignored)
7cbce45d624322 Lyude Paul 2019-09-03 15 {
7cbce45d624322 Lyude Paul 2019-09-03 16 int pbn, i;
7cbce45d624322 Lyude Paul 2019-09-03 17 const struct {
7cbce45d624322 Lyude Paul 2019-09-03 18 int rate;
7cbce45d624322 Lyude Paul 2019-09-03 19 int bpp;
7cbce45d624322 Lyude Paul 2019-09-03 20 int expected;
7cbce45d624322 Lyude Paul 2019-09-03 21 } test_params[] = {
7cbce45d624322 Lyude Paul 2019-09-03 22 { 154000, 30, 689 },
7cbce45d624322 Lyude Paul 2019-09-03 23 { 234000, 30, 1047 },
7cbce45d624322 Lyude Paul 2019-09-03 24 { 297000, 24, 1063 },
7cbce45d624322 Lyude Paul 2019-09-03 25 };
7cbce45d624322 Lyude Paul 2019-09-03 26
7cbce45d624322 Lyude Paul 2019-09-03 27 for (i = 0; i < ARRAY_SIZE(test_params); i++) {
7cbce45d624322 Lyude Paul 2019-09-03 @28 pbn = drm_dp_calc_pbn_mode(test_params[i].rate,
7cbce45d624322 Lyude Paul 2019-09-03 29 test_params[i].bpp);
7cbce45d624322 Lyude Paul 2019-09-03 30 FAIL(pbn != test_params[i].expected,
7cbce45d624322 Lyude Paul 2019-09-03 31 "Expected PBN %d for clock %d bpp %d, got %d\n",
7cbce45d624322 Lyude Paul 2019-09-03 32 test_params[i].expected, test_params[i].rate,
7cbce45d624322 Lyude Paul 2019-09-03 33 test_params[i].bpp, pbn);
7cbce45d624322 Lyude Paul 2019-09-03 34 }
7cbce45d624322 Lyude Paul 2019-09-03 35
7cbce45d624322 Lyude Paul 2019-09-03 36 return 0;
7cbce45d624322 Lyude Paul 2019-09-03 37 }
2f015ec6eab693 Lyude Paul 2019-09-03 38 :::::: The code@line 28 was first introduced by commit
:::::: 7cbce45d6243225914b5c967b4ee927a2327842a drm/dp_mst: Move test_calc_pbn_mode() into an actual selftest
:::::: TO: Lyude Paul <[email protected]>
:::::: CC: Lyude Paul <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
Lyude Paul
maintainerRe: [PATCH v8 01/17] drm/dp_mst: Add PBN calculation for DSC modes
In reply to [email protected]This patch still needs to be rebased, and the selftests for the PBN calculation that got added still need to be updated to reflect the changes for dsc. The code for PBN calculation changed quite a bit upstream since this series started.
Quoted 185 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: David Francis <[email protected]>
With DSC, bpp can be fractional in multiples of 1/16.
Change
drm_dp_calc_pbn_modeto reflect this, adding a new parameter bool dsc. When this parameter is true, treat the bpp parameter as having units not of bits per pixel, but 1/16 of a bit per pixelv2: Don't add separate function for this
v3: Keep the calculation in a single equation
Cc Lyude Paul <[email protected]>Reviewed-by Manasi Navare <[email protected]>Reviewed-by Lyude Paul <[email protected]>Reviewed-by Harry Wentland <[email protected]>Signed-off-by David Francis <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/drm_dp_mst_topology.c | 38 ++++++++++++++++++- drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- drivers/gpu/drm/radeon/radeon_dp_mst.c | 2 +- include/drm/drm_dp_mst_helper.h | 3 +- 6 files changed, 43 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-1@@ -4967,7 +4967,7 @@ static int dm_encoder_helper_atomic_check(structdrm_encoder *encoder, is_y420); bpp =convert_dc_color_depth_into_bpc (color_depth) *3 ; clock = adjusted_mode->clock; - dm_new_connector_state->pbn =drm_dp_calc_pbn_mode (clock, bpp); + dm_new_connector_state->pbn =drm_dp_calc_pbn_mode (clock, bpp, false);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0} dm_new_connector_state->vcpi_slots =drm_dp_atomic_find_vcpi_slots(state,
mst_mgr,drivers/gpu/drm/drm_dp_mst_topology.c +30
-1@@ -4342,10 +4342,11 @@ EXPORT_SYMBOL(drm_dp_check_act_status);* drm_dp_calc_pbn_mode() - Calculate the PBN for a mode. * @clock: dot clock for the mode * @bpp: bpp for the mode. +* @dsc: DSC mode. If true, bpp has units of 1/16 of a bit per pixel * * This uses the formula in the spec to calculate the PBN value for a mode. */ -int drm_dp_calc_pbn_mode (int clock,int bpp) +int drm_dp_calc_pbn_mode (int clock,int bpp,bool dsc) {/* * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 @@ -4356,12 +4357,47 @@ int drm_dp_calc_pbn_mode(int clock, int bpp)* peak_kbps *= (1006/1000) * peak_kbps *= (64/54) * peak_kbps *= 8 convert to bytes +* +* If the bpp is in units of 1/16, further divide by 16. Put this +* factor in the numerator rather than the denominator to avoid +* integer overflow */ + +if (dsc) +return DIV_ROUND_UP_ULL (mul_u32_u32 (clock * bpp,64 *1006 /16 ), +8 *54 *1000 *1000 ); +return DIV_ROUND_UP_ULL (mul_u32_u32 (clock * bpp,64 *1006 ),8 *54 *1000 *1000 ); + }EXPORT_SYMBOL (drm_dp_calc_pbn_mode); +static int test_calc_pbn_mode (void ) +{ +int ret; + ret =drm_dp_calc_pbn_mode (154000 ,30 , false); +if (ret !=689 ) { + DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n", +154000 ,30 ,689 , ret); +return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (234000 ,30 , false); +if (ret !=1047 ) { + DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n", +234000 ,30 ,1047 , ret); +return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (297000 ,24 , false); +if (ret !=1063 ) { + DRM_ERROR("PBN calculation test failed - clock %d, bpp %d,expected PBN %d, actual PBN %d.\n",
drivers/gpu/drm/drm_dp_mst_topology.c +7
-0+ 297000, 24, 1063, ret); +return -EINVAL ; + } +return 0 ; +} + +/* we want to kick the TX after we've ack the up/down IRQs. */ static void drm_dp_mst_kick_tx (struct drm_dp_mst_topology_mgr *mgr) {drivers/gpu/drm/i915/display/intel_dp_mst.c +2
-1@@ -61,7 +61,8 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, crtc_state->pipe_bpp = bpp; crtc_state->pbn =drm_dp_calc_pbn_mode (adjusted_mode- >crtc_clock, - crtc_state->pipe_bpp); + crtc_state->pipe_bpp, + false);slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp-
Quoted 1 line
mst_mgr,drivers/gpu/drm/i915/display/intel_dp_mst.c +0
-0port, crtc_state->pbn);drivers/gpu/drm/nouveau/dispnv50/disp.c +1
-1@@ -782,7 +782,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,const int bpp = connector->display_info.bpc *3 ;const int clock = crtc_state->adjusted_mode.clock; - asyh->dp.pbn =drm_dp_calc_pbn_mode (clock, bpp); + asyh->dp.pbn =drm_dp_calc_pbn_mode (clock, bpp, false); }drivers/gpu/drm/nouveau/dispnv50/disp.c +0
-0slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr,drivers/gpu/drm/radeon/radeon_dp_mst.c +1
-1@@ -518,7 +518,7 @@ static bool radeon_mst_mode_fixup(struct drm_encoder *encoder, mst_enc = radeon_encoder->enc_priv; - mst_enc->pbn =drm_dp_calc_pbn_mode (adjusted_mode->clock, bpp); + mst_enc->pbn =drm_dp_calc_pbn_mode (adjusted_mode->clock, bpp, false); mst_enc->primary->active_device = mst_enc->primary->devices & mst_enc-Quoted 1 line
connector->devices;DRM_DEBUG_KMS("setting active device to %08x from %08x %08x for
encoder %d\n",include/drm/drm_dp_mst_helper.h +1
-2@@ -719,8 +719,7 @@ bool drm_dp_mst_port_has_audio(structdrm_dp_mst_topology_mgr *mgr, struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, structdrm_dp_mst_topology_mgr *mgr,struct drm_dp_mst_port *port); -int drm_dp_calc_pbn_mode (int clock,int bpp); - +int drm_dp_calc_pbn_mode (int clock,int bpp,bool dsc);bool drm_dp_mst_allocate_vcpi(struct
drm_dp_mst_topology_mgr*mgr,
structdrm_dp_mst_port*port, int pbn, int
slots);
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH v8 01/17] drm/dp_mst: Add PBN calculation for DSC modes
Hi Lyude,
Thanks for the review.
I’ve updated this patch in a v9 iteration of it, I’ve sent separately from the series this past Monday. The new version has the updated selftest.
Thanks,
Mikita
From: Lyude Paul<mailto:[email protected]>
Sent: December 6, 2019 7:17 PM
To: Lipski, Mikita<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>; David Francis<mailto:[email protected]>
Subject: Re: [PATCH v8 01/17] drm/dp_mst: Add PBN calculation for DSC modes
This patch still needs to be rebased, and the selftests for the PBN calculation that got added still need to be updated to reflect the changes for dsc. The code for PBN calculation changed quite a bit upstream since this series started.
Quoted 182 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: David Francis <[email protected]>
With DSC, bpp can be fractional in multiples of 1/16.
Change
drm_dp_calc_pbn_modeto reflect this, adding a new parameter bool dsc. When this parameter is true, treat the bpp parameter as having units not of bits per pixel, but 1/16 of a bit per pixelv2: Don't add separate function for this
v3: Keep the calculation in a single equation
Cc Lyude Paul <[email protected]>Reviewed-by Manasi Navare <[email protected]>Reviewed-by Lyude Paul <[email protected]>Reviewed-by Harry Wentland <[email protected]>Signed-off-by David Francis <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/drm_dp_mst_topology.c | 38 ++++++++++++++++++- drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- drivers/gpu/drm/radeon/radeon_dp_mst.c | 2 +- include/drm/drm_dp_mst_helper.h | 3 +- 6 files changed, 43 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-1@@ -4967,7 +4967,7 @@ static int dm_encoder_helper_atomic_check(structdrm_encoder *encoder, is_y420); bpp =convert_dc_color_depth_into_bpc (color_depth) *3 ; clock = adjusted_mode->clock; - dm_new_connector_state->pbn =drm_dp_calc_pbn_mode (clock, bpp); + dm_new_connector_state->pbn =drm_dp_calc_pbn_mode (clock, bpp, false);} dm_new_connector_state->vcpi_slots =drm_dp_atomic_find_vcpi_slots(state,
mst_mgr,drivers/gpu/drm/drm_dp_mst_topology.c +30
-1@@ -4342,10 +4342,11 @@ EXPORT_SYMBOL(drm_dp_check_act_status);* drm_dp_calc_pbn_mode() - Calculate the PBN for a mode. * @clock: dot clock for the mode * @bpp: bpp for the mode. +* @dsc: DSC mode. If true, bpp has units of 1/16 of a bit per pixel * * This uses the formula in the spec to calculate the PBN value for a mode. */ -int drm_dp_calc_pbn_mode (int clock,int bpp) +int drm_dp_calc_pbn_mode (int clock,int bpp,bool dsc) {/* * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 @@ -4356,12 +4357,47 @@ int drm_dp_calc_pbn_mode(int clock, int bpp)* peak_kbps *= (1006/1000) * peak_kbps *= (64/54) * peak_kbps *= 8 convert to bytes +* +* If the bpp is in units of 1/16, further divide by 16. Put this +* factor in the numerator rather than the denominator to avoid +* integer overflow */ + +if (dsc) +return DIV_ROUND_UP_ULL (mul_u32_u32 (clock * bpp,64 *1006 /16 ), +8 *54 *1000 *1000 ); +return DIV_ROUND_UP_ULL (mul_u32_u32 (clock * bpp,64 *1006 ),8 *54 *1000 *1000 ); + }EXPORT_SYMBOL (drm_dp_calc_pbn_mode); +static int test_calc_pbn_mode (void ) +{ +int ret; + ret =drm_dp_calc_pbn_mode (154000 ,30 , false); +if (ret !=689 ) { + DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n", +154000 ,30 ,689 , ret); +return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (234000 ,30 , false); +if (ret !=1047 ) { + DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n", +234000 ,30 ,1047 , ret); +return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (297000 ,24 , false); +if (ret !=1063 ) { + DRM_ERROR("PBN calculation test failed - clock %d, bpp %d,expected PBN %d, actual PBN %d.\n",
drivers/gpu/drm/drm_dp_mst_topology.c +7
-0+ 297000, 24, 1063, ret); +return -EINVAL ; + } +return 0 ; +} + +/* we want to kick the TX after we've ack the up/down IRQs. */ static void drm_dp_mst_kick_tx (struct drm_dp_mst_topology_mgr *mgr) {drivers/gpu/drm/i915/display/intel_dp_mst.c +2
-1@@ -61,7 +61,8 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, crtc_state->pipe_bpp = bpp; crtc_state->pbn =drm_dp_calc_pbn_mode (adjusted_mode- >crtc_clock, - crtc_state->pipe_bpp); + crtc_state->pipe_bpp, + false);slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp-
Quoted 1 line
mst_mgr,port, crtc_state->pbn);drivers/gpu/drm/nouveau/dispnv50/disp.c +1
-1@@ -782,7 +782,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,const int bpp = connector->display_info.bpc *3 ;const int clock = crtc_state->adjusted_mode.clock; - asyh->dp.pbn =drm_dp_calc_pbn_mode (clock, bpp); + asyh->dp.pbn =drm_dp_calc_pbn_mode (clock, bpp, false); }slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr,drivers/gpu/drm/radeon/radeon_dp_mst.c +1
-1@@ -518,7 +518,7 @@ static bool radeon_mst_mode_fixup(struct drm_encoder *encoder, mst_enc = radeon_encoder->enc_priv; - mst_enc->pbn =drm_dp_calc_pbn_mode (adjusted_mode->clock, bpp); + mst_enc->pbn =drm_dp_calc_pbn_mode (adjusted_mode->clock, bpp, false); mst_enc->primary->active_device = mst_enc->primary->devices & mst_enc-Quoted 1 line
connector->devices;DRM_DEBUG_KMS("setting active device to %08x from %08x %08x for
encoder %d\n",include/drm/drm_dp_mst_helper.h +1
-2@@ -719,8 +719,7 @@ bool drm_dp_mst_port_has_audio(structdrm_dp_mst_topology_mgr *mgr, struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, structdrm_dp_mst_topology_mgr *mgr,struct drm_dp_mst_port *port); -int drm_dp_calc_pbn_mode (int clock,int bpp); - +int drm_dp_calc_pbn_mode (int clock,int bpp,bool dsc);
Quoted 3 lines
bool drm_dp_mst_allocate_vcpi(struct
drm_dp_mst_topology_mgr*mgr,
structdrm_dp_mst_port*port, int pbn, int
slots);
--
Cheers,
Lyude Paul
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 2/17 drm/dp_mst: Parse FEC capability on MST ports
In reply to [email protected]From: David Francis <[email protected]>
As of DP1.4, ENUM_PATH_RESOURCES returns a bit indicating if FEC can be supported up to that point in the MST network.
The bit is the first byte of the ENUM_PATH_RESOURCES ack reply, bottom-most bit (refer to section 2.11.9.4 of DP standard, v1.4)
That value is needed for FEC and DSC support
Store it on drm_dp_mst_port
--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++ include/drm/drm_dp_mst_helper.h | 3 +++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
@@ -846,6 +846,7 @@ static bool drm_dp_sideband_parse_enum_path_resources_ack(struct drm_dp_sideband {int idx =1 ; repmsg->u.path_resources.port_number = (raw->msg[idx] >>4 ) &0xf ; + repmsg->u.path_resources.fec_capable = raw->msg[idx] &0x1 ; idx++;if (idx > raw->curlen) goto fail_len;
@@ -2894,6 +2895,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, path_res->avail_payload_bw_number); port->available_pbn = path_res->avail_payload_bw_number; + port->fec_capable = path_res->fec_capable; } }
include/drm/drm_dp_mst_helper.h +3 -0
@@ -156,6 +156,8 @@ struct drm_dp_mst_port {* audio-capable. */ bool has_audio; + +bool fec_capable; };/**
@@ -383,6 +385,7 @@ struct drm_dp_port_number_req {struct drm_dp_enum_path_resources_ack_reply {u8 port_number; +bool fec_capable;u16 full_payload_bw_number;u16 avail_payload_bw_number; };
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [PATCH v8 02/17] drm/dp_mst: Parse FEC capability on MST ports
Thank you for the patch! Perhaps something to improve:
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20191203]
[cannot apply to drm-intel/for-linux-next linus/master v5.4-rc8 v5.4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/mikita-lipski-amd-com/DSC-MST-support-for-DRM-and-AMDGPU/20191204-020604 base: 1ab75b2e415a29dba9aec94f203c6f88dbfc0ba0 reproduce: make htmldocs
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
drivers/usb/typec/bus.c:1: warning: 'typec_altmode_unregister_driver' not found
drivers/usb/typec/bus.c:1: warning: 'typec_altmode_register_driver' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_register_notifier' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_unregister_notifier' not found
fs/posix_acl.c:647: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode' sound/soc/soc-core.c:2509: warning: Function parameter or member 'legacy_dai_naming' not described in 'snd_soc_register_dai' include/linux/regulator/machine.h:196: warning: Function parameter or member 'max_uV_step' not described in 'regulation_constraints' include/linux/regulator/driver.h:223: warning: Function parameter or member 'resume' not described in 'regulator_ops' include/linux/skbuff.h:888: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'list' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'head_frag' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encapsulation' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_valid' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_vlan_present_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'vlan_present' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_level' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff' include/net/sock.h:232: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_portpair' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_cookie' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_listener' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common' include/net/sock.h:514: warning: Function parameter or member 'sk_rx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_tx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_bpf_storage' not described in 'sock'
include/net/sock.h:2454: warning: Function parameter or member 'tcp_rx_skb_cache_key' not described in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2454: warning: Excess function parameter 'sk' description in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2454: warning: Excess function parameter 'skb' description in 'DECLARE_STATIC_KEY_FALSE' include/linux/netdevice.h:1779: warning: bad line: spinlock
include/linux/netdevice.h:2077: warning: Function parameter or member 'gso_partial_features' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'name_assign_type' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'mpls_ptr' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xdp_prog' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'nf_hooks_ingress' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'qdisc_hash' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state' include/linux/i2c.h:337: warning: Function parameter or member 'init_irq' not described in 'i2c_client' drivers/infiniband/core/umem_odp.c:167: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_alloc_child' drivers/infiniband/core/umem_odp.c:217: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_get' drivers/infiniband/ulp/iser/iscsi_iser.h:401: warning: Function parameter or member 'all_list' not described in 'iser_fr_desc' drivers/infiniband/ulp/iser/iscsi_iser.h:415: warning: Function parameter or member 'all_list' not described in 'iser_fr_pool' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd0' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd1' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd2' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd3' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd4' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd0' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd1' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd2' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd3' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:263: warning: Function parameter or member 'tbl_entries' not described in 'opa_veswport_mactable' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:342: warning: Function parameter or member 'reserved' not described in 'opa_veswport_summary_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd0' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd1' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd2' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd3' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd4' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd5' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd6' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd7' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd8' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd9' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:460: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:485: warning: Function parameter or member 'reserved' not described in 'opa_vnic_notice_attr' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:500: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad_trap' include/linux/input/sparse-keymap.h:43: warning: Function parameter or member 'sw' not described in 'key_entry' kernel/futex.c:1187: warning: Function parameter or member 'ret' not described in 'wait_for_owner_exiting' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'prepare_writeback_job' not described in 'drm_connector_helper_funcs' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'cleanup_writeback_job' not described in 'drm_connector_helper_funcs'
>> include/drm/drm_dp_mst_helper.h:162: warning: Function parameter or member 'fec_capable' not described in 'drm_dp_mst_port'
include/net/cfg80211.h:1189: warning: Function parameter or member 'txpwr' not described in 'station_parameters' include/net/mac80211.h:4081: warning: Function parameter or member 'sta_set_txpwr' not described in 'ieee80211_ops' include/net/mac80211.h:2036: warning: Function parameter or member 'txpwr' not described in 'ieee80211_sta' include/linux/devfreq.h:181: warning: Function parameter or member 'last_status' not described in 'devfreq' drivers/devfreq/devfreq.c:1708: warning: bad line: - Resource-managed devfreq_register_notifier()
drivers/devfreq/devfreq.c:1744: warning: bad line: - Resource-managed devfreq_unregister_notifier() drivers/devfreq/devfreq-event.c:355: warning: Function parameter or member 'edev' not described in 'devfreq_event_remove_edev' drivers/devfreq/devfreq-event.c:355: warning: Excess function parameter 'dev' description in 'devfreq_event_remove_edev' Documentation/admin-guide/xfs.rst:257: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/admin-guide/hw-vuln/tsx_async_abort.rst:142: WARNING: duplicate label virt_mechanism, other instance in Documentation/admin-guide/hw-vuln/mds.rst Documentation/watch_queue.rst:166: WARNING: Inline literal start-string without end-string.
Documentation/watch_queue.rst:166: WARNING: Inline emphasis start-string without end-string.
Documentation/watch_queue.rst:166: WARNING: Inline emphasis start-string without end-string.
Documentation/watch_queue.rst:166: WARNING: Inline emphasis start-string without end-string.
Documentation/watch_queue.rst:243: WARNING: Inline literal start-string without end-string.
Documentation/watch_queue.rst:243: WARNING: Inline emphasis start-string without end-string.
Documentation/watch_queue.rst:242: WARNING: Inline emphasis start-string without end-string.
Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/sysctl/kernel.rst:397: WARNING: Title underline too short.
vim +162 include/drm/drm_dp_mst_helper.h
ad7f8a1f9ced7f Dave Airlie 2014-06-05 @162
:::::: The code at line 162 was first introduced by commit
:::::: ad7f8a1f9ced7f049f9b66d588723f243a7034cd drm/helper: add Displayport multi-stream helper (v0.6)
:::::: TO: Dave Airlie <[email protected]>
:::::: CC: Dave Airlie <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
PATCH v8 3/17 drm/dp_mst: Add MST support to DP DPCD R/W functions
In reply to [email protected]From: David Francis <[email protected]>
Instead of having drm_dp_dpcd_read/write and drm_dp_mst_dpcd_read/write as entry points into the aux code, have drm_dp_dpcd_read/write handle both.
This means that DRM drivers can make MST DPCD read/writes.
v2: Fix spacing
v3: Dump dpcd access on MST read/writes
v4: Fix calling wrong function on DPCD write
v5: delete deprecated include of drmP.h
--- drivers/gpu/drm/drm_dp_aux_dev.c | 12 ++---------- drivers/gpu/drm/drm_dp_helper.c | 30 ++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +2 -10
@@ -163,11 +163,7 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to)break ; } -if (aux_dev->aux->is_remote) - res =drm_dp_mst_dpcd_read (aux_dev->aux, pos, buf, - todo); -else - res =drm_dp_dpcd_read (aux_dev->aux, pos, buf, todo); + res =drm_dp_dpcd_read (aux_dev->aux, pos, buf, todo);if (res <=0 )break ;
@@ -215,11 +211,7 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from)break ; } -if (aux_dev->aux->is_remote) - res =drm_dp_mst_dpcd_write (aux_dev->aux, pos, buf, - todo); -else - res =drm_dp_dpcd_write (aux_dev->aux, pos, buf, todo); + res =drm_dp_dpcd_write (aux_dev->aux, pos, buf, todo);if (res <=0 )break ;
drivers/gpu/drm/drm_dp_helper.c +20 -10
@@ -32,6 +32,7 @@#include <drm/drm_dp_helper.h> #include <drm/drm_print.h> #include <drm/drm_vblank.h> +#include <drm/drm_dp_mst_helper.h> #include "drm_crtc_helper_internal.h"
@@ -266,7 +267,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,/** * drm_dp_dpcd_read() - read a series of bytes from the DPCD -* @aux: DisplayPort AUX channel +* @aux: DisplayPort AUX channel (SST or MST) * @offset: address of the (first) register to read * @buffer: buffer to store the register values * @size: number of bytes in @buffer
@@ -295,13 +296,18 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,* We just have to do it before any DPCD access and hope that the * monitor doesn't power down exactly after the throw away read. */ - ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_READ ,DP_DPCD_REV , buffer, -1 ); -if (ret !=1 ) - goto out; +if (!aux->is_remote) { + ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_READ ,DP_DPCD_REV , + buffer,1 ); +if (ret !=1 ) + goto out; + } - ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_READ , offset, buffer, - size); +if (aux->is_remote) + ret =drm_dp_mst_dpcd_read (aux, offset, buffer, size); +else + ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_READ , offset, + buffer, size); out:drm_dp_dump_access (aux,DP_AUX_NATIVE_READ , offset, buffer, ret);
@@ -311,7 +317,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read);/** * drm_dp_dpcd_write() - write a series of bytes to the DPCD -* @aux: DisplayPort AUX channel +* @aux: DisplayPort AUX channel (SST or MST) * @offset: address of the (first) register to write * @buffer: buffer containing the values to write * @size: number of bytes in @buffer
@@ -328,8 +334,12 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, {int ret; - ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_WRITE , offset, buffer, - size); +if (aux->is_remote) + ret =drm_dp_mst_dpcd_write (aux, offset, buffer, size); +else + ret =drm_dp_dpcd_access (aux,DP_AUX_NATIVE_WRITE , offset, + buffer, size); +drm_dp_dump_access (aux,DP_AUX_NATIVE_WRITE , offset, buffer, ret);return ret; }
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 4/17 drm/dp_mst: Fill branch->num_ports
In reply to [email protected]From: David Francis <[email protected]>
This field on drm_dp_mst_branch was never filled
It is initialized to zero when the port is kzallocced. When a port is added to the list, increment num_ports, and when a port is removed from the list, decrement num_ports.
v2: remember to decrement on port removal
v3: don't explicitly init to 0
--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
@@ -2129,6 +2129,7 @@ drm_dp_mst_port_add_connector(struct drm_dp_mst_branch *mstb,build_mst_prop_path (mstb, port->port_num, proppath,sizeof (proppath)); port->connector = mgr->cbs->add_connector (mgr, port, proppath);if (!port->connector) { + mstb->num_ports--; ret = -ENOMEM ; goto error; }
@@ -2256,6 +2257,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,mutex_lock (&mgr->lock);drm_dp_mst_topology_get_port (port);list_add (&port->next, &mstb->ports); + mstb->num_ports++;mutex_unlock (&mgr->lock); }
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v8 04/17] drm/dp_mst: Fill branch->num_ports
Quoted 32 lines · On 2019-12-03 9:35 a.m., [email protected] wrote:
From: David Francis <[email protected]>
This field on
drm_dp_mst_branchwas never filledIt is initialized to zero when the port is kzallocced. When a port is added to the list, increment
num_ports, and when a port is removed from the list, decrementnum_ports.v2: remember to decrement on port removal
v3: don't explicitly init to 0Reviewed-by Lyude Paul <[email protected]>Reviewed-by Harry Wentland <[email protected]>Signed-off-by David Francis <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/drm_dp_mst_topology.c +1
-0@@ -2129,6 +2129,7 @@ drm_dp_mst_port_add_connector(struct drm_dp_mst_branch *mstb,build_mst_prop_path (mstb, port->port_num, proppath,sizeof (proppath)); port->connector = mgr->cbs->add_connector (mgr, port, proppath);if (!port->connector) { + mstb->num_ports--; ret = -ENOMEM ; goto error; }
drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, · line 2263
Quoted 7 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1
-0@@ -2256,6 +2257,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,mutex_lock (&mgr->lock);drm_dp_mst_topology_get_port (port);list_add (&port->next, &mstb->ports); + mstb->num_ports++;mutex_unlock (&mgr->lock); }
Did you drop the num_ports-- when we do list_del() by accident?
See https://patchwork.freedesktop.org/patch/325600/
Harry
Quoted 1 line
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 5/17 drm/dp_mst: Add helpers for MST DSC and virtual DPCD aux
In reply to [email protected]From: David Francis <[email protected]>
Add drm_dp_mst_dsc_aux_for_port. To enable DSC, the DSC_ENABLED register might have to be written on the leaf port's DPCD, its parent's DPCD, or the MST manager's DPCD. This function finds the correct aux for the job.
As part of this, add drm_dp_mst_is_virtual_dpcd. Virtual DPCD is a DP feature new in DP v1.4, which exposes certain DPCD registers on virtual ports.
v2: Remember to unlock mutex on all paths
v3: Refactor to match coding style and increase brevity
--- drivers/gpu/drm/drm_dp_mst_topology.c | 127 ++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 2 + 2 files changed, 129 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +127 -0
@@ -5029,3 +5029,130 @@ static void drm_dp_mst_unregister_i2c_bus(struct drm_dp_aux *aux) {i2c_del_adapter (&aux->ddc); } + +/** +* drm_dp_mst_is_virtual_dpcd() - Is the given port a virtual DP Peer Device +* @port: The port to check +* +* A single physical MST hub object can be represented in the topology +* by multiple branches, with virtual ports between those branches. +* +* As of DP1.4, An MST hub with internal (virtual) ports must expose +* certain DPCD registers over those ports. See sections 2.6.1.1.1 +* and 2.6.1.1.2 of Display Port specification v1.4 for details. +* +* May acquire mgr->lock +* +* Returns: +* true if the port is a virtual DP peer device, false otherwise +*/ +static bool drm_dp_mst_is_virtual_dpcd (struct drm_dp_mst_port *port) +{ +struct drm_dp_mst_port *downstream_port; + +if (!port || port->dpcd_rev <DP_DPCD_REV_14 ) +return false; + +/* Virtual DP Sink (Internal Display Panel) */ +if (port->port_num >=8 ) +return true; + +/* DP-to-HDMI Protocol Converter */ +if (port->pdt ==DP_PEER_DEVICE_DP_LEGACY_CONV && + !port->mcs && + port->ldps) +return true; + +/* DP-to-DP */ +mutex_lock (&port->mgr->lock); +if (port->pdt ==DP_PEER_DEVICE_MST_BRANCHING && + port->mstb && + port->mstb->num_ports ==2 ) { +list_for_each_entry (downstream_port, &port->mstb->ports, next) { +if (downstream_port->pdt ==DP_PEER_DEVICE_SST_SINK && + !downstream_port->input) { +mutex_unlock (&port->mgr->lock); +return true; + } + } + } +mutex_unlock (&port->mgr->lock); + +return false; +} + +/** +* drm_dp_mst_dsc_aux_for_port() - Find the correct aux for DSC +* @port: The port to check. A leaf of the MST tree with an attached display. +* +* Depending on the situation, DSC may be enabled via the endpoint aux, +* the immediately upstream aux, or the connector's physical aux. +* +* This is both the correct aux to read DSC_CAPABILITY and the +* correct aux to write DSC_ENABLED. +* +* This operation can be expensive (up to four aux reads), so +* the caller should cache the return. +* +* Returns: +* NULL if DSC cannot be enabled on this port, otherwise the aux device +*/ +struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port (struct drm_dp_mst_port *port) +{ +struct drm_dp_mst_port *immediate_upstream_port; +struct drm_dp_mst_port *fec_port; + +if (!port) +return NULL ; + +if (port->parent) + immediate_upstream_port = port->parent->port_parent; +else + immediate_upstream_port =NULL ; + + fec_port = immediate_upstream_port; +while (fec_port) { +/* +* Each physical link (i.e. not a virtual port) between the +* output and the primary device must support FEC +*/ +if (!drm_dp_mst_is_virtual_dpcd (fec_port) && + !fec_port->fec_capable) +return NULL ; + + fec_port = fec_port->parent->port_parent; + } + +/* DP-to-DP peer device */ +if (drm_dp_mst_is_virtual_dpcd (immediate_upstream_port)) { +u8 upstream_dsc; +u8 endpoint_dsc; +u8 endpoint_fec; + +if (drm_dp_dpcd_read (&port->aux, +DP_DSC_SUPPORT , &endpoint_dsc,1 ) <0 ) +return NULL ; +if (drm_dp_dpcd_read (&port->aux, +DP_FEC_CAPABILITY , &endpoint_fec,1 ) <0 ) +return NULL ; +if (drm_dp_dpcd_read (&immediate_upstream_port->aux, +DP_DSC_SUPPORT , &upstream_dsc,1 ) <0 ) +return NULL ; + +/* Enpoint decompression with DP-to-DP peer device */ +if ((endpoint_dsc &DP_DSC_DECOMPRESSION_IS_SUPPORTED ) && + (endpoint_fec &DP_FEC_CAPABLE ) && + (upstream_dsc &0x2 )/* DSC passthrough */ ) +return &port->aux; + +/* Virtual DPCD decompression with DP-to-DP peer device */ +return &immediate_upstream_port->aux; + } + +/* Virtual DPCD decompression with DP-to-HDMI or Virtual DP Sink */ +if (drm_dp_mst_is_virtual_dpcd (port)) +return &port->aux; + +return NULL ; +} +EXPORT_SYMBOL (drm_dp_mst_dsc_aux_for_port);
include/drm/drm_dp_mst_helper.h +2 -0
@@ -783,6 +783,8 @@ int __must_check drm_dp_mst_atomic_check(struct drm_atomic_state *state);void drm_dp_mst_get_port_malloc (struct drm_dp_mst_port *port);void drm_dp_mst_put_port_malloc (struct drm_dp_mst_port *port); +struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port (struct drm_dp_mst_port *port); +extern const struct drm_private_state_funcs drm_dp_mst_topology_state_funcs;/**
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 6/17 drm/dp_mst: Add new quirk for Synaptics MST hubs
In reply to [email protected]From: Mikita Lipski <[email protected]>
Synaptics DP1.4 hubs (BRANCH_ID 0x90CC24) do not support virtual DPCD registers, but do support DSC. The DSC caps can be read from the physical aux, like in SST DSC. These hubs have many different DEVICE_IDs. Add a new quirk to detect this case.
--- drivers/gpu/drm/drm_dp_helper.c | 2 ++ drivers/gpu/drm/drm_dp_mst_topology.c | 27 +++++++++++++++++++++++++++ include/drm/drm_dp_helper.h | 7 +++++++ 3 files changed, 36 insertions(+)
drivers/gpu/drm/drm_dp_helper.c +2 -0
@@ -1165,6 +1165,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = { { OUI(0x00, 0x10, 0xfa), DEVICE_ID_ANY, false, BIT(DP_DPCD_QUIRK_NO_PSR) },/* CH7511 seems to leave SINK_COUNT zeroed */ { OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) }, +/* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */ + { OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) }, };#undef OUI
drivers/gpu/drm/drm_dp_mst_topology.c +27 -0
@@ -5101,6 +5101,7 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port) {struct drm_dp_mst_port *immediate_upstream_port;struct drm_dp_mst_port *fec_port; +struct drm_dp_desc desc = {0 };if (!port)return NULL ;
@@ -5153,6 +5154,32 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port)if (drm_dp_mst_is_virtual_dpcd (port))return &port->aux; +/* +* Synaptics quirk +* Applies to ports for which: +* - Physical aux has Synaptics OUI +* - DPv1.4 or higher +* - Port is on primary branch device +* - Not a VGA adapter (DP_DWN_STRM_PORT_TYPE_ANALOG) +*/ +if (!drm_dp_read_desc (port->mgr->aux, &desc, true)) +return NULL ; + +if (drm_dp_has_quirk (&desc,DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD ) && + port->mgr->dpcd[DP_DPCD_REV ] >=DP_DPCD_REV_14 && + port->parent == port->mgr->mst_primary) { +u8 downstreamport; + +if (drm_dp_dpcd_read (&port->aux,DP_DOWNSTREAMPORT_PRESENT , + &downstreamport,1 ) <0 ) +return NULL ; + +if ((downstreamport &DP_DWN_STRM_PORT_PRESENT ) && + ((downstreamport &DP_DWN_STRM_PORT_TYPE_MASK ) + !=DP_DWN_STRM_PORT_TYPE_ANALOG )) +return port->mgr->aux; + } +return NULL ; }EXPORT_SYMBOL (drm_dp_mst_dsc_aux_for_port);
include/drm/drm_dp_helper.h +7 -0
@@ -1520,6 +1520,13 @@ enum drm_dp_quirk {* The driver should ignore SINK_COUNT during detection. */ DP_DPCD_QUIRK_NO_SINK_COUNT , +/** +* @DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD: +* +* The device supports MST DSC despite not supporting Virtual DPCD. +* The DSC caps can be read from the physical aux instead. +*/ + DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD, };/**
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 7/17 drm/amd/display: Initialize DSC PPS variables to 0
In reply to [email protected]From: David Francis <[email protected]>
For DSC MST, sometimes monitors would break out in full-screen static. The issue traced back to the PPS generation code, where these variables were being used uninitialized and were picking up garbage.
memset to 0 to avoid this
--- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 3 +++ drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +3 -0
@@ -526,6 +526,9 @@ bool dp_set_dsc_pps_sdp(struct pipe_ctx *pipe_ctx, bool enable)struct dsc_config dsc_cfg;uint8_t dsc_packed_pps[128 ]; +memset (&dsc_cfg,0 ,sizeof (dsc_cfg)); +memset (dsc_packed_pps,0 ,128 ); +/* Enable DSC hw block */ dsc_cfg.pic_width = stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right; dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom;
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +3 -0
@@ -206,6 +206,9 @@ static bool dsc2_get_packed_pps(struct display_stream_compressor *dsc, const strstruct dsc_reg_values dsc_reg_vals;struct dsc_optc_config dsc_optc_cfg; +memset (&dsc_reg_vals,0 ,sizeof (dsc_reg_vals)); +memset (&dsc_optc_cfg,0 ,sizeof (dsc_optc_cfg)); +DC_LOG_DSC ("Getting packed DSC PPS for DSC Config:" );dsc_config_log (dsc, dsc_cfg);DC_LOG_DSC ("DSC Picture Parameter Set (PPS):" );
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 8/17 drm/amd/display: Validate DSC caps on MST endpoints
In reply to [email protected]From: David Francis <[email protected]>
During MST mode enumeration, if a new dc_sink is created, populate it with dsc caps as appropriate.
Use drm_dp_mst_dsc_aux_for_port to get the raw caps, then parse them onto dc_sink with dc_dsc_parse_dsc_dpcd.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 + .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 27 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
@@ -323,6 +323,7 @@ struct amdgpu_dm_connector {struct drm_dp_mst_port *port;struct amdgpu_dm_connector *mst_port;struct amdgpu_encoder *mst_encoder; +struct drm_dp_aux *dsc_aux;/* TODO see if we can merge with ddc_bus or make a dm_connector */ struct amdgpu_i2c_adapter *i2c;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +26 -1
@@ -25,6 +25,7 @@#include <linux/version.h> #include <drm/drm_atomic_helper.h> +#include <drm/drm_dp_mst_helper.h> #include "dm_services.h" #include "amdgpu.h" #include "amdgpu_dm.h"
@@ -180,6 +181,26 @@ static const struct drm_connector_funcs dm_dp_mst_connector_funcs = { .early_unregister = amdgpu_dm_mst_connector_early_unregister, }; +static bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector) +{ +struct dc_sink *dc_sink = aconnector->dc_sink; +struct drm_dp_mst_port *port = aconnector->port; +u8 dsc_caps[16 ] = {0 }; + + aconnector->dsc_aux =drm_dp_mst_dsc_aux_for_port (port); + +if (!aconnector->dsc_aux) +return false; + +if (drm_dp_dpcd_read (aconnector->dsc_aux,DP_DSC_SUPPORT , dsc_caps,16 ) <0 ) +return false; + +if (!dc_dsc_parse_dsc_dpcd (dsc_caps,NULL , &dc_sink->sink_dsc_caps.dsc_dec_caps)) +return false; + +return true; +} +static int dm_dp_mst_get_modes (struct drm_connector *connector) {struct amdgpu_dm_connector *aconnector =to_amdgpu_dm_connector (connector);
@@ -222,10 +243,14 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)/* dc_link_add_remote_sink returns a new reference */ aconnector->dc_sink = dc_sink; -if (aconnector->dc_sink) +if (aconnector->dc_sink) {amdgpu_dm_update_freesync_caps ( connector, aconnector->edid); +if (!validate_dsc_caps_on_connector (aconnector)) +memset (&aconnector->dc_sink->sink_dsc_caps, +0 ,sizeof (aconnector->dc_sink->sink_dsc_caps)); + } } drm_connector_update_edid_property(
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 9/17 drm/amd/display: Write DSC enable to MST DPCD
In reply to [email protected]From: David Francis <[email protected]>
Rework the dm_helpers_write_dsc_enable callback to handle the MST case.
Use the cached dsc_aux field.
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +18 -1
@@ -37,6 +37,7 @@#include "dc.h" #include "amdgpu_dm.h" #include "amdgpu_dm_irq.h" +#include "amdgpu_dm_mst_types.h" #include "dm_helpers.h"
@@ -516,8 +517,24 @@ bool dm_helpers_dp_write_dsc_enable( ) {uint8_t enable_dsc = enable ?1 :0 ; +struct amdgpu_dm_connector *aconnector; + +if (!stream) +return false; + +if (stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST ) { + aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; + +if (!aconnector->dsc_aux) +return false; + +return (drm_dp_dpcd_write (aconnector->dsc_aux,DP_DSC_ENABLE , &enable_dsc,1 ) >=0 ); + } + +if (stream->signal ==SIGNAL_TYPE_DISPLAY_PORT ) +return dm_helpers_dp_write_dpcd (ctx, stream->link,DP_DSC_ENABLE , &enable_dsc,1 ); -return dm_helpers_dp_write_dpcd (ctx, stream->sink->link,DP_DSC_ENABLE , &enable_dsc,1 ); +return false; }bool dm_helpers_is_dp_sink_present (struct dc_link *link)
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v8 10/17 drm/dp_mst: Manually overwrite PBN divider for calculating timeslots
In reply to [email protected]From: Mikita Lipski <[email protected]>
[why]
For DSC case we cannot always use topology manager's PBN divider variable. The default divider does not take FEC into account. Therefore we should allow driver to calculate its own divider based on the link rate and count its handling, as it is hw specific. [how]
Pass pbn_div as an argument, which will be used if its more than zero, otherwise default topology manager's pbn_div will be used.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- drivers/gpu/drm/drm_dp_mst_topology.c | 9 +++++++-- drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ++- include/drm/drm_dp_mst_helper.h | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4972,7 +4972,8 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder, dm_new_connector_state->vcpi_slots =drm_dp_atomic_find_vcpi_slots (state, mst_mgr, mst_port, - dm_new_connector_state->pbn); + dm_new_connector_state->pbn, +0 );if (dm_new_connector_state->vcpi_slots <0 ) {DRM_DEBUG_ATOMIC ("failed finding vcpi slots: %d\n" , (int )dm_new_connector_state->vcpi_slots);return dm_new_connector_state->vcpi_slots;
drivers/gpu/drm/drm_dp_mst_topology.c +7 -2
@@ -4020,6 +4020,7 @@ static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr,* @mgr: MST topology manager for the port * @port: port to find vcpi slots for * @pbn: bandwidth required for the mode in PBN +* @pbn_div: divider for DSC mode that takes FEC into account * * Allocates VCPI slots to @port, replacing any previous VCPI allocations it * may have had. Any atomic drivers which support MST must call this function
@@ -4046,7 +4047,8 @@ static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr,*/ int drm_dp_atomic_find_vcpi_slots (struct drm_atomic_state *state,struct drm_dp_mst_topology_mgr *mgr, -struct drm_dp_mst_port *port,int pbn) +struct drm_dp_mst_port *port,int pbn, +int pbn_div) {struct drm_dp_mst_topology_state *topology_state;struct drm_dp_vcpi_allocation *pos, *vcpi =NULL ;
@@ -4079,7 +4081,10 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,if (!vcpi) prev_slots =0 ; - req_slots =DIV_ROUND_UP (pbn, mgr->pbn_div); +if (pbn_div <=0 ) + pbn_div = mgr->pbn_div; + + req_slots =DIV_ROUND_UP (pbn, pbn_div); DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n", port->connector->base.id, port->connector->name,
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -1
@@ -65,7 +65,7 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, false); slots =drm_dp_atomic_find_vcpi_slots (state, &intel_dp->mst_mgr, - port, crtc_state->pbn); + port, crtc_state->pbn,0 );if (slots == -EDEADLK )return slots;if (slots >=0 )
drivers/gpu/drm/nouveau/dispnv50/disp.c +2 -1
@@ -787,7 +787,8 @@ nv50_msto_atomic_check(struct drm_encoder *encoder, slots =drm_dp_atomic_find_vcpi_slots (state, &mstm->mgr, mstc->port, - asyh->dp.pbn); + asyh->dp.pbn, +0 );if (slots <0 )return slots;
include/drm/drm_dp_mst_helper.h +2 -1
@@ -771,7 +771,8 @@ struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct drm_aint __must_check drm_dp_atomic_find_vcpi_slots (struct drm_atomic_state *state,struct drm_dp_mst_topology_mgr *mgr, -struct drm_dp_mst_port *port,int pbn); +struct drm_dp_mst_port *port,int pbn, +int pbn_div); int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v8 11/17 drm/dp_mst: Add DSC enablement helpers to DRM
In reply to [email protected]From: Mikita Lipski <[email protected]>
Adding a helper function to be called by drivers outside of DRM to enable DSC on
the MST ports.
Function is called to recalculate VCPI allocation if DSC is enabled and raise the DSC flag to enable. In case of disabling DSC the flag is set to false and recalculation of VCPI slots is expected to be done in encoder's atomic_check.
v2: squash separate functions into one and call it per port
--- drivers/gpu/drm/drm_dp_mst_topology.c | 61 +++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 5 +++ 2 files changed, 66 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +61 -0
@@ -4742,6 +4742,67 @@ drm_dp_mst_atomic_check_topology_state(struct drm_dp_mst_topology_mgr *mgr,return 0 ; } +/** +* drm_dp_mst_atomic_enable_dsc - Set DSC Enable Flag to On/Off +* @state: Pointer to the new drm_atomic_state +* @pointer: Pointer to the affected MST Port +* @pbn: Newly recalculated bw required for link with DSC enabled +* @pbn_div: Divider to calculate correct number of pbn per slot +* @enable: Boolean flag enabling or disabling DSC on the port +* +* This function enables DSC on the given Port +* by recalculating its vcpi from pbn provided +* and sets dsc_enable flag to keep track of which +* ports have DSC enabled +* +*/ +int drm_dp_mst_atomic_enable_dsc (struct drm_atomic_state *state, +struct drm_dp_mst_port *port, +int pbn,int pbn_div, +bool enable) +{ +struct drm_dp_mst_topology_state *mst_state; +struct drm_dp_vcpi_allocation *pos; +bool found = false; +int vcpi =0 ; + + mst_state =drm_atomic_get_mst_topology_state (state, port->mgr); + +if (IS_ERR (mst_state)) +return PTR_ERR (mst_state); + +list_for_each_entry (pos, &mst_state->vcpis, next) { +if (pos->port == port) { + found = true; +break ; + } + } + +if (!found) { +DRM_DEBUG_ATOMIC ("[MST PORT:%p] Couldn't find VCPI allocation in mst state %p\n" , + port, mst_state); +return -EINVAL ; + } + +if (pos->dsc_enabled == enable) { +DRM_DEBUG_ATOMIC ("[MST PORT:%p] DSC flag is already set to %d, returning %d VCPI slots\n" , + port, enable, pos->vcpi); + vcpi = pos->vcpi; + } + +if (enable) { + vcpi =drm_dp_atomic_find_vcpi_slots (state, port->mgr, port, pbn, pbn_div); +DRM_DEBUG_ATOMIC ("[MST PORT:%p] Enabling DSC flag, reallocating %d VCPI slots on the port\n" , + port, vcpi); +if (vcpi <0 ) +return -EINVAL ; + } + + pos->dsc_enabled = enable; + +return vcpi; +} +EXPORT_SYMBOL (drm_dp_mst_atomic_enable_dsc);/** * drm_dp_mst_atomic_check - Check that the new state of an MST topology in an * atomic update is valid
include/drm/drm_dp_mst_helper.h +5 -0
@@ -502,6 +502,7 @@ struct drm_dp_payload {struct drm_dp_vcpi_allocation {struct drm_dp_mst_port *port;int vcpi; +bool dsc_enabled;struct list_head next; };
@@ -773,6 +774,10 @@ drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int pbn_div); +int drm_dp_mst_atomic_enable_dsc (struct drm_atomic_state *state, +struct drm_dp_mst_port *port, +int pbn,int pbn_div, +bool enable); int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [PATCH v8 11/17] drm/dp_mst: Add DSC enablement helpers to DRM
Thank you for the patch! Perhaps something to improve:
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20191203]
[cannot apply to drm-intel/for-linux-next linus/master v5.4-rc8 v5.4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/mikita-lipski-amd-com/DSC-MST-support-for-DRM-and-AMDGPU/20191204-020604 base: 1ab75b2e415a29dba9aec94f203c6f88dbfc0ba0 reproduce: make htmldocs
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
drivers/usb/typec/class.c:1: warning: 'typec_altmode_register_notifier' not found
fs/posix_acl.c:647: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode' include/linux/regulator/machine.h:196: warning: Function parameter or member 'max_uV_step' not described in 'regulation_constraints' include/linux/regulator/driver.h:223: warning: Function parameter or member 'resume' not described in 'regulator_ops' sound/soc/soc-core.c:2509: warning: Function parameter or member 'legacy_dai_naming' not described in 'snd_soc_register_dai' include/linux/skbuff.h:888: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'list' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'head_frag' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encapsulation' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_valid' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_vlan_present_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'vlan_present' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_level' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff' include/net/sock.h:232: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_portpair' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_cookie' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_listener' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common' include/net/sock.h:514: warning: Function parameter or member 'sk_rx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_tx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_bpf_storage' not described in 'sock'
include/net/sock.h:2454: warning: Function parameter or member 'tcp_rx_skb_cache_key' not described in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2454: warning: Excess function parameter 'sk' description in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2454: warning: Excess function parameter 'skb' description in 'DECLARE_STATIC_KEY_FALSE' include/linux/netdevice.h:1779: warning: bad line: spinlock
include/linux/netdevice.h:2077: warning: Function parameter or member 'gso_partial_features' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'name_assign_type' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'mpls_ptr' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xdp_prog' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'nf_hooks_ingress' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'qdisc_hash' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state' include/linux/i2c.h:337: warning: Function parameter or member 'init_irq' not described in 'i2c_client' drivers/infiniband/core/umem_odp.c:167: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_alloc_child' drivers/infiniband/core/umem_odp.c:217: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_get' drivers/infiniband/ulp/iser/iscsi_iser.h:401: warning: Function parameter or member 'all_list' not described in 'iser_fr_desc' drivers/infiniband/ulp/iser/iscsi_iser.h:415: warning: Function parameter or member 'all_list' not described in 'iser_fr_pool' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd0' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd1' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd2' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd3' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd4' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd0' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd1' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd2' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd3' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:263: warning: Function parameter or member 'tbl_entries' not described in 'opa_veswport_mactable' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:342: warning: Function parameter or member 'reserved' not described in 'opa_veswport_summary_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd0' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd1' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd2' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd3' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd4' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd5' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd6' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd7' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd8' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd9' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:460: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:485: warning: Function parameter or member 'reserved' not described in 'opa_vnic_notice_attr' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:500: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad_trap' include/linux/input/sparse-keymap.h:43: warning: Function parameter or member 'sw' not described in 'key_entry' kernel/futex.c:1187: warning: Function parameter or member 'ret' not described in 'wait_for_owner_exiting' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'prepare_writeback_job' not described in 'drm_connector_helper_funcs' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'cleanup_writeback_job' not described in 'drm_connector_helper_funcs' drivers/gpu/drm/drm_dp_mst_topology.c:4763: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' drivers/gpu/drm/drm_dp_mst_topology.c:4763: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' include/drm/drm_dp_mst_helper.h:162: warning: Function parameter or member 'fec_capable' not described in 'drm_dp_mst_port'
>> drivers/gpu/drm/drm_dp_mst_topology.c:4764: warning: Function parameter or member 'port' not described in 'drm_dp_mst_atomic_enable_dsc'
drivers/gpu/drm/drm_dp_mst_topology.c:4764: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' drivers/gpu/drm/drm_dp_mst_topology.c:4763: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' include/net/cfg80211.h:1189: warning: Function parameter or member 'txpwr' not described in 'station_parameters' include/net/mac80211.h:4081: warning: Function parameter or member 'sta_set_txpwr' not described in 'ieee80211_ops' include/net/mac80211.h:2036: warning: Function parameter or member 'txpwr' not described in 'ieee80211_sta' include/linux/devfreq.h:181: warning: Function parameter or member 'last_status' not described in 'devfreq' drivers/devfreq/devfreq.c:1708: warning: bad line: - Resource-managed devfreq_register_notifier()
drivers/devfreq/devfreq.c:1744: warning: bad line: - Resource-managed devfreq_unregister_notifier() drivers/devfreq/devfreq-event.c:355: warning: Function parameter or member 'edev' not described in 'devfreq_event_remove_edev' drivers/devfreq/devfreq-event.c:355: warning: Excess function parameter 'dev' description in 'devfreq_event_remove_edev' Documentation/admin-guide/xfs.rst:257: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/admin-guide/hw-vuln/tsx_async_abort.rst:142: WARNING: duplicate label virt_mechanism, other instance in Documentation/admin-guide/hw-vuln/mds.rst Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/sysctl/kernel.rst:397: WARNING: Title underline too short.
vim +4764 drivers/gpu/drm/drm_dp_mst_topology.c
4744
4745 /**
4746 * drm_dp_mst_atomic_enable_dsc - Set DSC Enable Flag to On/Off
4747 * @state: Pointer to the new drm_atomic_state
4748 * @pointer: Pointer to the affected MST Port
4749 * @pbn: Newly recalculated bw required for link with DSC enabled
4750 * @pbn_div: Divider to calculate correct number of pbn per slot
4751 * @enable: Boolean flag enabling or disabling DSC on the port
4752 *
4753 * This function enables DSC on the given Port
4754 * by recalculating its vcpi from pbn provided
4755 * and sets dsc_enable flag to keep track of which
4756 * ports have DSC enabled
4757 *
4758 */
4759 int drm_dp_mst_atomic_enable_dsc(struct drm_atomic_state *state,
4760 struct drm_dp_mst_port *port,
4761 int pbn, int pbn_div,
4762 bool enable)
> 4763 {
> 4764 struct drm_dp_mst_topology_state *mst_state; 4765 struct drm_dp_vcpi_allocation *pos;
4766 bool found = false;
4767 int vcpi = 0;
4768
4769 mst_state = drm_atomic_get_mst_topology_state(state, port->mgr);
4770
4771 if (IS_ERR(mst_state))
4772 return PTR_ERR(mst_state);
4773
4774 list_for_each_entry(pos, &mst_state->vcpis, next) {
4775 if (pos->port == port) {
4776 found = true;
4777 break;
4778 }
4779 }
4780
4781 if (!found) {
4782 DRM_DEBUG_ATOMIC("[MST PORT:%p] Couldn't find VCPI allocation in mst state %p\n",
4783 port, mst_state);
4784 return -EINVAL;
4785 }
4786
4787 if (pos->dsc_enabled == enable) {
4788 DRM_DEBUG_ATOMIC("[MST PORT:%p] DSC flag is already set to %d, returning %d VCPI slots\n",
4789 port, enable, pos->vcpi);
4790 vcpi = pos->vcpi;
4791 }
4792
4793 if (enable) {
4794 vcpi = drm_dp_atomic_find_vcpi_slots(state, port->mgr, port, pbn, pbn_div);
4795 DRM_DEBUG_ATOMIC("[MST PORT:%p] Enabling DSC flag, reallocating %d VCPI slots on the port\n",
4796 port, vcpi);
4797 if (vcpi < 0)
4798 return -EINVAL;
4799 }
4800
4801 pos->dsc_enabled = enable;
4802
4803 return vcpi;
4804 }
4805 EXPORT_SYMBOL(drm_dp_mst_atomic_enable_dsc);
4806 /**
4807 * drm_dp_mst_atomic_check - Check that the new state of an MST topology in an
4808 * atomic update is valid
4809 * @state: Pointer to the new &struct drm_dp_mst_topology_state
4810 *
4811 * Checks the given topology state for an atomic update to ensure that it's
4812 * valid. This includes checking whether there's enough bandwidth to support
4813 * the new VCPI allocations in the atomic update.
4814 *
4815 * Any atomic drivers supporting DP MST must make sure to call this after
4816 * checking the rest of their state in their
4817 * &drm_mode_config_funcs.atomic_check() callback.
4818 *
4819 * See also:
4820 * drm_dp_atomic_find_vcpi_slots()
4821 * drm_dp_atomic_release_vcpi_slots()
4822 *
4823 * Returns:
4824 *
4825 * 0 if the new state is valid, negative error code otherwise.
4826 */
4827 int drm_dp_mst_atomic_check(struct drm_atomic_state *state)
4828 {
4829 struct drm_dp_mst_topology_mgr *mgr;
4830 struct drm_dp_mst_topology_state *mst_state;
4831 int i, ret = 0;
4832
4833 for_each_new_mst_mgr_in_state(state, mgr, mst_state, i) {
4834 ret = drm_dp_mst_atomic_check_topology_state(mgr, mst_state);
4835 if (ret)
4836 break;
4837 }
4838
4839 return ret;
4840 }
4841 EXPORT_SYMBOL(drm_dp_mst_atomic_check);
4842
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
Re: [PATCH v8 11/17] drm/dp_mst: Add DSC enablement helpers to DRM
In reply to [email protected]Nice! All I've got is a couple of typos I noticed and one question, this looks great :)
Quoted 29 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: Mikita Lipski <[email protected]>
Adding a helper function to be called by drivers outside of DRM to enable DSC on
the MST ports.Function is called to recalculate VCPI allocation if DSC is enabled and raise the DSC flag to enable. In case of disabling DSC the flag is set to false and recalculation of VCPI slots is expected to be done in encoder's
atomic_check.v2: squash separate functions into one and call it per port
Cc Harry Wentland <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 61 +++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 5 +++ 2 files changed, 66 insertions(+)drivers/gpu/drm/drm_dp_mst_topology.c +0
-0
drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_atomic_check_topology_state(struct · line 4749
Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +4
-0@@ -4742,6 +4742,67 @@ drm_dp_mst_atomic_check_topology_state(structdrm_dp_mst_topology_mgr *mgr, return 0; } +/** +* drm_dp_mst_atomic_enable_dsc - Set DSC Enable Flag to On/Off +* @state: Pointer to the new drm_atomic_state +* @pointer: Pointer to the affected MST Port
Typo here
Quoted 28 lines
drivers/gpu/drm/drm_dp_mst_topology.c +28
-0+* @pbn: Newly recalculated bw required for link with DSC enabled +* @pbn_div: Divider to calculate correct number of pbn per slot +* @enable: Boolean flag enabling or disabling DSC on the port +* +* This function enables DSC on the given Port +* by recalculating its vcpi from pbn provided +* and sets dsc_enable flag to keep track of which +* ports have DSC enabled +* +*/ +int drm_dp_mst_atomic_enable_dsc (struct drm_atomic_state *state, +struct drm_dp_mst_port *port, +int pbn,int pbn_div, +bool enable) +{ +struct drm_dp_mst_topology_state *mst_state; +struct drm_dp_vcpi_allocation *pos; +bool found = false; +int vcpi =0 ; + + mst_state =drm_atomic_get_mst_topology_state (state, port->mgr); + +if (IS_ERR (mst_state)) +return PTR_ERR (mst_state); + +list_for_each_entry (pos, &mst_state->vcpis, next) { +if (pos->port == port) { + found = true;
drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_atomic_check_topology_state(struct drm_dp_mst_topology_mgr *mgr, · line 4785
Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +9
-0+break ; + } + } + +if (!found) { + DRM_DEBUG_ATOMIC("[MST PORT:%p] Couldn't find VCPI allocation in mst state %p\n", + port, mst_state); +return -EINVAL ; + }
Just double checking-does this handle the case where we're enabling DSC on a port that didn't previously have a VCPI allocation because it wasn't enabled previously? Or do we not need to handle that here
Assuming you did the right thing here, with the small typo fixes:
Quoted 52 lines
drivers/gpu/drm/drm_dp_mst_topology.c +9
-0+ +if (pos->dsc_enabled == enable) { + DRM_DEBUG_ATOMIC("[MST PORT:%p] DSC flag is already set to %d, returning %d VCPI slots\n", + port, enable, pos->vcpi); + vcpi = pos->vcpi; + } + +if (enable) { + vcpi = drm_dp_atomic_find_vcpi_slots(state, port->mgr, port,pbn,
pbn_div);drivers/gpu/drm/drm_dp_mst_topology.c +1
-0+ DRM_DEBUG_ATOMIC("[MST PORT:%p] Enabling DSC flag,reallocating %d VCPI slots on the port\n",
drivers/gpu/drm/drm_dp_mst_topology.c +10
-0+ port, vcpi); +if (vcpi <0 ) +return -EINVAL ; + } + + pos->dsc_enabled = enable; + +return vcpi; +} +EXPORT_SYMBOL (drm_dp_mst_atomic_enable_dsc);/** * drm_dp_mst_atomic_check - Check that the new state of an MST topology in an
* atomic update is validinclude/drm/drm_dp_mst_helper.h +5
-0@@ -502,6 +502,7 @@ struct drm_dp_payload {struct drm_dp_vcpi_allocation {struct drm_dp_mst_port *port;int vcpi; +bool dsc_enabled;struct list_head next; };@@ -773,6 +774,10 @@ drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int pbn_div); +int drm_dp_mst_atomic_enable_dsc (struct drm_atomic_state *state, +struct drm_dp_mst_port *port, +int pbn,int pbn_div, +bool enable); int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,struct
drm_dp_mst_topology_mgr*mgr,
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v8 11/17] drm/dp_mst: Add DSC enablement helpers to DRM
Quoted 3 lines · Lyude Paul
Nice! All I've got is a couple of typos I noticed and one question, this looks great :)
Thanks! I'll clean it up. The response to the question is below.
Quoted 74 lines
Quoted 30 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: Mikita Lipski <[email protected]>
Adding a helper function to be called by drivers outside of DRM to enable DSC on
the MST ports.Function is called to recalculate VCPI allocation if DSC is enabled and raise the DSC flag to enable. In case of disabling DSC the flag is set to false and recalculation of VCPI slots is expected to be done in encoder's
atomic_check.v2: squash separate functions into one and call it per port
Cc Harry Wentland <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 61 +++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 5 +++ 2 files changed, 66 insertions(+)drivers/gpu/drm/drm_dp_mst_topology.c +0
-0drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_atomic_check_topology_state(struct · line 4749
Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +4
-0@@ -4742,6 +4742,67 @@ drm_dp_mst_atomic_check_topology_state(structdrm_dp_mst_topology_mgr *mgr, return 0; } +/** +* drm_dp_mst_atomic_enable_dsc - Set DSC Enable Flag to On/Off +* @state: Pointer to the new drm_atomic_state +* @pointer: Pointer to the affected MST Port Typo here
Quoted 34 lines
drivers/gpu/drm/drm_dp_mst_topology.c +34
-0+* @pbn: Newly recalculated bw required for link with DSC enabled +* @pbn_div: Divider to calculate correct number of pbn per slot +* @enable: Boolean flag enabling or disabling DSC on the port +* +* This function enables DSC on the given Port +* by recalculating its vcpi from pbn provided +* and sets dsc_enable flag to keep track of which +* ports have DSC enabled +* +*/ +int drm_dp_mst_atomic_enable_dsc (struct drm_atomic_state *state, +struct drm_dp_mst_port *port, +int pbn,int pbn_div, +bool enable) +{ +struct drm_dp_mst_topology_state *mst_state; +struct drm_dp_vcpi_allocation *pos; +bool found = false; +int vcpi =0 ; + + mst_state =drm_atomic_get_mst_topology_state (state, port->mgr); + +if (IS_ERR (mst_state)) +return PTR_ERR (mst_state); + +list_for_each_entry (pos, &mst_state->vcpis, next) { +if (pos->port == port) { + found = true; +break ; + } + } + +if (!found) { + DRM_DEBUG_ATOMIC("[MST PORT:%p] Couldn't find VCPI allocation
Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_atomic_check_topology_state(struct drm_dp_mst_topology_mgr *mgr, · line 4785
Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3
-0in mst state %p\n", + port, mst_state); +return -EINVAL ; + }Just double checking-does this handle the case where we're enabling DSC on a port that didn't previously have a VCPI allocation because it wasn't enabled previously? Or do we not need to handle that here
Because we call encoder atomic check previously to allocate VCPI slots - the port should have VCPI allocation before enabling DSC even if it wasn't enabled previously. Therefore, I was thinking, that if encoder atomic check fails to allocate VCPI slots for the port - we shouldn't enable DSC on it and probably should fail atomic check if that is even requested.
Quoted 57 lines
Assuming you did the right thing here, with the small typo fixes:
Reviewed-by Lyude Paul <[email protected]>Quoted 52 lines
drivers/gpu/drm/drm_dp_mst_topology.c +9
-0+ +if (pos->dsc_enabled == enable) { + DRM_DEBUG_ATOMIC("[MST PORT:%p] DSC flag is already set to %d, returning %d VCPI slots\n", + port, enable, pos->vcpi); + vcpi = pos->vcpi; + } + +if (enable) { + vcpi = drm_dp_atomic_find_vcpi_slots(state, port->mgr, port,pbn,
pbn_div);drivers/gpu/drm/drm_dp_mst_topology.c +1
-0+ DRM_DEBUG_ATOMIC("[MST PORT:%p] Enabling DSC flag,reallocating %d VCPI slots on the port\n",
drivers/gpu/drm/drm_dp_mst_topology.c +10
-0+ port, vcpi); +if (vcpi <0 ) +return -EINVAL ; + } + + pos->dsc_enabled = enable; + +return vcpi; +} +EXPORT_SYMBOL (drm_dp_mst_atomic_enable_dsc);/** * drm_dp_mst_atomic_check - Check that the new state of an MST topology in an
* atomic update is validinclude/drm/drm_dp_mst_helper.h +5
-0@@ -502,6 +502,7 @@ struct drm_dp_payload {struct drm_dp_vcpi_allocation {struct drm_dp_mst_port *port;int vcpi; +bool dsc_enabled;struct list_head next; };@@ -773,6 +774,10 @@ drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int pbn_div); +int drm_dp_mst_atomic_enable_dsc (struct drm_atomic_state *state, +struct drm_dp_mst_port *port, +int pbn,int pbn_div, +bool enable); int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,struct
drm_dp_mst_topology_mgr*mgr,
Signature · 8 lines
Thanks, Mikita Lipski Software Engineer, AMD [email protected] _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 12/17 drm/dp_mst: Add branch bandwidth validation to MST atomic check
In reply to [email protected]From: Mikita Lipski <[email protected]>
Adding PBN attribute to drm_dp_vcpi_allocation structure to keep track of how much bandwidth each Port requires. Adding drm_dp_mst_atomic_check_bw_limit to verify that state's bandwidth needs doesn't exceed available bandwidth. The funtion is called in drm_dp_mst_atomic_check after drm_dp_mst_atomic_check_topology_state to fully verify that the proposed topology is supported.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 67 ++++++++++++++++++++++++++- include/drm/drm_dp_mst_helper.h | 1 + 2 files changed, 66 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +65 -2
@@ -4052,7 +4052,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, {struct drm_dp_mst_topology_state *topology_state;struct drm_dp_vcpi_allocation *pos, *vcpi =NULL ; -int prev_slots, req_slots; +int prev_slots, prev_bw, req_slots, ret; topology_state =drm_atomic_get_mst_topology_state (state, mgr);if (IS_ERR (topology_state))
@@ -4063,6 +4063,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,if (pos->port == port) { vcpi = pos; prev_slots = vcpi->vcpi; + prev_bw = vcpi->pbn;/* * This should never happen, unless the driver tries
@@ -4078,8 +4079,10 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,break ; } } -if (!vcpi) +if (!vcpi) { prev_slots =0 ; + prev_bw =0 ; + }if (pbn_div <=0 ) pbn_div = mgr->pbn_div;
@@ -4089,6 +4092,9 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n" , port->connector->base.id, port->connector->name, port, prev_slots, req_slots); +DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] [MST PORT:%p] PBN %d -> %d\n" , + port->connector->base.id, port->connector->name, + port, prev_bw, pbn);/* Add the new allocation to the state */ if (!vcpi) {
@@ -4101,6 +4107,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,list_add (&vcpi->next, &topology_state->vcpis); } vcpi->vcpi = req_slots; + vcpi->pbn = pbn;return req_slots; }
@@ -4703,6 +4710,59 @@ static void drm_dp_mst_destroy_state(struct drm_private_obj *obj,kfree (mst_state); } +static bool drm_dp_mst_port_downstream_of_branch (struct drm_dp_mst_port *port, +struct drm_dp_mst_branch *branch) +{ +while (port->parent) { +if (port->parent == branch) +return true; + +if (port->parent->port_parent) + port = port->parent->port_parent; +else +break ; + } +return false; +} + +static inline +int drm_dp_mst_atomic_check_bw_limit (struct drm_dp_mst_branch *branch, +struct drm_dp_mst_topology_state *mst_state) +{ +struct drm_dp_mst_port *port; +struct drm_dp_vcpi_allocation *vcpi; +int pbn_limit =0 , pbn_used =0 ; + +list_for_each_entry (port, &branch->ports, next) { +if (port->mstb) { +if (drm_dp_mst_atomic_check_bw_limit (port->mstb, mst_state)) +return -EINVAL ; + } +if (port->available_pbn >0 ) + pbn_limit = port->available_pbn; + } +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] branch has %d PBN available\n" , + branch, + pbn_limit); + +list_for_each_entry (vcpi, &mst_state->vcpis, next) { +if (!vcpi->pbn) +continue ; + +if (drm_dp_mst_port_downstream_of_branch (vcpi->port, branch)) + pbn_used += vcpi->pbn; + } +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] branch used %d PBN\n" , + branch, + pbn_used); +if (pbn_used > pbn_limit) { +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] No available bandwidth\n" , + branch); +return -EINVAL ; + } +return 0 ; +} +static inline int drm_dp_mst_atomic_check_topology_state (struct drm_dp_mst_topology_mgr *mgr,struct drm_dp_mst_topology_state *mst_state)
@@ -4834,6 +4894,9 @@ int drm_dp_mst_atomic_check(struct drm_atomic_state *state) ret =drm_dp_mst_atomic_check_topology_state (mgr, mst_state);if (ret)break ; + ret =drm_dp_mst_atomic_check_bw_limit (mgr->mst_primary, mst_state); +if (ret) +break ; }return ret;
include/drm/drm_dp_mst_helper.h +1 -0
@@ -502,6 +502,7 @@ struct drm_dp_payload {struct drm_dp_vcpi_allocation {struct drm_dp_mst_port *port;int vcpi; +int pbn;bool dsc_enabled;struct list_head next; };
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v8 12/17] drm/dp_mst: Add branch bandwidth validation to MST atomic check
Quoted 24 lines · On 2019-12-03 9:35 a.m., [email protected] wrote:
From: Mikita Lipski <[email protected]>
Adding PBN attribute to
drm_dp_vcpi_allocationstructure to keep track of how much bandwidth each Port requires. Addingdrm_dp_mst_atomic_check_bw_limitto verify that state's bandwidth needs doesn't exceed available bandwidth. The funtion is called indrm_dp_mst_atomic_checkafterdrm_dp_mst_atomic_check_topology_stateto fully verify that the proposed topology is supported.Cc Jerry Zuo <[email protected]>Cc Harry Wentland <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 67 ++++++++++++++++++++++++++- include/drm/drm_dp_mst_helper.h | 1 + 2 files changed, 66 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_dp_mst_topology.c +0
-0
drivers/gpu/drm/drm_dp_mst_topology.c int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, · line 4056
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1
-1@@ -4052,7 +4052,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, {struct drm_dp_mst_topology_state *topology_state;struct drm_dp_vcpi_allocation *pos, *vcpi =NULL ; -int prev_slots, req_slots; +int prev_slots, prev_bw, req_slots, ret;
'ret' is unused here.
Harry
Quoted 116 lines
drivers/gpu/drm/drm_dp_mst_topology.c +64
-1topology_state =drm_atomic_get_mst_topology_state (state, mgr);if (IS_ERR (topology_state))@@ -4063,6 +4063,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,if (pos->port == port) { vcpi = pos; prev_slots = vcpi->vcpi; + prev_bw = vcpi->pbn;/* * This should never happen, unless the driver tries @@ -4078,8 +4079,10 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,break ; } } -if (!vcpi) +if (!vcpi) { prev_slots =0 ; + prev_bw =0 ; + }if (pbn_div <=0 ) pbn_div = mgr->pbn_div;@@ -4089,6 +4092,9 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n" , port->connector->base.id, port->connector->name, port, prev_slots, req_slots); +DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] [MST PORT:%p] PBN %d -> %d\n" , + port->connector->base.id, port->connector->name, + port, prev_bw, pbn);/* Add the new allocation to the state */ if (!vcpi) {@@ -4101,6 +4107,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,list_add (&vcpi->next, &topology_state->vcpis); } vcpi->vcpi = req_slots; + vcpi->pbn = pbn;return req_slots; }@@ -4703,6 +4710,59 @@ static void drm_dp_mst_destroy_state(struct drm_private_obj *obj,kfree (mst_state); } +static bool drm_dp_mst_port_downstream_of_branch (struct drm_dp_mst_port *port, +struct drm_dp_mst_branch *branch) +{ +while (port->parent) { +if (port->parent == branch) +return true; + +if (port->parent->port_parent) + port = port->parent->port_parent; +else +break ; + } +return false; +} + +static inline +int drm_dp_mst_atomic_check_bw_limit (struct drm_dp_mst_branch *branch, +struct drm_dp_mst_topology_state *mst_state) +{ +struct drm_dp_mst_port *port; +struct drm_dp_vcpi_allocation *vcpi; +int pbn_limit =0 , pbn_used =0 ; + +list_for_each_entry (port, &branch->ports, next) { +if (port->mstb) { +if (drm_dp_mst_atomic_check_bw_limit (port->mstb, mst_state)) +return -EINVAL ; + } +if (port->available_pbn >0 ) + pbn_limit = port->available_pbn; + } +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] branch has %d PBN available\n" , + branch, + pbn_limit); + +list_for_each_entry (vcpi, &mst_state->vcpis, next) { +if (!vcpi->pbn) +continue ; + +if (drm_dp_mst_port_downstream_of_branch (vcpi->port, branch)) + pbn_used += vcpi->pbn; + } +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] branch used %d PBN\n" , + branch, + pbn_used); +if (pbn_used > pbn_limit) { +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] No available bandwidth\n" , + branch); +return -EINVAL ; + } +return 0 ; +} +static inline int drm_dp_mst_atomic_check_topology_state (struct drm_dp_mst_topology_mgr *mgr,struct drm_dp_mst_topology_state *mst_state)@@ -4834,6 +4894,9 @@ int drm_dp_mst_atomic_check(struct drm_atomic_state *state) ret =drm_dp_mst_atomic_check_topology_state (mgr, mst_state);if (ret)break ; + ret =drm_dp_mst_atomic_check_bw_limit (mgr->mst_primary, mst_state); +if (ret) +break ; }return ret;include/drm/drm_dp_mst_helper.h +0
-0
include/drm/drm_dp_mst_helper.h struct drm_dp_payload { · line 508
Quoted 7 lines
include/drm/drm_dp_mst_helper.h +1
-0@@ -502,6 +502,7 @@ struct drm_dp_payload {struct drm_dp_vcpi_allocation {struct drm_dp_mst_port *port;int vcpi; +int pbn;bool dsc_enabled;struct list_head next; };
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v8 12/17] drm/dp_mst: Add branch bandwidth validation to MST atomic check
In reply to [email protected]Quoted 111 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: Mikita Lipski <[email protected]>
Adding PBN attribute to
drm_dp_vcpi_allocationstructure to keep track of how much bandwidth each Port requires. Addingdrm_dp_mst_atomic_check_bw_limitto verify that state's bandwidth needs doesn't exceed available bandwidth. The funtion is called indrm_dp_mst_atomic_checkafterdrm_dp_mst_atomic_check_topology_stateto fully verify that the proposed topology is supported.Cc Jerry Zuo <[email protected]>Cc Harry Wentland <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 67 ++++++++++++++++++++++++++- include/drm/drm_dp_mst_helper.h | 1 + 2 files changed, 66 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_dp_mst_topology.c +1
-1@@ -4052,7 +4052,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, {struct drm_dp_mst_topology_state *topology_state;struct drm_dp_vcpi_allocation *pos, *vcpi =NULL ; -int prev_slots, req_slots; +int prev_slots, prev_bw, req_slots, ret; topology_state =drm_atomic_get_mst_topology_state (state, mgr);drivers/gpu/drm/drm_dp_mst_topology.c +1
-0if (IS_ERR (topology_state))@@ -4063,6 +4063,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, if (pos->port == port) { vcpi = pos; prev_slots = vcpi->vcpi; + prev_bw = vcpi->pbn;/* drivers/gpu/drm/drm_dp_mst_topology.c +3
-1* This should never happen, unless the driver tries @@ -4078,8 +4079,10 @@ int drm_dp_atomic_find_vcpi_slots(structdrm_atomic_state *state, break; } } -if (!vcpi) +if (!vcpi) { prev_slots =0 ; + prev_bw =0 ; + }if (pbn_div <=0 )drivers/gpu/drm/drm_dp_mst_topology.c +3
-0pbn_div = mgr->pbn_div;@@ -4089,6 +4092,9 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n" , port->connector->base.id, port->connector->name, port, prev_slots, req_slots); +DRM_DEBUG_ATOMIC ("[CONNECTOR:%d:%s] [MST PORT:%p] PBN %d -> %d\n" , + port->connector->base.id, port->connector->name, + port, prev_bw, pbn);/* Add the new allocation to the state */ drivers/gpu/drm/drm_dp_mst_topology.c +1
-0if (!vcpi) {@@ -4101,6 +4107,7 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,list_add (&vcpi->next, &topology_state->vcpis); } vcpi->vcpi = req_slots; + vcpi->pbn = pbn;return req_slots;}
drivers/gpu/drm/drm_dp_mst_topology.c +18
-0@@ -4703,6 +4710,59 @@ static void drm_dp_mst_destroy_state(structdrm_private_obj *obj,kfree (mst_state ); } +static bool drm_dp_mst_port_downstream_of_branch (struct drm_dp_mst_port *port, +struct drm_dp_mst_branch *branch) +{ +while (port->parent) { +if (port->parent == branch) +return true; + +if (port->parent->port_parent) + port = port->parent->port_parent; +else +break ; + } +return false; +} + +static inline +int drm_dp_mst_atomic_check_bw_limit (struct drm_dp_mst_branch *branch, + struct drm_dp_mst_topology_state
*mst_state)drivers/gpu/drm/drm_dp_mst_topology.c +8
-0+{ +struct drm_dp_mst_port *port; +struct drm_dp_vcpi_allocation *vcpi; +int pbn_limit =0 , pbn_used =0 ; + +list_for_each_entry (port, &branch->ports, next) { +if (port->mstb) { + if (drm_dp_mst_atomic_check_bw_limit(port->mstb,
mst_state))
drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_mst_destroy_state(struct drm_private_obj *obj, · line 4746
Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +8
-0+return -EINVAL ; + } +if (port->available_pbn >0 ) + pbn_limit = port->available_pbn; + } +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] branch has %d PBN available\n" , + branch, + pbn_limit);
Should fix the indenting here
drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_mst_destroy_state(struct drm_private_obj *obj, · line 4757
Quoted 11 lines
drivers/gpu/drm/drm_dp_mst_topology.c +11
-0+ +list_for_each_entry (vcpi, &mst_state->vcpis, next) { +if (!vcpi->pbn) +continue ; + +if (drm_dp_mst_port_downstream_of_branch (vcpi->port, branch)) + pbn_used += vcpi->pbn; + } +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] branch used %d PBN\n" , + branch, + pbn_used);
optional bikeshed: put branch and pbn_used on the same line
Quoted 13 lines
drivers/gpu/drm/drm_dp_mst_topology.c +8
-0+if (pbn_used > pbn_limit) { +DRM_DEBUG_ATOMIC ("[MST BRANCH:%p] No available bandwidth\n" , + branch); +return -EINVAL ; + } +return 0 ; +} +static inline int drm_dp_mst_atomic_check_topology_state (struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_topology_state
*mst_state)
drivers/gpu/drm/drm_dp_mst_topology.c int drm_dp_mst_atomic_check(struct drm_atomic_state · line 4897
Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0
-0@@ -4834,6 +4894,9 @@ int drm_dp_mst_atomic_check(struct drm_atomic_state *state) ret =drm_dp_mst_atomic_check_topology_state (mgr, mst_state);if (ret)break ;
We should probably rename drm_dp_mst_atomic_check_topology_state() to check_payloads or something along those lines
And that's it! This looks awesome, with those small changes consider this:
Quoted 20 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3
-0+ ret =drm_dp_mst_atomic_check_bw_limit (mgr->mst_primary, mst_state); +if (ret) +break ; }drivers/gpu/drm/drm_dp_mst_topology.c +0
-0return ret;include/drm/drm_dp_mst_helper.h +1
-0@@ -502,6 +502,7 @@ struct drm_dp_payload {struct drm_dp_vcpi_allocation {struct drm_dp_mst_port *port;int vcpi; +int pbn;bool dsc_enabled;struct list_head next; };
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 13/17 drm/amd/display: Add PBN per slot calculation for DSC
In reply to [email protected]From: Mikita Lipski <[email protected]>
[why]
Need to calculate VCPI slots differently for DSC
to take in account current link rate, link count
and FEC.
[how]
Add helper to get pbn_div from dc_link
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 8 ++++++++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h | 2 ++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +8 -0
@@ -491,3 +491,11 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, aconnector->connector_id); } +int dm_mst_get_pbn_divider (struct dc_link *link) +{ +if (!link) +return 0 ; + +return dc_link_bandwidth_kbps (link, +dc_link_get_link_cap (link)) / (8 *1000 *54 ); +}
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +2 -0
@@ -29,6 +29,8 @@struct amdgpu_display_manager ;struct amdgpu_dm_connector ; +int dm_mst_get_pbn_divider (struct dc_link *link); +void amdgpu_dm_initialize_dp_connector (struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 14/17 drm/amd/display: MST DSC compute fair share
In reply to [email protected]From: David Francis <[email protected]>
If there is limited link bandwidth on a MST network, it must be divided fairly between the streams on that network
Implement an algorithm to determine the correct DSC config for each stream
The algorithm:
This
[ ] ( )
represents the range of bandwidths possible for a given stream. The [] area represents the range of DSC configs, and the () represents no DSC. The bandwidth used increases from left to right.
First, try disabling DSC on all streams
[ ] (|)
[ ] (|)
Check this against the bandwidth limits of the link and each branch (including each endpoint). If it passes, the job is done
Second, try maximum DSC compression on all streams that support DSC
[| ] ( )
[| ] ( )
If this does not pass, then enabling this combination of streams is impossible
Otherwise, divide the remaining bandwidth evenly amongst the streams
[ | ] ( )
[ | ] ( )
If one or more of the streams reach minimum compression, evenly divide the reamining bandwidth amongst the remaining streams
[ |] ( )
[ |] ( )
[ | ] ( )
[ | ] ( )
If all streams can reach minimum compression, disable compression greedily
[ |] ( )
[ |] ( )
[ ] (|)Perform this algorithm on each full update, on each MST link with at least one DSC stream on it
After the configs are computed, call dcn20_add_dsc_to_stream_resource on each stream with DSC enabled. It is only after all streams are created that we can know which of them will need DSC.
Do all of this at the end of amdgpu atomic check. If it fails, fail check; This combination of timings cannot be supported.
v2: Use drm_dp_mst_atomic_check to validate bw for certain dsc configurations
v3: Use dc_dsc_policy structure to get min and max bpp rate for DSC configuration
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 + .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 364 ++++++++++++++++++ .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 3 + .../drm/amd/display/dc/dcn20/dcn20_resource.c | 7 +- .../drm/amd/display/dc/dcn20/dcn20_resource.h | 1 + 5 files changed, 376 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -8095,6 +8095,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,if (ret) goto fail; +if (!compute_mst_dsc_configs_for_state (state, dm_state->context)) + goto fail; +if (dc_validate_global_state (dc, dm_state->context, false) !=DC_OK ) { ret = -EINVAL ; goto fail;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +364 -0
373 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +3 -0
@@ -34,4 +34,7 @@ int dm_mst_get_pbn_divider(struct dc_link *link);void amdgpu_dm_initialize_dp_connector (struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector); + +bool compute_mst_dsc_configs_for_state (struct drm_atomic_state *state, +struct dc_state *dc_state);#endif
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +5 -2
@@ -1558,7 +1558,7 @@ static void release_dsc(struct resource_context *res_ctx, -static enum dc_status add_dsc_to_stream_resource (struct dc *dc, +enum dc_status dcn20_add_dsc_to_stream_resource (struct dc *dc,struct dc_state *dc_ctx,struct dc_stream_state *dc_stream) {
@@ -1573,6 +1573,9 @@ static enum dc_status add_dsc_to_stream_resource(struct dc *dc,if (pipe_ctx->stream != dc_stream)continue ; +if (pipe_ctx->stream_res.dsc) +continue ; +acquire_dsc (&dc_ctx->res_ctx, pool, &pipe_ctx->stream_res.dsc);/* The number of DSCs can be less than the number of pipes */
@@ -1622,7 +1625,7 @@ enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx,/* Get a DSC if required and available */ if (result ==DC_OK && dc_stream->timing.flags.DSC) - result =add_dsc_to_stream_resource (dc, new_ctx, dc_stream); + result =dcn20_add_dsc_to_stream_resource (dc, new_ctx, dc_stream);if (result ==DC_OK ) result =dcn20_build_mapped_resource (dc, new_ctx, dc_stream);
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h +1 -0
@@ -157,6 +157,7 @@ void dcn20_calculate_dlg_params(enum dc_status dcn20_build_mapped_resource (const struct dc *dc,struct dc_state *context,struct dc_stream_state *stream);enum dc_status dcn20_add_stream_to_ctx (struct dc *dc,struct dc_state *new_ctx,struct dc_stream_state *dc_stream); +enum dc_status dcn20_add_dsc_to_stream_resource (struct dc *dc,struct dc_state *dc_ctx,struct dc_stream_state *dc_stream);enum dc_status dcn20_remove_stream_from_ctx (struct dc *dc,struct dc_state *new_ctx,struct dc_stream_state *dc_stream);enum dc_status dcn20_get_default_swizzle_mode (struct dc_plane_state *plane_state);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Lyude Paul
maintainerRe: [PATCH v8 14/17] drm/amd/display: MST DSC compute fair share
I've still gotta do a little bit of thinking on this one, but I'll make sure to get back to you about this patch on monday. In the mean time, everything else looks great! Thanks for the good work :)
Quoted 586 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: David Francis <[email protected]>
If there is limited link bandwidth on a MST network, it must be divided fairly between the streams on that network
Implement an algorithm to determine the correct DSC config for each stream
The algorithm:
This
[ ] ( )
represents the range of bandwidths possible for a given stream. The [] area represents the range of DSC configs, and the () represents no DSC. The bandwidth used increases from left to right.First, try disabling DSC on all streams
[ ] (|)
[ ] (|)
Check this against the bandwidth limits of the link and each branch (including each endpoint). If it passes, the job is doneSecond, try maximum DSC compression on all streams that support DSC
[| ] ( )
[| ] ( )
If this does not pass, then enabling this combination of streams is impossibleOtherwise, divide the remaining bandwidth evenly amongst the streams
[ | ] ( )
[ | ] ( )If one or more of the streams reach minimum compression, evenly divide the reamining bandwidth amongst the remaining streams
[ |] ( )
[ |] ( )
[ | ] ( )
[ | ] ( )If all streams can reach minimum compression, disable compression greedily
[ |] ( ) [ |] ( ) [ ] (|)Perform this algorithm on each full update, on each MST link with at least one DSC stream on it
After the configs are computed, call
dcn20_add_dsc_to_stream_resourceon each stream with DSC enabled. It is only after all streams are created that we can know which of them will need DSC.Do all of this at the end of amdgpu atomic check. If it fails, fail check; This combination of timings cannot be supported.
v2: Use
drm_dp_mst_atomic_checkto validate bw for certain dsc configurationsv3: Use
dc_dsc_policystructure to get min and max bpp rate for DSC configurationCc Lyude Paul <[email protected]>Cc Manasi Navare <[email protected]>Reviewed-by Wenjing Liu <[email protected]>Signed-off-by David Francis <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 + .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 364 ++++++++++++++++++ .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 3 + .../drm/amd/display/dc/dcn20/dcn20_resource.c | 7 +- .../drm/amd/display/dc/dcn20/dcn20_resource.h | 1 + 5 files changed, 376 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3
-0@@ -8095,6 +8095,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (ret) goto fail; +if (!compute_mst_dsc_configs_for_state (state, dm_state- >context)) + goto fail; + if (dc_validate_global_state(dc, dm_state->context, false) !=
DC_OK) {drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0ret = -EINVAL ; goto fail;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +29
-0@@ -40,6 +40,10 @@#if defined(CONFIG_DEBUG_FS )#include "amdgpu_dm_debugfs.h" #endif + + +#include "dc/dcn20/dcn20_resource.h" +/* #define TRACE_DPCD */ #ifdef TRACE_DPCD @@ -499,3 +503,363 @@ int dm_mst_get_pbn_divider(struct dc_link *link)return dc_link_bandwidth_kbps (link,dc_link_get_link_cap (link)) / (8 *1000 *54 ); } + +struct dsc_mst_fairness_params { +struct dc_crtc_timing *timing; +struct dc_sink *sink; +struct dc_dsc_bw_range bw_range; +bool compression_possible; +struct drm_dp_mst_port *port; +}; + +struct dsc_mst_fairness_vars { +int pbn; +bool dsc_enabled; +int bpp_x16; +}; + +static int kbps_to_peak_pbn (int kbps) +{ +u64 peak_kbps = kbps; + + peak_kbps *=1006 ; + peak_kbps /=1000 ; +return (int )DIV_ROUND_UP (peak_kbps *64 , (54 *8 *1000 )); +} + +static void set_dsc_configs_from_fairness_vars(struct
dsc_mst_fairness_params*params,drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +7
-0+struct dsc_mst_fairness_vars *vars, + int count) +{ + int i; + +for (i =0 ; i < count; i++) { + memset(¶ms[i].timing->dsc_cfg, 0, sizeof(params[i].timing-Quoted 1 line
dsc_cfg));drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+ if (vars[i].dsc_enabled && dc_dsc_compute_config( + params[i].sink->ctx->dc->res_pool-Quoted 1 line
dscs[0],
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1
-0+ ¶ms[i].sink-Quoted 1 line
sink_dsc_caps.dsc_dec_caps,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1
-0+ params[i].sink->ctx->dc-Quoted 1 line
debug.dsc_min_slice_height_override,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5
-0+ 0, + params[i].timing, + ¶ms[i].timing->dsc_cfg)) { + params[i].timing->flags.DSC =1 ; + params[i].timing->dsc_cfg.bits_per_pixel =vars[i].bpp_x16;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +16
-0+ }else { + params[i].timing->flags.DSC =0 ; + } + } +} + +static int bpp_x16_from_pbn (struct dsc_mst_fairness_params param,int pbn) +{ +struct dc_dsc_config dsc_config; +u64 kbps; + + kbps = (u64 )pbn *994 *8 *54 /64 ; + dc_dsc_compute_config( + param.sink->ctx->dc->res_pool->dscs[0], + ¶m.sink->sink_dsc_caps.dsc_dec_caps, + param.sink->ctx->dc-Quoted 1 line
debug.dsc_min_slice_height_override,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +24
-0+ (int) kbps, param.timing, &dsc_config); + +return dsc_config.bits_per_pixel; +} + +static void increase_dsc_bpp (struct drm_atomic_state *state, +struct dc_link *dc_link, +struct dsc_mst_fairness_params *params, +struct dsc_mst_fairness_vars *vars, +int count) +{ +int i; +bool bpp_increased[MAX_PIPES ]; +int initial_slack[MAX_PIPES ]; +int min_initial_slack; +int next_index; +int remaining_to_increase =0 ; +int pbn_per_timeslot; +int link_timeslots_used; +int fair_pbn_alloc; + +for (i =0 ; i < count; i++) { +if (vars[i].dsc_enabled) { + initial_slack[i] =
kbps_to_peak_pbn(params[i].bw_range.max_kbps)- vars[i].pbn;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +17
-0+ bpp_increased[i] = false; + remaining_to_increase +=1 ; + }else { + initial_slack[i] =0 ; + bpp_increased[i] = true; + } + } + + pbn_per_timeslot =dc_link_bandwidth_kbps (dc_link, +dc_link_get_link_cap (dc_link)) / (8 *1000 *54 ); + +while (remaining_to_increase) { + next_index =-1 ; + min_initial_slack =-1 ; +for (i =0 ; i < count; i++) { +if (!bpp_increased[i]) { + if (min_initial_slack == -1 ||
min_initial_slack> initial_slack[i]) {drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +13
-0+ min_initial_slack = initial_slack[i]; + next_index = i; + } + } + } + +if (next_index ==-1 ) +break ; + + link_timeslots_used =0 ; + +for (i =0 ; i < count; i++) + link_timeslots_used += DIV_ROUND_UP(vars[i].pbn,
pbn_per_timeslot);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+ + fair_pbn_alloc = (63 - link_timeslots_used) /
remaining_to_increase*pbn_per_timeslot;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5
-0+ +if (initial_slack[next_index] > fair_pbn_alloc) { + vars[next_index].pbn += fair_pbn_alloc; + drm_dp_atomic_find_vcpi_slots(state, + params[next_index].port-Quoted 1 line
mgr,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3
-0+ params[next_index].port, + vars[next_index].pbn, + dm_mst_get_pbn_divider(d
c_link));drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+if (!drm_dp_mst_atomic_check (state)) { + vars[next_index].bpp_x16 =
bpp_x16_from_pbn(params[next_index], vars[next_index].pbn);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +4
-0+ }else { + vars[next_index].pbn -= fair_pbn_alloc; + drm_dp_atomic_find_vcpi_slots(state, + params[next_index].port-Quoted 1 line
mgr,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3
-0+ params[next_index].port, + vars[next_index].pbn, + dm_mst_get_pbn_divider(d
c_link));drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5
-0+ } + }else { + vars[next_index].pbn += initial_slack[next_index]; + drm_dp_atomic_find_vcpi_slots(state, + params[next_index].port-Quoted 1 line
mgr,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3
-0+ params[next_index].port, + vars[next_index].pbn, + dm_mst_get_pbn_divider(d
c_link));drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+if (!drm_dp_mst_atomic_check (state)) { + vars[next_index].bpp_x16 =params[next_index].bw_range.max_target_bpp_x16;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+ }else { + vars[next_index].pbn -=initial_slack[next_index];
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+ drm_dp_atomic_find_vcpi_slots(state, + params[next_index].port-Quoted 1 line
mgr,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3
-0+ params[next_index].port, + vars[next_index].pbn, + dm_mst_get_pbn_divider(d
c_link));drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +23
-0+ } + } + + bpp_increased[next_index] = true; + remaining_to_increase--; + } +} + +static void try_disable_dsc(struct drm_atomic_state *state, + struct dc_link *dc_link, + struct dsc_mst_fairness_params *params, + struct dsc_mst_fairness_vars *vars, + int count) +{ + int i; + bool tried[MAX_PIPES]; + int kbps_increase[MAX_PIPES]; + int max_kbps_increase; + int next_index; + int remaining_to_try = 0; + + for (i = 0; i < count; i++) { + if (vars[i].dsc_enabled && vars[i].bpp_x16 ==params[i].bw_range.max_target_bpp_x16) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1
-0+ kbps_increase[i] = params[i].bw_range.stream_kbps -params[i].bw_range.max_kbps;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +14
-0+ tried[i] = false; + remaining_to_try +=1 ; + }else { + kbps_increase[i] =0 ; + tried[i] = true; + } + } + +while (remaining_to_try) { + next_index =-1 ; + max_kbps_increase =-1 ; +for (i =0 ; i < count; i++) { +if (!tried[i]) { + if (max_kbps_increase == -1 ||
max_kbps_increase< kbps_increase[i]) {drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +10
-0+ max_kbps_increase = kbps_increase[i]; + next_index = i; + } + } + } + +if (next_index ==-1 ) +break ; + + vars[next_index].pbn =
kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +11
-0+drm_dp_atomic_find_vcpi_slots (state, + params[next_index].port->mgr, + params[next_index].port, + vars[next_index].pbn, +0 ); + +if (!drm_dp_mst_atomic_check (state)) { + vars[next_index].dsc_enabled = false; + vars[next_index].bpp_x16 =0 ; + }else { + vars[next_index].pbn =
kbps_to_peak_pbn(params[next_index].bw_range.max_kbps);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5
-0+drm_dp_atomic_find_vcpi_slots (state, + params[next_index].port->mgr, + params[next_index].port, + vars[next_index].pbn, +dm_mst_get_pbn_divider (dc_link));
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +8
-0+ } + + tried[next_index] = true; + remaining_to_try--; + } +} + +static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state*state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +26
-0+struct dc_state *dc_state, + struct dc_link *dc_link) +{ + int i; +struct dc_stream_state *stream; +struct dsc_mst_fairness_params params[MAX_PIPES ]; +struct dsc_mst_fairness_vars vars[MAX_PIPES ]; +struct amdgpu_dm_connector *aconnector; +int count =0 ; + +memset (params,0 ,sizeof (params)); + +/* Set up params */ +for (i =0 ; i < dc_state->stream_count; i++) { +struct dc_dsc_policy dsc_policy = {0 }; + + stream = dc_state->streams[i]; + +if (stream->link != dc_link) +continue ; + + stream->timing.flags.DSC =0 ; + + params[count].timing = &stream->timing; + params[count].sink = stream->sink; + aconnector = (struct amdgpu_dm_connector *)stream-Quoted 1 line
dm_stream_context;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+ params[count].port = aconnector->port; + params[count].compression_possible = stream->sink-Quoted 1 line
sink_dsc_caps.dsc_dec_caps.is_dsc_supported;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1
-0+ dc_dsc_get_policy_for_timing(params[count].timing,
&dsc_policy);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3
-0+ if (!dc_dsc_compute_bandwidth_range( + stream->sink->ctx->dc->res_pool->dscs[0], + stream->sink->ctx->dc-Quoted 1 line
debug.dsc_min_slice_height_override,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5
-0+ dsc_policy.min_target_bpp, + dsc_policy.max_target_bpp, + &stream->sink->sink_dsc_caps.dsc_dec_caps, + &stream->timing, ¶ms[count].bw_range)) + params[count].bw_range.stream_kbps =
dc_bandwidth_in_kbps_from_timing(&stream->timing);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +6
-0+ + count++; + } +/* Try no compression */ +for (i =0 ; i < count; i++) { + vars[i].pbn =
kbps_to_peak_pbn(params[i].bw_range.stream_kbps);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +17
-0+ vars[i].dsc_enabled = false; + vars[i].bpp_x16 =0 ; +drm_dp_atomic_find_vcpi_slots (state, + params[i].port->mgr, + params[i].port, + vars[i].pbn, +0 ); + } +if (!drm_dp_mst_atomic_check (state)) { +set_dsc_configs_from_fairness_vars (params, vars, count); +return true; + } + +/* Try max compression */ +for (i =0 ; i < count; i++) { +if (params[i].compression_possible) { + vars[i].pbn =
kbps_to_peak_pbn(params[i].bw_range.min_kbps);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+ vars[i].dsc_enabled = true; + vars[i].bpp_x16 =params[i].bw_range.min_target_bpp_x16;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5
-0+drm_dp_atomic_find_vcpi_slots (state, + params[i].port->mgr, + params[i].port, + vars[i].pbn, +dm_mst_get_pbn_divider (dc_link));
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2
-0+ }else { + vars[i].pbn =
kbps_to_peak_pbn(params[i].bw_range.stream_kbps);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +40
-0+ vars[i].dsc_enabled = false; + vars[i].bpp_x16 =0 ; +drm_dp_atomic_find_vcpi_slots (state, + params[i].port->mgr, + params[i].port, + vars[i].pbn, +0 ); + } + } +if (drm_dp_mst_atomic_check (state)) +return false; + +/* Optimize degree of compression */ +increase_dsc_bpp (state, dc_link, params, vars, count); + +try_disable_dsc (state, dc_link, params, vars, count); + +set_dsc_configs_from_fairness_vars (params, vars, count); + +return true; +} + +bool compute_mst_dsc_configs_for_state (struct drm_atomic_state *state, +struct dc_state *dc_state) +{ +int i, j; +struct dc_stream_state *stream; +bool computed_streams[MAX_PIPES ]; +struct amdgpu_dm_connector *aconnector; + +for (i =0 ; i < dc_state->stream_count; i++) + computed_streams[i] = false; + +for (i =0 ; i < dc_state->stream_count; i++) { + stream = dc_state->streams[i]; + +if (stream->signal !=SIGNAL_TYPE_DISPLAY_PORT_MST ) +continue ; + + aconnector = (struct amdgpu_dm_connector *)stream-Quoted 1 line
dm_stream_context;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +5
-0+ +if (!aconnector || !aconnector->dc_sink) +continue ; + + if (!aconnector->dc_sink-Quoted 1 line
sink_dsc_caps.dsc_dec_caps.is_dsc_supported)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +7
-0+continue ; + +if (computed_streams[i]) +continue ; + +mutex_lock (&aconnector->mst_mgr.lock); + if (!compute_mst_dsc_configs_for_link(state, dc_state, stream-Quoted 1 line
link)) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +16
-0+mutex_unlock (&aconnector->mst_mgr.lock); +return false; + } +mutex_unlock (&aconnector->mst_mgr.lock); + +for (j =0 ; j < dc_state->stream_count; j++) { +if (dc_state->streams[j]->link == stream->link) + computed_streams[j] = true; + } + } + +for (i =0 ; i < dc_state->stream_count; i++) { + stream = dc_state->streams[i]; + +if (stream->timing.flags.DSC ==1 ) + dcn20_add_dsc_to_stream_resource(stream->ctx->dc,
dc_state, stream);drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +4
-0+ } + +return true; +}drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +3
-0@@ -34,4 +34,7 @@ int dm_mst_get_pbn_divider(struct dc_link *link);void amdgpu_dm_initialize_dp_connector (struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector); + +bool compute_mst_dsc_configs_for_state (struct drm_atomic_state *state, +struct dc_state *dc_state);#endif
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1
-1@@ -1558,7 +1558,7 @@ static void release_dsc(struct resource_context *res_ctx, -static enum dc_status add_dsc_to_stream_resource(struct dc *dc, +enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc,struct dc_state *dc_ctx,struct dc_stream_state *dc_stream){
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +3
-0@@ -1573,6 +1573,9 @@ static enum dc_status add_dsc_to_stream_resource(struct dc *dc, if (pipe_ctx->stream != dc_stream) continue; +if (pipe_ctx->stream_res.dsc) +continue ; +acquire_dsc (&dc_ctx->res_ctx, pool, &pipe_ctx- >stream_res.dsc);drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1
-1/* The number of DSCs can be less than the number of pipes */ @@ -1622,7 +1625,7 @@ enum dc_status dcn20_add_stream_to_ctx(struct dc *dc,struct dc_state *new_ctx,/* Get a DSC if required and available */ if (result == DC_OK && dc_stream->timing.flags.DSC) - result =add_dsc_to_stream_resource (dc, new_ctx, dc_stream); + result =dcn20_add_dsc_to_stream_resource (dc, new_ctx, dc_stream);drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +0
-0if (result ==DC_OK ) result =dcn20_build_mapped_resource (dc, new_ctx, dc_stream);drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h +1
-0@@ -157,6 +157,7 @@ void dcn20_calculate_dlg_params(enum dc_status dcn20_build_mapped_resource (const struct dc *dc,struct dc_state *context,struct dc_stream_state *stream);enum dc_status dcn20_add_stream_to_ctx (struct dc *dc,struct dc_state *new_ctx,struct dc_stream_state *dc_stream); +enum dc_status dcn20_add_dsc_to_stream_resource (struct dc *dc,struct dc_state *dc_ctx,struct dc_stream_state *dc_stream);enum
dc_statusdcn20_remove_stream_from_ctx(struct dc *dc, structdc_state*new_ctx, structdc_stream_state*dc_stream);
enumdc_statusdcn20_get_default_swizzle_mode(structdc_plane_state*plane_state);
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v8 15/17 drm/amd/display: Recalculate VCPI slots for new DSC connectors
In reply to [email protected]From: Mikita Lipski <[email protected]>
[why]
Since for DSC MST connector's PBN is claculated differently due to compression, we have to recalculate both PBN and VCPI slots for that connector.
[how]
The function iterates through all the active streams to find, which have DSC enabled, then recalculates PBN for it and calls drm_dp_helper_update_vcpi_slots_for_dsc to update connector's VCPI slots.
v2: - use drm_dp_mst_atomic_enable_dsc per port to enable/disable DSC
v3: - Iterate through connector states from the state passed
- On each connector state get stream from dc_state,
instead CRTC state
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 76 +++++++++++++++++-- 1 file changed, 71 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +71 -5
@@ -4986,6 +4986,69 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = { .atomic_check = dm_encoder_helper_atomic_check }; +static int dm_update_mst_vcpi_slots_for_dsc (struct drm_atomic_state *state, +struct dc_state *dc_state) +{ +struct dc_stream_state *stream =NULL ; +struct drm_connector *connector; +struct drm_connector_state *new_con_state, *old_con_state; +struct amdgpu_dm_connector *aconnector; +struct dm_connector_state *dm_conn_state; +int i, j, clock, bpp; +int vcpi, pbn_div, pbn =0 ; + +for_each_oldnew_connector_in_state (state, connector, old_con_state, new_con_state, i) { + + aconnector =to_amdgpu_dm_connector (connector); + +if (!aconnector->port) +continue ; + +if (!new_con_state || !new_con_state->crtc) +continue ; + + dm_conn_state =to_dm_connector_state (new_con_state); + +for (j =0 ; j < dc_state->stream_count; j++) { + stream = dc_state->streams[j]; +if (!stream) +continue ; + +if ((struct amdgpu_dm_connector *)stream->dm_stream_context == aconnector) +break ; + + stream =NULL ; + } + +if (!stream) +continue ; + +if (stream->timing.flags.DSC !=1 ) { +drm_dp_mst_atomic_enable_dsc (state, + aconnector->port, + dm_conn_state->pbn, +0 , + false); +continue ; + } + + pbn_div =dm_mst_get_pbn_divider (stream->link); + bpp = stream->timing.dsc_cfg.bits_per_pixel; + clock = stream->timing.pix_clk_100hz /10 ; + pbn =drm_dp_calc_pbn_mode (clock, bpp, true); + vcpi =drm_dp_mst_atomic_enable_dsc (state, + aconnector->port, + pbn, pbn_div, + true); +if (vcpi <0 ) +return vcpi; + + dm_conn_state->pbn = pbn; + dm_conn_state->vcpi_slots = vcpi; + } +return 0 ; +} +static void dm_drm_plane_reset (struct drm_plane *plane) {struct dm_plane_state *amdgpu_state =NULL ;
@@ -8022,11 +8085,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,if (ret) goto fail; -/* Perform validation of MST topology in the state*/ - ret =drm_dp_mst_atomic_check (state); -if (ret) - goto fail; -if (state->legacy_cursor_update) {/* * This is a fast cursor update coming from the plane update
@@ -8098,6 +8156,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,if (!compute_mst_dsc_configs_for_state (state, dm_state->context)) goto fail; + ret =dm_update_mst_vcpi_slots_for_dsc (state, dm_state->context); +if (ret) + goto fail; +if (dc_validate_global_state (dc, dm_state->context, false) !=DC_OK ) { ret = -EINVAL ; goto fail;
@@ -8126,6 +8188,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,dc_retain_state (old_dm_state->context); } } +/* Perform validation of MST topology in the state*/ + ret =drm_dp_mst_atomic_check (state); +if (ret) + goto fail;/* Store the overall update type for use later in atomic check. */ for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v8 15/17] drm/amd/display: Recalculate VCPI slots for new DSC connectors
Quoted 147 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: Mikita Lipski <[email protected]>
[why]
Since for DSC MST connector's PBN is claculated differently due to compression, we have to recalculate both PBN and VCPI slots for that connector.[how]
The function iterates through all the active streams to find, which have DSC enabled, then recalculates PBN for it and callsdrm_dp_helper_update_vcpi_slots_for_dscto update connector's VCPI slots.v2: - use
drm_dp_mst_atomic_enable_dscper port to enable/disable DSCv3: - Iterate through connector states from the state passed
- On each connector state get stream fromdc_state,
instead CRTC stateCc Jerry Zuo <[email protected]>Cc Harry Wentland <[email protected]>Cc Lyude Paul <[email protected]>Cc Manasi Navare <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 76 +++++++++++++++++-- 1 file changed, 71 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +63
-0@@ -4986,6 +4986,69 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = { .atomic_check = dm_encoder_helper_atomic_check }; +static int dm_update_mst_vcpi_slots_for_dsc (struct drm_atomic_state *state, +struct dc_state *dc_state) +{ +struct dc_stream_state *stream =NULL ; +struct drm_connector *connector; +struct drm_connector_state *new_con_state, *old_con_state; +struct amdgpu_dm_connector *aconnector; +struct dm_connector_state *dm_conn_state; +int i, j, clock, bpp; +int vcpi, pbn_div, pbn =0 ; + +for_each_oldnew_connector_in_state (state, connector, old_con_state, new_con_state, i) { + + aconnector =to_amdgpu_dm_connector (connector); + +if (!aconnector->port) +continue ; + +if (!new_con_state || !new_con_state->crtc) +continue ; + + dm_conn_state =to_dm_connector_state (new_con_state); + +for (j =0 ; j < dc_state->stream_count; j++) { + stream = dc_state->streams[j]; +if (!stream) +continue ; + +if ((struct amdgpu_dm_connector *)stream- >dm_stream_context == aconnector) +break ; + + stream =NULL ; + } + +if (!stream) +continue ; + +if (stream->timing.flags.DSC !=1 ) { +drm_dp_mst_atomic_enable_dsc (state, + aconnector->port, + dm_conn_state->pbn, +0 , + false); +continue ; + } + + pbn_div =dm_mst_get_pbn_divider (stream->link); + bpp = stream->timing.dsc_cfg.bits_per_pixel; + clock = stream->timing.pix_clk_100hz /10 ; + pbn =drm_dp_calc_pbn_mode (clock, bpp, true); + vcpi =drm_dp_mst_atomic_enable_dsc (state, + aconnector->port, + pbn, pbn_div, + true); +if (vcpi <0 ) +return vcpi; + + dm_conn_state->pbn = pbn; + dm_conn_state->vcpi_slots = vcpi; + } +return 0 ; +} +static void
dm_drm_plane_reset(struct drm_plane *plane){drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-5struct dm_plane_state *amdgpu_state =NULL ;@@ -8022,11 +8085,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (ret) goto fail; -/* Perform validation of MST topology in the state*/ - ret =drm_dp_mst_atomic_check (state); -if (ret) - goto fail; -if (state->legacy_cursor_update) {/* drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4
-0* This is a fast cursor update coming from the plane update @@ -8098,6 +8156,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (!compute_mst_dsc_configs_for_state(state, dm_state- >context)) goto fail; + ret =dm_update_mst_vcpi_slots_for_dsc (state, dm_state- >context); +if (ret) + goto fail; +if (
dc_validate_global_state(dc, dm_state->context, false)!=DC_OK) {drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4
-0ret = -EINVAL ; goto fail;@@ -8126,6 +8188,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,dc_retain_state (old_dm_state->context); } } +/* Perform validation of MST topology in the state*/ + ret =drm_dp_mst_atomic_check (state); +if (ret) + goto fail;/* Store the overall update type for use later in atomic check. */
for_each_new_crtc_in_state(state, crtc,new_crtc_state, i) {
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v8 16/17 drm/dp_mst: Add helper to trigger modeset on affected DSC MST CRTCs
In reply to [email protected]From: Mikita Lipski <[email protected]>
[why]
Whenever a connector on an MST network is changed or undergoes a modeset, the DSC configs for each stream on that topology will be recalculated. This can change their required bandwidth, requiring a full reprogramming, as though a modeset was performed, even if that stream did not change timing.
[how]
Adding helper to trigger modesets on MST DSC connectors by setting mode_changed flag on CRTCs in the same topology as affected connector
v2: use drm_dp_mst_dsc_aux_for_port function to verify if the port is DSC capable
--- drivers/gpu/drm/drm_dp_mst_topology.c | 62 +++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 2 + 2 files changed, 64 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +62 -0
@@ -4802,6 +4802,68 @@ drm_dp_mst_atomic_check_topology_state(struct drm_dp_mst_topology_mgr *mgr,return 0 ; } +/** +* drm_dp_mst_add_affected_dsc_crtcs +* @state: Pointer to the new &struct drm_dp_mst_topology_state +* @port: Pointer tothe port of connector with new state +* +* Whenever there is a change in mst topology +* DSC configuration would have to be recalculated +* therefore we need to trigger modeset on all affected +* CRTCs in that topology +* +* See also: +* drm_dp_mst_atomic_enable_dsc() +*/ +int drm_dp_mst_add_affected_dsc_crtcs (struct drm_atomic_state *state,struct drm_dp_mst_topology_mgr *mgr) +{ +struct drm_dp_mst_topology_state *mst_state; +struct drm_dp_vcpi_allocation *pos; +struct drm_connector *connector; +struct drm_connector_state *conn_state; +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; + +if (!mgr) { +DRM_DEBUG_ATOMIC ("[MST MGR:%p] Passed Topology Manager pointer is pointing to NULL\n" , mgr); +return -EINVAL ; + } + + mst_state =drm_atomic_get_mst_topology_state (state, mgr); + +list_for_each_entry (pos, &mst_state->vcpis, next) { + + connector = pos->port->connector; + +if (!connector) +return -EINVAL ; + + conn_state =drm_atomic_get_connector_state (state, connector); + +if (IS_ERR (conn_state)) +return PTR_ERR (conn_state); + + crtc = conn_state->crtc; + +if (!crtc) +return -EINVAL ; + +if (!drm_dp_mst_dsc_aux_for_port (pos->port)) +continue ; + + crtc_state =drm_atomic_get_crtc_state (mst_state->base.state, crtc); + +if (IS_ERR (crtc_state)) +return PTR_ERR (crtc_state); + +DRM_DEBUG_ATOMIC ("[MST MGR:%p] Setting mode_changed flag on CRTC %p\n" , mgr, crtc); + + crtc_state->mode_changed = true; + } +return 0 ; +} +EXPORT_SYMBOL (drm_dp_mst_add_affected_dsc_crtcs); +/** * drm_dp_mst_atomic_enable_dsc - Set DSC Enable Flag to On/Off * @state: Pointer to the new drm_atomic_state
include/drm/drm_dp_mst_helper.h +2 -0
@@ -779,6 +779,8 @@ int drm_dp_mst_atomic_enable_dsc(struct drm_atomic_state *state,struct drm_dp_mst_port *port, int pbn, int pbn_div, bool enable); +int drm_dp_mst_add_affected_dsc_crtcs (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr); int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [PATCH v8 16/17] drm/dp_mst: Add helper to trigger modeset on affected DSC MST CRTCs
Thank you for the patch! Perhaps something to improve:
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20191203]
[cannot apply to drm-intel/for-linux-next linus/master v5.4-rc8 v5.4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/mikita-lipski-amd-com/DSC-MST-support-for-DRM-and-AMDGPU/20191204-020604 base: 1ab75b2e415a29dba9aec94f203c6f88dbfc0ba0 reproduce: make htmldocs
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
fs/posix_acl.c:647: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode' include/linux/regulator/machine.h:196: warning: Function parameter or member 'max_uV_step' not described in 'regulation_constraints' include/linux/regulator/driver.h:223: warning: Function parameter or member 'resume' not described in 'regulator_ops' sound/soc/soc-core.c:2509: warning: Function parameter or member 'legacy_dai_naming' not described in 'snd_soc_register_dai' include/linux/skbuff.h:888: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'list' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'head_frag' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encapsulation' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_valid' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_vlan_present_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'vlan_present' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_level' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff' include/net/sock.h:232: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_portpair' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_cookie' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_listener' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
include/net/sock.h:232: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common' include/net/sock.h:232: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common' include/net/sock.h:514: warning: Function parameter or member 'sk_rx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_tx_skb_cache' not described in 'sock'
include/net/sock.h:514: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock' include/net/sock.h:514: warning: Function parameter or member 'sk_bpf_storage' not described in 'sock'
include/net/sock.h:2454: warning: Function parameter or member 'tcp_rx_skb_cache_key' not described in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2454: warning: Excess function parameter 'sk' description in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2454: warning: Excess function parameter 'skb' description in 'DECLARE_STATIC_KEY_FALSE' include/linux/netdevice.h:1779: warning: bad line: spinlock
include/linux/netdevice.h:2077: warning: Function parameter or member 'gso_partial_features' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'name_assign_type' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'mpls_ptr' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xdp_prog' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'nf_hooks_ingress' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'qdisc_hash' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device' include/linux/netdevice.h:2077: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state' include/linux/i2c.h:337: warning: Function parameter or member 'init_irq' not described in 'i2c_client' drivers/infiniband/core/umem_odp.c:167: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_alloc_child' drivers/infiniband/core/umem_odp.c:217: warning: Function parameter or member 'ops' not described in 'ib_umem_odp_get' drivers/infiniband/ulp/iser/iscsi_iser.h:401: warning: Function parameter or member 'all_list' not described in 'iser_fr_desc' drivers/infiniband/ulp/iser/iscsi_iser.h:415: warning: Function parameter or member 'all_list' not described in 'iser_fr_pool' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd0' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd1' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd2' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd3' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:148: warning: Function parameter or member 'rsvd4' not described in 'opa_vesw_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd0' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd1' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd2' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:205: warning: Function parameter or member 'rsvd3' not described in 'opa_per_veswport_info' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:263: warning: Function parameter or member 'tbl_entries' not described in 'opa_veswport_mactable' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:342: warning: Function parameter or member 'reserved' not described in 'opa_veswport_summary_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd0' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd1' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd2' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd3' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd4' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd5' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd6' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd7' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd8' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:394: warning: Function parameter or member 'rsvd9' not described in 'opa_veswport_error_counters' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:460: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:485: warning: Function parameter or member 'reserved' not described in 'opa_vnic_notice_attr' drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.h:500: warning: Function parameter or member 'reserved' not described in 'opa_vnic_vema_mad_trap' include/linux/input/sparse-keymap.h:43: warning: Function parameter or member 'sw' not described in 'key_entry' kernel/futex.c:1187: warning: Function parameter or member 'ret' not described in 'wait_for_owner_exiting' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'prepare_writeback_job' not described in 'drm_connector_helper_funcs' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'cleanup_writeback_job' not described in 'drm_connector_helper_funcs' drivers/gpu/drm/drm_dp_mst_topology.c:4819: warning: Excess function parameter 'port' description in 'drm_dp_mst_add_affected_dsc_crtcs' drivers/gpu/drm/drm_dp_mst_topology.c:4885: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' drivers/gpu/drm/drm_dp_mst_topology.c:4819: warning: Excess function parameter 'port' description in 'drm_dp_mst_add_affected_dsc_crtcs' drivers/gpu/drm/drm_dp_mst_topology.c:4885: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' include/drm/drm_dp_mst_helper.h:162: warning: Function parameter or member 'fec_capable' not described in 'drm_dp_mst_port'
>> drivers/gpu/drm/drm_dp_mst_topology.c:4820: warning: Function parameter or member 'mgr' not described in 'drm_dp_mst_add_affected_dsc_crtcs'
drivers/gpu/drm/drm_dp_mst_topology.c:4820: warning: Excess function parameter 'port' description in 'drm_dp_mst_add_affected_dsc_crtcs' drivers/gpu/drm/drm_dp_mst_topology.c:4886: warning: Function parameter or member 'port' not described in 'drm_dp_mst_atomic_enable_dsc' drivers/gpu/drm/drm_dp_mst_topology.c:4886: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' drivers/gpu/drm/drm_dp_mst_topology.c:4819: warning: Excess function parameter 'port' description in 'drm_dp_mst_add_affected_dsc_crtcs' drivers/gpu/drm/drm_dp_mst_topology.c:4885: warning: Excess function parameter 'pointer' description in 'drm_dp_mst_atomic_enable_dsc' include/net/cfg80211.h:1189: warning: Function parameter or member 'txpwr' not described in 'station_parameters' include/net/mac80211.h:4081: warning: Function parameter or member 'sta_set_txpwr' not described in 'ieee80211_ops' include/net/mac80211.h:2036: warning: Function parameter or member 'txpwr' not described in 'ieee80211_sta' include/linux/devfreq.h:181: warning: Function parameter or member 'last_status' not described in 'devfreq' drivers/devfreq/devfreq.c:1708: warning: bad line: - Resource-managed devfreq_register_notifier()
drivers/devfreq/devfreq.c:1744: warning: bad line: - Resource-managed devfreq_unregister_notifier() drivers/devfreq/devfreq-event.c:355: warning: Function parameter or member 'edev' not described in 'devfreq_event_remove_edev' drivers/devfreq/devfreq-event.c:355: warning: Excess function parameter 'dev' description in 'devfreq_event_remove_edev' Documentation/admin-guide/xfs.rst:257: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/admin-guide/hw-vuln/tsx_async_abort.rst:142: WARNING: duplicate label virt_mechanism, other instance in Documentation/admin-guide/hw-vuln/mds.rst Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:358: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/ras.rst:363: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/admin-guide/sysctl/kernel.rst:397: WARNING: Title underline too short.
vim +4820 drivers/gpu/drm/drm_dp_mst_topology.c
4804
4805 /**
4806 * drm_dp_mst_add_affected_dsc_crtcs
4807 * @state: Pointer to the new &struct drm_dp_mst_topology_state
4808 * @port: Pointer tothe port of connector with new state
4809 *
4810 * Whenever there is a change in mst topology
4811 * DSC configuration would have to be recalculated
4812 * therefore we need to trigger modeset on all affected
4813 * CRTCs in that topology
4814 *
4815 * See also:
4816 * drm_dp_mst_atomic_enable_dsc()
4817 */
4818 int drm_dp_mst_add_affected_dsc_crtcs(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr)
> 4819 {
> 4820 struct drm_dp_mst_topology_state *mst_state; 4821 struct drm_dp_vcpi_allocation *pos;
4822 struct drm_connector *connector;
4823 struct drm_connector_state *conn_state;
4824 struct drm_crtc *crtc;
4825 struct drm_crtc_state *crtc_state;
4826
4827 if (!mgr) {
4828 DRM_DEBUG_ATOMIC("[MST MGR:%p] Passed Topology Manager pointer is pointing to NULL\n", mgr);
4829 return -EINVAL;
4830 }
4831
4832 mst_state = drm_atomic_get_mst_topology_state(state, mgr);
4833
4834 list_for_each_entry(pos, &mst_state->vcpis, next) {
4835
4836 connector = pos->port->connector;
4837
4838 if (!connector)
4839 return -EINVAL;
4840
4841 conn_state = drm_atomic_get_connector_state(state, connector);
4842
4843 if (IS_ERR(conn_state))
4844 return PTR_ERR(conn_state);
4845
4846 crtc = conn_state->crtc;
4847
4848 if (!crtc)
4849 return -EINVAL;
4850
4851 if (!drm_dp_mst_dsc_aux_for_port(pos->port))
4852 continue;
4853
4854 crtc_state = drm_atomic_get_crtc_state(mst_state->base.state, crtc);
4855
4856 if (IS_ERR(crtc_state))
4857 return PTR_ERR(crtc_state);
4858
4859 DRM_DEBUG_ATOMIC("[MST MGR:%p] Setting mode_changed flag on CRTC %p\n", mgr, crtc);
4860
4861 crtc_state->mode_changed = true;
4862 }
4863 return 0;
4864 }
4865 EXPORT_SYMBOL(drm_dp_mst_add_affected_dsc_crtcs);
4866
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
Re: [PATCH v8 16/17] drm/dp_mst: Add helper to trigger modeset on affected DSC MST CRTCs
In reply to [email protected]Quoted 53 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: Mikita Lipski <[email protected]>
[why]
Whenever a connector on an MST network is changed or undergoes a modeset, the DSC configs for each stream on that topology will be recalculated. This can change their required bandwidth, requiring a full reprogramming, as though a modeset was performed, even if that stream did not change timing.[how]
Adding helper to trigger modesets on MST DSC connectors by settingmode_changedflag on CRTCs in the same topology as affected connectorv2: use
drm_dp_mst_dsc_aux_for_portfunction to verify if the port is DSC capableCc Manasi Navare <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 62 +++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 2 + 2 files changed, 64 insertions(+)drivers/gpu/drm/drm_dp_mst_topology.c +17
-0@@ -4802,6 +4802,68 @@ drm_dp_mst_atomic_check_topology_state(structdrm_dp_mst_topology_mgr *mgr, return 0; } +/** +* drm_dp_mst_add_affected_dsc_crtcs +* @state: Pointer to the new &struct drm_dp_mst_topology_state +* @port: Pointer tothe port of connector with new state +* +* Whenever there is a change in mst topology +* DSC configuration would have to be recalculated +* therefore we need to trigger modeset on all affected +* CRTCs in that topology +* +* See also: +* drm_dp_mst_atomic_enable_dsc() +*/ +int drm_dp_mst_add_affected_dsc_crtcs (struct drm_atomic_state *state,struct drm_dp_mst_topology_mgr *mgr) +{ +struct drm_dp_mst_topology_state *mst_state; +struct drm_dp_vcpi_allocation *pos;
drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_atomic_check_topology_state(struct · line 4833
Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +9
-0+struct drm_connector *connector; +struct drm_connector_state *conn_state; +struct drm_crtc *crtc; +struct drm_crtc_state *crtc_state; + +if (!mgr) { + DRM_DEBUG_ATOMIC("[MST MGR:%p] Passed Topology Manager pointer is pointing to NULL\n", mgr); + return -EINVAL; + }
I'd get rid of this check, we'll notice pretty easily if it's NULL :P
drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_atomic_check_topology_state(struct · line 4835
Quoted 2 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2
-0+ + mst_state =drm_atomic_get_mst_topology_state (state, mgr);
Forgot to check IS_ERR(mst_state) here
Quoted 7 lines
drivers/gpu/drm/drm_dp_mst_topology.c +7
-0+ +list_for_each_entry (pos, &mst_state->vcpis, next) { + + connector = pos->port->connector; + +if (!connector) +return -EINVAL ;
drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_mst_atomic_check_topology_state(struct drm_dp_mst_topology_mgr *mgr, · line 4849
Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +10
-0+ + conn_state =drm_atomic_get_connector_state (state, connector); + +if (IS_ERR (conn_state)) +return PTR_ERR (conn_state); + + crtc = conn_state->crtc; + +if (!crtc) +return -EINVAL ;
This seems like something that would be an error from a driver using the API incorrectly, maybe this should be something like
if (WARN_ON(!crtc))
return -EINVAL;
Quoted 11 lines
drivers/gpu/drm/drm_dp_mst_topology.c +5
-0+ +if (!drm_dp_mst_dsc_aux_for_port (pos->port)) +continue ; + + crtc_state = drm_atomic_get_crtc_state(mst_state->base.state,crtc);
drivers/gpu/drm/drm_dp_mst_topology.c +5
-0+ +if (IS_ERR (crtc_state)) +return PTR_ERR (crtc_state); + + DRM_DEBUG_ATOMIC("[MST MGR:%p] Setting mode_changed flag on
Quoted 1 line
CRTC %p\n", mgr, crtc);
This can be wrapped a bit more to fit in 80 chars
drivers/gpu/drm/drm_dp_mst_topology.c
Quoted 2 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2
-0+ + crtc_state->mode_changed = true;
Nitpick here: I usually try to group assignments and conditional checks on those assignments unless it makes it more difficult to read, like:
ret = cool_function();
if (ret)
return ret;
But not too big of a deal either way. Won't hold back review
Quoted 14 lines
drivers/gpu/drm/drm_dp_mst_topology.c +5
-0+ } +return 0 ; +} +EXPORT_SYMBOL (drm_dp_mst_add_affected_dsc_crtcs); +/** * drm_dp_mst_atomic_enable_dsc - Set DSC Enable Flag to On/Off * @state: Pointer to the new drm_atomic_state include/drm/drm_dp_mst_helper.h +0
-0
include/drm/drm_dp_mst_helper.h int drm_dp_mst_atomic_enable_dsc(struct drm_atomic_state · line 784
Quoted 6 lines
include/drm/drm_dp_mst_helper.h +2
-0@@ -779,6 +779,8 @@ int drm_dp_mst_atomic_enable_dsc(struct drm_atomic_state *state, struct drm_dp_mst_port *port, int pbn, int pbn_div, bool enable); +int drm_dp_mst_add_affected_dsc_crtcs (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr);
I'd add a __must_check attribute here. With the more important changes addressed here:
Quoted 3 lines
include/drm/drm_dp_mst_helper.h +0
-0int __must_check drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,struct
drm_dp_mst_topology_mgr*mgr,
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v8 17/17 drm/amd/display: Trigger modesets on MST DSC connectors
In reply to [email protected]From: Mikita Lipski <[email protected]>
Whenever a connector on an MST network is attached, detached, or undergoes a modeset, the DSC configs for each stream on that topology will be recalculated. This can change their required bandwidth, requiring a full reprogramming, as though a modeset was performed, even if that stream did not change timing.
Therefore, whenever a crtc has drm_atomic_crtc_needs_modeset, for each crtc that shares a MST topology with that stream and supports DSC, add that crtc (and all affected connectors and planes) to the atomic state and set mode_changed on its state
v2: Do this check only on Navi and before adding connectors and planes on modesetting crtcs
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +33 -0
@@ -7930,6 +7930,29 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm,return ret; } +static int add_affected_mst_dsc_crtcs (struct drm_atomic_state *state,struct drm_crtc *crtc) +{ +struct drm_connector *connector; +struct drm_connector_state *conn_state; +struct amdgpu_dm_connector *aconnector =NULL ; +int i; +for_each_new_connector_in_state (state, connector, conn_state, i) { +if (conn_state->crtc != crtc) +continue ; + + aconnector =to_amdgpu_dm_connector (connector); +if (!aconnector->port) + aconnector =NULL ; +else +break ; + } + +if (!aconnector) +return 0 ; + +return drm_dp_mst_add_affected_dsc_crtcs (state, &aconnector->mst_mgr); +} +/** * amdgpu_dm_atomic_check() - Atomic check implementation for AMDgpu DM. * @dev: The DRM device
@@ -7982,6 +8005,16 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,if (ret) goto fail; +if (adev->asic_type >=CHIP_NAVI10 ) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +if (drm_atomic_crtc_needs_modeset (new_crtc_state)) { + ret =add_affected_mst_dsc_crtcs (state, crtc); +if (ret) + goto fail; + } + } + } +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->color_mgmt_changed &&
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v8 17/17] drm/amd/display: Trigger modesets on MST DSC connectors
Quoted 82 lines · On Tue, 2019-12-03 at 09:35 -0500, [email protected] wrote:
From: Mikita Lipski <[email protected]>
Whenever a connector on an MST network is attached, detached, or undergoes a modeset, the DSC configs for each stream on that topology will be recalculated. This can change their required bandwidth, requiring a full reprogramming, as though a modeset was performed, even if that stream did not change timing.
Therefore, whenever a crtc has
drm_atomic_crtc_needs_modeset, for each crtc that shares a MST topology with that stream and supports DSC, add that crtc (and all affected connectors and planes) to the atomic state and setmode_changedon its statev2: Do this check only on Navi and before adding connectors and planes on modesetting crtcs
Cc Leo Li <[email protected]>Cc Nicholas Kazlauskas <[email protected]>Cc Lyude Paul <[email protected]>Signed-off-by David Francis <[email protected]>Signed-off-by Mikita Lipski <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +23
-0@@ -7930,6 +7930,29 @@ dm_determine_update_type_for_commit(structamdgpu_display_manager *dm, return ret; } +static int add_affected_mst_dsc_crtcs (struct drm_atomic_state *state,struct drm_crtc *crtc) +{ +struct drm_connector *connector; +struct drm_connector_state *conn_state; +struct amdgpu_dm_connector *aconnector =NULL ; +int i; +for_each_new_connector_in_state (state, connector, conn_state, i) { +if (conn_state->crtc != crtc) +continue ; + + aconnector =to_amdgpu_dm_connector (connector); +if (!aconnector->port) + aconnector =NULL ; +else +break ; + } + +if (!aconnector) +return 0 ; + +return drm_dp_mst_add_affected_dsc_crtcs (state, &aconnector->mst_mgr); +} +/** *
amdgpu_dm_atomic_check()- Atomic check implementation for AMDgpu DM.
* @dev: The DRM devicedrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10
-0@@ -7982,6 +8005,16 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, if (ret) goto fail; +if (adev->asic_type >=CHIP_NAVI10 ) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +if (drm_atomic_crtc_needs_modeset (new_crtc_state)) { + ret =add_affected_mst_dsc_crtcs (state, crtc); +if (ret) + goto fail; + } + } + } + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
new_crtc_state, i) {drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && !new_crtc_state->color_mgmt_changed &&
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx