Introduce DML version 2
v3 cover Introduce DML version 2
This patchset introduces a new version of DML that will be used for some already available ASIC based on DCN3x and future devices. This new version of the DML is more reliable, provide a better programming model for hardware/software, and is more flexible for creating new tools for automation/validation (e.g., unit test). This first version is a transition step for new ASICs, meaning that we will keep improving this new component. Finally, it is important to highlight that a large part of the DML code is generated.
This patchset starts with a code refactor in the DML to improve the code isolation and avoid compilation issues when using some 32-bit architecture such as ARM and PPC. Next, it is introduced the basic code for DML2. Finally, the end of this patchset enables DML2 for some specific ASICs followed by patches that improve DML when used with specific devices.
Thanks
Siqueira
Charlene Liu (2):
drm/amd/display: Add z8_marks in dml drm/amd/display: correct dml2 input and dlg_refclk
Daniel Miess (1):
drm/amd/display: Port replay vblank logic to DML2
Gabe Teeger (1):
drm/amd/display: add check in validate_only in dml2
Qingqing Zhuo (2):
drm/amd/display: Introduce DML2
drm/amd/display: Add DCN35 DML2 support
Rodrigo Siqueira (4):
drm/amd/display: Move dce_calcs from DML folder drm/amd/display: Move custom_float outside DML drm/amd/display: Move bw_fixed outside DML folder drm/amd/display: Move dml code under CONFIG_DRM_AMD_DC_FP guard
Saaem Rizvi (1):
drm/amd/display: Modify Pipe Selection for Policy for ODM
Sung Joon Kim (3):
drm/amd/display: Handle multiple streams sourcing same surface drm/amd/display: Use fixed DET Buffer Size drm/amd/display: Fix Chroma Surface height/width initialization
Taimur Hassan (2):
drm/amd/display: Split pipe for stereo timings drm/amd/display: Move stereo timing check to helper
drivers/gpu/drm/amd/display/dc/Makefile | 6 +-
.../gpu/drm/amd/display/dc/basics/Makefile | 9 +-
.../dc/{dml/calcs => basics}/bw_fixed.c | 13 +-
.../dc/{dml/calcs => basics}/calcs_logger.h | 0
.../dc/{dml/calcs => basics}/custom_float.c | 90 +-
.../dc/{dml/calcs => basics}/dce_calcs.c | 0
drivers/gpu/drm/amd/display/dc/core/dc.c | 39 +
.../gpu/drm/amd/display/dc/core/dc_resource.c | 20 +
drivers/gpu/drm/amd/display/dc/dc.h | 5 +
.../drm/amd/display/dc/dcn32/dcn32_resource.c | 61 +-
.../amd/display/dc/dcn321/dcn321_resource.c | 41 +
.../drm/amd/display/dc/dcn35/dcn35_resource.c | 24 +-
drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 -
.../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 80 +
.../amd/display/dc/dml/dcn321/dcn321_fpu.c | 81 +
drivers/gpu/drm/amd/display/dc/dml2/Makefile | 91 +
.../gpu/drm/amd/display/dc/dml2/cmntypes.h | 92 +
.../amd/display/dc/dml2/display_mode_core.c | 10296 ++++++++++++++++
.../amd/display/dc/dml2/display_mode_core.h | 201 +
.../dc/dml2/display_mode_core_structs.h | 1970 +++
.../dc/dml2/display_mode_lib_defines.h | 75 +
.../amd/display/dc/dml2/display_mode_util.c | 796 ++
.../amd/display/dc/dml2/display_mode_util.h | 74 +
.../display/dc/dml2/dml2_dc_resource_mgmt.c | 861 ++
.../display/dc/dml2/dml2_dc_resource_mgmt.h | 48 +
.../drm/amd/display/dc/dml2/dml2_dc_types.h | 40 +
.../amd/display/dc/dml2/dml2_internal_types.h | 121 +
.../amd/display/dc/dml2/dml2_mall_phantom.c | 913 ++
.../amd/display/dc/dml2/dml2_mall_phantom.h | 50 +
.../gpu/drm/amd/display/dc/dml2/dml2_policy.c | 308 +
.../gpu/drm/amd/display/dc/dml2/dml2_policy.h | 47 +
.../display/dc/dml2/dml2_translation_helper.c | 1201 ++
.../display/dc/dml2/dml2_translation_helper.h | 39 +
.../gpu/drm/amd/display/dc/dml2/dml2_utils.c | 480 +
.../gpu/drm/amd/display/dc/dml2/dml2_utils.h | 144 +
.../drm/amd/display/dc/dml2/dml2_wrapper.c | 745 ++
.../drm/amd/display/dc/dml2/dml2_wrapper.h | 212 +
.../gpu/drm/amd/display/dc/dml2/dml_assert.h | 30 +
.../drm/amd/display/dc/dml2/dml_depedencies.h | 31 +
.../display/dc/dml2/dml_display_rq_dlg_calc.c | 585 +
.../display/dc/dml2/dml_display_rq_dlg_calc.h | 63 +
.../gpu/drm/amd/display/dc/dml2/dml_logging.h | 29 +
.../gpu/drm/amd/display/dc/inc/core_types.h | 1 +
43 files changed, 19931 insertions(+), 83 deletions(-)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/bw_fixed.c (94%)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/calcs_logger.h (100%)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/custom_float.c (66%)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/dce_calcs.c (100%)
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/Makefile
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/cmntypes.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core_structs.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_lib_defines.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_util.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_util.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_types.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_internal_types.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_mall_phantom.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_mall_phantom.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_assert.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_depedencies.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.c
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.h
create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_logging.hSignature · 1 line
2.40.1
PATCH v3 1/16 drm/amd/display: Move dce_calcs from DML folder
dce_calcs does not have FPU operations, and it is required for DCE and DCN. Remove this file from the DML folder and add it to the basic folder visible for DCE and DCN.
---
drivers/gpu/drm/amd/display/dc/basics/Makefile | 7 ++++++-
.../amd/display/dc/{dml/calcs => basics}/calcs_logger.h | 0
.../drm/amd/display/dc/{dml/calcs => basics}/dce_calcs.c | 0
drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +-
4 files changed, 7 insertions(+), 2 deletions(-)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/calcs_logger.h (100%)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/dce_calcs.c (100%)drivers/gpu/drm/amd/display/dc/basics/Makefile +6 -1
@@ -24,7 +24,12 @@ # It provides the general basic services required by other DAL # subcomponents. -BASICS = conversion.o fixpt31_32.o vector.o dc_common.o +BASICS := \ + conversion.o \ + fixpt31_32.o \ + vector.o \ + dc_common.o \ + dce_calcs.o AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
drivers/gpu/drm/amd/display/dc/basics/calcs_logger.h renamed from drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.h +0 -0
drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c renamed from drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.c +0 -0
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
@@ -134,7 +134,7 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_rcflags) -DML = calcs/dce_calcs.o calcs/custom_float.o calcs/bw_fixed.o +DML = calcs/custom_float.o calcs/bw_fixed.o ifdef CONFIG_DRM_AMD_DC_FP DML += display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o
Signature · 1 line
2.40.1
PATCH v3 2/16 drm/amd/display: Move custom_float outside DML
In reply to Rodrigo SiqueiraThe custom_float file does not have any FPU operation, so it should be inside DML. This commit moves the file to the basic folder.
---
.../gpu/drm/amd/display/dc/basics/Makefile | 3 +-
.../dc/{dml/calcs => basics}/custom_float.c | 90 +++++++------------
drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +-
3 files changed, 36 insertions(+), 59 deletions(-)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/custom_float.c (66%)drivers/gpu/drm/amd/display/dc/basics/Makefile +2 -1
@@ -29,7 +29,8 @@ BASICS := \ fixpt31_32.o \ vector.o \ dc_common.o \ - dce_calcs.o + dce_calcs.o \ + custom_float.o AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
drivers/gpu/drm/amd/display/dc/basics/custom_float.c renamed from drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.c +33 -57
163 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
@@ -134,7 +134,7 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_rcflags) -DML = calcs/custom_float.o calcs/bw_fixed.o +DML = calcs/bw_fixed.o ifdef CONFIG_DRM_AMD_DC_FP DML += display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o
Signature · 1 line
2.40.1
PATCH v3 3/16 drm/amd/display: Move bw_fixed outside DML folder
In reply to Rodrigo Siqueirabw_fixed does not need any FPU operation, and it is used on DCE and DCN. For this reason, this commit moves bw_fixed to the basic folder outside DML.
---
drivers/gpu/drm/amd/display/dc/basics/Makefile | 3 ++-
.../amd/display/dc/{dml/calcs => basics}/bw_fixed.c | 13 ++++++-------
drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 --
3 files changed, 8 insertions(+), 10 deletions(-)
rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/bw_fixed.c (94%)drivers/gpu/drm/amd/display/dc/basics/Makefile +2 -1
@@ -30,7 +30,8 @@ BASICS := \ vector.o \ dc_common.o \ dce_calcs.o \ - custom_float.o + custom_float.o \ + bw_fixed.o AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
drivers/gpu/drm/amd/display/dc/basics/bw_fixed.c renamed from drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +6 -7
@@ -1,5 +1,6 @@ +// SPDX-License-Identifier: MIT /* -* Copyright 2015 Advanced Micro Devices, Inc. +* Copyright 2023 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"),
@@ -106,9 +107,8 @@ struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)return res; } -struct bw_fixed bw_floor2 ( -const struct bw_fixed arg, -const struct bw_fixed significance) +struct bw_fixed bw_floor2 (const struct bw_fixed arg, +const struct bw_fixed significance) {struct bw_fixed result;int64_t multiplicand;
@@ -119,9 +119,8 @@ struct bw_fixed bw_floor2(return result; } -struct bw_fixed bw_ceil2 ( -const struct bw_fixed arg, -const struct bw_fixed significance) +struct bw_fixed bw_ceil2 (const struct bw_fixed arg, +const struct bw_fixed significance) {struct bw_fixed result;int64_t multiplicand;
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -2
@@ -134,8 +134,6 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_rcflags) -DML = calcs/bw_fixed.o - ifdef CONFIG_DRM_AMD_DC_FP DML += display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o DML += dcn10/dcn10_fpu.o
Signature · 1 line
2.40.1
RE: [PATCH v3 03/16] drm/amd/display: Move bw_fixed outside DML folder
[AMD Official Use Only - General]
-----Original Message-----
From: Siqueira, Rodrigo <[email protected]>
Sent: Wednesday, October 4, 2023 5:21 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Siqueira, Rodrigo <[email protected]>; Pillai, Aurabindo <[email protected]>; Zhuo, Lillian <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Zuo, Jerry <[email protected]>; Mahfooz, Hamza <[email protected]>; Gong, Richard <[email protected]>
Subject: [PATCH v3 03/16] drm/amd/display: Move bw_fixed outside DML folder
bw_fixed does not need any FPU operation, and it is used on DCE and DCN. For this reason, this commit moves bw_fixed to the basic folder outside DML.
---
drivers/gpu/drm/amd/display/dc/basics/Makefile | 3 ++-
.../amd/display/dc/{dml/calcs => basics}/bw_fixed.c | 13 ++++++-------
drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 --
3 files changed, 8 insertions(+), 10 deletions(-) rename drivers/gpu/drm/amd/display/dc/{dml/calcs => basics}/bw_fixed.c (94%)drivers/gpu/drm/amd/display/dc/basics/Makefile +2 -1
@@ -30,7 +30,8 @@ BASICS := \ vector.o \ dc_common.o \ dce_calcs.o \ - custom_float.o + custom_float.o \ + bw_fixed.o AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
drivers/gpu/drm/amd/display/dc/basics/bw_fixed.c renamed from drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +2 -1
@@ -1,5 +1,6 @@ +// SPDX-License-Identifier: MIT /* -* Copyright 2015 Advanced Micro Devices, Inc. +* Copyright 2023 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -106,9 +107,8 @@ struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)
return res;
}
-struct bw_fixed bw_floor2(
- const struct bw_fixed arg,
- const struct bw_fixed significance)
+struct bw_fixed bw_floor2(const struct bw_fixed arg,
+ const struct bw_fixed significance)
{
struct bw_fixed result;
int64_t multiplicand;
@@ -119,9 +119,8 @@ struct bw_fixed bw_floor2(
return result;}
-struct bw_fixed bw_ceil2(
- const struct bw_fixed arg,
- const struct bw_fixed significance)
+struct bw_fixed bw_ceil2(const struct bw_fixed arg,
+ const struct bw_fixed significance)
{
struct bw_fixed result;
int64_t multiplicand;drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -3
@@ -134,8 +134,6 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_rcflags) -DML = calcs/bw_fixed.o - ifdef CONFIG_DRM_AMD_DC_FP DML += display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o DML += dcn10/dcn10_fpu.o --
2.40.1
PATCH v3 4/16 drm/amd/display: Move dml code under CONFIG_DRM_AMD_DC_FP guard
In reply to Rodrigo SiqueiraFor some reason, the dml code is not guarded under CONFIG_DRM_AMD_DC_FP in the Makefile. This commit moves the dml code under the DC_FP guard.
--- drivers/gpu/drm/amd/display/dc/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/Makefile +2 -1
@@ -22,7 +22,7 @@ # # Makefile for Display Core (dc) component. -DC_LIBS = basics bios dml clk_mgr dce gpio irq link virtual dsc +DC_LIBS = basics bios clk_mgr dce gpio irq link virtual dsc ifdef CONFIG_DRM_AMD_DC_FP
@@ -43,6 +43,7 @@ DC_LIBS += dcn316 DC_LIBS += dcn32 DC_LIBS += dcn321 DC_LIBS += dcn35 +DC_LIBS += dml endif DC_LIBS += dce120
Signature · 1 line
2.40.1
RE: [PATCH v3 04/16] drm/amd/display: Move dml code under CONFIG_DRM_AMD_DC_FP guard
[AMD Official Use Only - General]
-----Original Message-----
From: Siqueira, Rodrigo <[email protected]>
Sent: Wednesday, October 4, 2023 5:21 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Siqueira, Rodrigo <[email protected]>; Pillai, Aurabindo <[email protected]>; Zhuo, Lillian <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Zuo, Jerry <[email protected]>; Mahfooz, Hamza <[email protected]>; Gong, Richard <[email protected]>
Subject: [PATCH v3 04/16] drm/amd/display: Move dml code under CONFIG_DRM_AMD_DC_FP guard
For some reason, the dml code is not guarded under CONFIG_DRM_AMD_DC_FP in the Makefile. This commit moves the dml code under the DC_FP guard.
--- drivers/gpu/drm/amd/display/dc/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/Makefile +2 -1
@@ -22,7 +22,7 @@ # # Makefile for Display Core (dc) component. -DC_LIBS = basics bios dml clk_mgr dce gpio irq link virtual dsc +DC_LIBS = basics bios clk_mgr dce gpio irq link virtual dsc ifdef CONFIG_DRM_AMD_DC_FP
@@ -43,6 +43,7 @@ DC_LIBS += dcn316 DC_LIBS += dcn32 DC_LIBS += dcn321 DC_LIBS += dcn35 +DC_LIBS += dml endif DC_LIBS += dce120
--
2.40.1
PATCH v3 5/16 drm/amd/display: Introduce DML2
In reply to Rodrigo SiqueiraFrom: Qingqing Zhuo <[email protected]>
DC is transitioning from DML to DML2, and this commit introduces all the required changes for some of the already available ASICs and adds the required code infra to support new ASICs under DML2. DML2 is also a generated code that provides better mode verification and programming models for software/hardware, and it enables a better way to create validation tools. This version is more like a middle step to the complete transition to the DML2 version.
Changes since V1:
- Alex: Fix typos
Changes since V2:
- Update DC includes
Changes since V3:
- Fix 32 bit compilation issues on x86
Changes since V4:
- Avoid compilation of DML2 on some not supported 32-bit architecture
- Update commit message
--- drivers/gpu/drm/amd/display/dc/Makefile | 3 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 39 + .../gpu/drm/amd/display/dc/core/dc_resource.c | 20 + drivers/gpu/drm/amd/display/dc/dc.h | 5 + .../drm/amd/display/dc/dcn32/dcn32_resource.c | 61 +- .../amd/display/dc/dcn321/dcn321_resource.c | 41 + .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 80 + .../amd/display/dc/dml/dcn321/dcn321_fpu.c | 81 + drivers/gpu/drm/amd/display/dc/dml2/Makefile | 91 + .../gpu/drm/amd/display/dc/dml2/cmntypes.h | 92 + .../amd/display/dc/dml2/display_mode_core.c | 10275 ++++++++++++++++ .../amd/display/dc/dml2/display_mode_core.h | 199 + .../dc/dml2/display_mode_core_structs.h | 1968 +++ .../dc/dml2/display_mode_lib_defines.h | 75 + .../amd/display/dc/dml2/display_mode_util.c | 796 ++ .../amd/display/dc/dml2/display_mode_util.h | 74 + .../display/dc/dml2/dml2_dc_resource_mgmt.c | 734 ++ .../display/dc/dml2/dml2_dc_resource_mgmt.h | 48 + .../drm/amd/display/dc/dml2/dml2_dc_types.h | 40 + .../amd/display/dc/dml2/dml2_internal_types.h | 121 + .../amd/display/dc/dml2/dml2_mall_phantom.c | 913 ++ .../amd/display/dc/dml2/dml2_mall_phantom.h | 50 + .../gpu/drm/amd/display/dc/dml2/dml2_policy.c | 301 + .../gpu/drm/amd/display/dc/dml2/dml2_policy.h | 47 + .../display/dc/dml2/dml2_translation_helper.c | 1109 ++ .../display/dc/dml2/dml2_translation_helper.h | 39 + .../gpu/drm/amd/display/dc/dml2/dml2_utils.c | 452 + .../gpu/drm/amd/display/dc/dml2/dml2_utils.h | 143 + .../drm/amd/display/dc/dml2/dml2_wrapper.c | 730 ++ .../drm/amd/display/dc/dml2/dml2_wrapper.h | 210 + .../gpu/drm/amd/display/dc/dml2/dml_assert.h | 30 + .../drm/amd/display/dc/dml2/dml_depedencies.h | 31 + .../display/dc/dml2/dml_display_rq_dlg_calc.c | 585 + .../display/dc/dml2/dml_display_rq_dlg_calc.h | 63 + .../gpu/drm/amd/display/dc/dml2/dml_logging.h | 29 + .../gpu/drm/amd/display/dc/inc/core_types.h | 1 + 36 files changed, 19572 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/Makefile create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/cmntypes.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core_structs.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_lib_defines.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_util.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/display_mode_util.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_types.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_internal_types.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_mall_phantom.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_mall_phantom.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_assert.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_depedencies.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml2/dml_logging.h
drivers/gpu/drm/amd/display/dc/Makefile +2 -1
@@ -28,8 +28,8 @@ ifdef CONFIG_DRM_AMD_DC_FP KCOV_INSTRUMENT := n -DC_LIBS += dcn20 DC_LIBS += dcn10 +DC_LIBS += dcn20 DC_LIBS += dcn21 DC_LIBS += dcn201 DC_LIBS += dcn30
@@ -44,6 +44,7 @@ DC_LIBS += dcn32 DC_LIBS += dcn321 DC_LIBS += dcn35 DC_LIBS += dml +DC_LIBS += dml2 endif DC_LIBS += dce120
drivers/gpu/drm/amd/display/dc/core/dc.c +39 -0
@@ -77,6 +77,8 @@#include "hw_sequencer_private.h" +#include "dml2/dml2_internal_types.h" +#include "dce/dmub_outbox.h" #define CTX \
@@ -2176,6 +2178,11 @@ struct dc_state *dc_create_state(struct dc *dc)init_state (dc, context); +#ifdef CONFIG_DRM_AMD_DC_FP +if (dc->debug.using_dml2) { +dml2_create (dc, &dc->dml2_options, &context->bw_ctx.dml2); + } +#endif kref_init (&context->refcount);return context;
@@ -2185,11 +2192,25 @@ struct dc_state *dc_copy_state(struct dc_state *src_ctx) {int i, j;struct dc_state *new_ctx =kvmalloc (sizeof (struct dc_state ),GFP_KERNEL ); +#ifdef CONFIG_DRM_AMD_DC_FP +struct dml2_context *dml2 =NULL ; +#endif if (!new_ctx)return NULL ;memcpy (new_ctx, src_ctx,sizeof (struct dc_state )); +#ifdef CONFIG_DRM_AMD_DC_FP +if (new_ctx->bw_ctx.dml2) { + dml2 =kzalloc (sizeof (struct dml2_context ),GFP_KERNEL ); +if (!dml2) +return NULL ; + +memcpy (dml2, src_ctx->bw_ctx.dml2,sizeof (struct dml2_context )); + new_ctx->bw_ctx.dml2 = dml2; + } +#endif +for (i =0 ; i <MAX_PIPES ; i++) {struct pipe_ctx *cur_pipe = &new_ctx->res_ctx.pipe_ctx[i];
@@ -2228,6 +2249,12 @@ static void dc_state_free(struct kref *kref) { struct dc_state *context = container_of(kref, struct dc_state, refcount);dc_resource_state_destruct (context); + +#ifdef CONFIG_DRM_AMD_DC_FP +dml2_destroy (context->bw_ctx.dml2); + context->bw_ctx.dml2 =0 ; +#endif +kvfree (context); }
@@ -4679,6 +4706,9 @@ bool dc_set_power_state( {struct kref refcount;struct display_mode_lib *dml; +#ifdef CONFIG_DRM_AMD_DC_FP +struct dml2_context *dml2 =NULL ; +#endif if (!dc->current_state)return true;
@@ -4698,6 +4728,10 @@ bool dc_set_power_state(break ;default : +#ifdef CONFIG_DRM_AMD_DC_FP +if (dc->debug.using_dml2) + dml2 = dc->current_state->bw_ctx.dml2; +#endif ASSERT (dc->current_state->stream_count ==0 );/* Zero out the current context so that on resume we start with * clean state, and dc hw programming optimizations will not
@@ -4724,6 +4758,11 @@ bool dc_set_power_state(kfree (dml); +#ifdef CONFIG_DRM_AMD_DC_FP +if (dc->debug.using_dml2) + dc->current_state->bw_ctx.dml2 = dml2; +#endif +break ; }
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +20 -0
@@ -41,6 +41,7 @@#include "dpcd_defs.h" #include "link_enc_cfg.h" #include "link.h" +#include "clk_mgr.h" #include "virtual/virtual_link_hwss.h" #include "link/hwss/link_hwss_dio.h" #include "link/hwss/link_hwss_dpia.h"
@@ -86,6 +87,8 @@ dc->ctx->logger#define DC_LOGGER_INIT (logger) +#include "dml2/dml2_wrapper.h" +#define UNABLE_TO_SPLIT -1enum dce_version resource_parse_asic_id (struct hw_asic_id asic_id)
@@ -318,6 +321,10 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc, res_pool->ref_clocks.xtalin_clock_inKhz; res_pool->ref_clocks.dchub_ref_clock_inKhz = res_pool->ref_clocks.xtalin_clock_inKhz; +if ((res_pool->hubbub->funcs->get_dchub_ref_freq)) + res_pool->hubbub->funcs->get_dchub_ref_freq (res_pool->hubbub, + res_pool->ref_clocks.dccg_ref_clock_inKhz, + &res_pool->ref_clocks.dchub_ref_clock_inKhz); }else ASSERT_CRITICAL (false); }
@@ -4358,9 +4365,22 @@ void dc_resource_state_copy_construct( {int i, j;struct kref refcount = dst_ctx->refcount; +#ifdef CONFIG_DRM_AMD_DC_FP +struct dml2_context *dml2 =NULL ; + +// Need to preserve allocated dml2 context +if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2) + dml2 = dst_ctx->bw_ctx.dml2; +#endif *dst_ctx = *src_ctx; +#ifdef CONFIG_DRM_AMD_DC_FP +// Preserve allocated dml2 context +if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2) + dst_ctx->bw_ctx.dml2 = dml2; +#endif +for (i =0 ; i <MAX_PIPES ; i++) {struct pipe_ctx *cur_pipe = &dst_ctx->res_ctx.pipe_ctx[i];
drivers/gpu/drm/amd/display/dc/dc.h +5 -0
@@ -40,6 +40,8 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" +#include "dml2/dml2_wrapper.h" +struct abm_save_restore ;/* forward declaration */
@@ -942,6 +944,7 @@ struct dc_debug_options {bool dml_disallow_alternate_prefetch_modes;bool use_legacy_soc_bb_mechanism;bool exit_idle_opt_for_cursor_updates; +bool using_dml2;bool enable_single_display_2to1_odm_policy;bool enable_double_buffered_dsc_pg_support;bool enable_dp_dig_pixel_rate_div_policy;
@@ -1049,6 +1052,8 @@ struct dc {struct _vcs_dpi_voltage_scaling_st clock_limits[DC__VOLTAGE_STATES ]; } update_bw_bounding_box; } scratch; + +struct dml2_configuration_options dml2_options; };enum frame_buffer_mode {
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +58 -3
91 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c +41 -0
47 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +80 -0
148 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c +81 -0
148 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/Makefile new file +91 -0
91 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/cmntypes.h new file +92 -0
92 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c new file +10275 -0
2,211 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.h new file +199 -0
199 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core_structs.h new file +1968 -0
1,968 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/display_mode_lib_defines.h new file +75 -0
75 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/display_mode_util.c new file +796 -0
796 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/display_mode_util.h new file +74 -0
74 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c new file +734 -0
734 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.h new file +48 -0
48 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_types.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dml2/dml2_internal_types.h new file +121 -0
121 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_mall_phantom.c new file +913 -0
913 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_mall_phantom.h new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c new file +301 -0
301 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.h new file +47 -0
47 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c new file +1109 -0
1,109 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.h new file +39 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c new file +452 -0
452 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h new file +143 -0
143 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c new file +730 -0
730 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.h new file +210 -0
210 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml_assert.h new file +30 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dml2/dml_depedencies.h new file +31 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.c new file +585 -0
585 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.h new file +63 -0
63 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml_logging.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.40.1
Part of the diff is not shown here. View the raw message.
PATCH v3 6/16 drm/amd/display: Add DCN35 DML2 support
In reply to Rodrigo SiqueiraFrom: Qingqing Zhuo <[email protected]>
Enable DML2 for DCN35.
Changes since V1:
- Remove hard coded values
--- .../drm/amd/display/dc/dcn35/dcn35_resource.c | 13 +-- .../dc/dml2/display_mode_core_structs.h | 2 + .../gpu/drm/amd/display/dc/dml2/dml2_policy.c | 7 ++ .../display/dc/dml2/dml2_translation_helper.c | 89 ++++++++++++++++++- .../drm/amd/display/dc/dml2/dml2_wrapper.c | 6 ++ 5 files changed, 110 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_resource.c +7 -6
@@ -31,7 +31,7 @@#include "resource.h" #include "include/irq_service_interface.h" #include "dcn35_resource.h" -/*#include "dml2/dml2_wrapper.h"*/ +#include "dml2/dml2_wrapper.h" #include "dcn20/dcn20_resource.h" #include "dcn30/dcn30_resource.h"
@@ -729,7 +729,7 @@ static const struct dc_debug_options debug_defaults_drv = { }, .seamless_boot_odm_combine = DML_FAIL_SOURCE_PIXEL_FORMAT, .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ -/* .using_dml2 = true, */ + .using_dml2 = true, .support_eDP1_5 = true, .enable_hpo_pg_support = false, .enable_legacy_fast_update = true,
@@ -1694,7 +1694,7 @@ static bool dcn35_validate_bandwidth(struct dc *dc, {bool out = false; -/*out = dml2_validate(dc, context, fast_validate);*/ + out =dml2_validate (dc, context, fast_validate);return out; }
@@ -2067,18 +2067,19 @@ static bool dcn35_resource_construct( dc->dcn_ip->max_num_dpp = pool->base.pipe_count; -#if 0 + dc->dml2_options.dcn_pipe_count = pool->base.pipe_count; dc->dml2_options.use_native_pstate_optimization = false; dc->dml2_options.use_native_soc_bb_construction = true; +if (dc->config.EnableMinDispClkODM) + dc->dml2_options.minimize_dispclk_using_odm = true; dc->dml2_options.callbacks.dc = dc; dc->dml2_options.callbacks.build_scaling_params = &resource_build_scaling_params; dc->dml2_options.callbacks.can_support_mclk_switch_using_fw_based_vblank_stretch = &dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch; - dc->dml2_options.callbacks.acquire_secondary_pipe_for_mpc_odm = &dc_resource_acquire_secondary_pipe_for_mpc_odm; + dc->dml2_options.callbacks.acquire_secondary_pipe_for_mpc_odm = &dc_resource_acquire_secondary_pipe_for_mpc_odm_legacy; dc->dml2_options.max_segments_per_hubp =18 ; dc->dml2_options.det_segment_size =DCN3_2_DET_SEG_SIZE ;/*todo*/ -#endif if (dc->config.sdpif_request_limit_words_per_umc ==0 ) dc->config.sdpif_request_limit_words_per_umc =16 ;/*todo*/
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core_structs.h +2 -0
@@ -32,6 +32,8 @@ enum dml_project_id { dml_project_default =1 , dml_project_dcn32 = dml_project_default, dml_project_dcn321 =2 , + dml_project_dcn35 =3 , + dml_project_dcn351 = 4, };enum dml_prefetch_modes { dml_prefetch_support_uclk_fclk_and_stutter_if_possible = 0,
drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c +7 -0
@@ -298,4 +298,11 @@ void build_unoptimized_policy_settings(enum dml_project_id project, struct dml_m policy->SynchronizeDRRDisplaysForUCLKPStateChangeFinal = true; policy->AssumeModeSupportAtMaxPwrStateEvenDRAMClockChangeNotSupported = true;// TOREVIEW: What does this mean? policy->AssumeModeSupportAtMaxPwrStateEvenFClockChangeNotSupported = true;// TOREVIEW: What does this mean? +if (project == dml_project_dcn35 || + project == dml_project_dcn351) { + policy->DCCProgrammingAssumesScanDirectionUnknownFinal = false; + policy->EnhancedPrefetchScheduleAccelerationFinal =0 ; + policy->AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter_if_possible;/*new*/ + policy->UseOnlyMaxPrefetchModes =1 ; + } }
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +88 -1
113 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +6 -0
@@ -694,6 +694,12 @@ bool dml2_create(const struct dc *in_dc, const struct dml2_configuration_options (*dml2)->config = *config;switch (in_dc->ctx->dce_version) { +case DCN_VERSION_3_5 : + (*dml2)->v20.dml_core_ctx.project = dml_project_dcn35; +break ; +case DCN_VERSION_3_51 : + (*dml2)->v20.dml_core_ctx.project = dml_project_dcn351; +break ;case DCN_VERSION_3_2 : (*dml2)->v20.dml_core_ctx.project = dml_project_dcn32;break ;
Signature · 1 line
2.40.1
PATCH v3 7/16 drm/amd/display: Add z8_marks in dml
In reply to Rodrigo SiqueiraFrom: Charlene Liu <[email protected]>
Add z8 watermarks to struct for later ASIC use.
--- drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c | 2 ++ drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.h | 2 ++ drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c | 2 ++ drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 2 ++ drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.h | 1 + 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +2 -0
@@ -10169,6 +10169,8 @@ dml_get_var_func(wm_memory_trip, dml_float_t, mode_lib->mp.UrgentLatency);dml_get_var_func (wm_fclk_change, dml_float_t, mode_lib->mp.Watermark.FCLKChangeWatermark);dml_get_var_func (wm_usr_retraining, dml_float_t, mode_lib->mp.Watermark.USRRetrainingWatermark);dml_get_var_func (wm_dram_clock_change, dml_float_t, mode_lib->mp.Watermark.DRAMClockChangeWatermark); +dml_get_var_func (wm_z8_stutter_enter_exit, dml_float_t, mode_lib->mp.Watermark.Z8StutterEnterPlusExitWatermark); +dml_get_var_func (wm_z8_stutter, dml_float_t, mode_lib->mp.Watermark.Z8StutterExitWatermark);dml_get_var_func (fraction_of_urgent_bandwidth, dml_float_t, mode_lib->mp.FractionOfUrgentBandwidth);dml_get_var_func (fraction_of_urgent_bandwidth_imm_flip, dml_float_t, mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip);dml_get_var_func (urgent_latency, dml_float_t, mode_lib->mp.UrgentLatency);
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.h +2 -0
@@ -85,6 +85,8 @@ dml_get_var_decl(wm_stutter_exit, dml_float_t);dml_get_var_decl (wm_stutter_enter_exit, dml_float_t);dml_get_var_decl (wm_memory_trip, dml_float_t);dml_get_var_decl (wm_dram_clock_change, dml_float_t); +dml_get_var_decl (wm_z8_stutter_enter_exit, dml_float_t); +dml_get_var_decl (wm_z8_stutter, dml_float_t);dml_get_var_decl (urgent_latency, dml_float_t);dml_get_var_decl (clk_dcf_deepsleep, dml_float_t);dml_get_var_decl (wm_fclk_change, dml_float_t);
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c +2 -0
@@ -369,6 +369,8 @@ void dml2_extract_watermark_set(struct dcn_watermarks *watermark, struct display watermark->urgent_latency_ns =dml_get_urgent_latency (dml_core_ctx) *1000 ; watermark->cstate_pstate.fclk_pstate_change_ns =dml_get_wm_fclk_change (dml_core_ctx) *1000 ; watermark->usr_retraining_ns =dml_get_wm_usr_retraining (dml_core_ctx) *1000 ; + watermark->cstate_pstate.cstate_enter_plus_exit_z8_ns =dml_get_wm_z8_stutter_enter_exit (dml_core_ctx) *1000 ; + watermark->cstate_pstate.cstate_exit_z8_ns =dml_get_wm_z8_stutter (dml_core_ctx) *1000 ; }void dml2_initialize_det_scratch (struct dml2_context *in_ctx)
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +2 -0
@@ -717,6 +717,8 @@ bool dml2_create(const struct dc *in_dc, const struct dml2_configuration_optionsinitialize_dml2_soc_states (*dml2, in_dc, &(*dml2)->v20.dml_core_ctx.soc, &(*dml2)->v20.dml_core_ctx.states); +/*Initialize DML20 instance which calls dml2_core_create, and core_dcn3_populate_informative*/ +//dml2_initialize_instance(&(*dml_ctx)->v20.dml_init); return true; }
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.h +1 -0
@@ -63,6 +63,7 @@ struct dml2_dcn_clocks {unsigned int ref_dtbclk_khz;bool p_state_supported;unsigned int cab_num_ways_required; +unsigned int dcfclk_khz_ds; };struct dml2_dc_callbacks {
Signature · 1 line
2.40.1
PATCH v3 8/16 drm/amd/display: Handle multiple streams sourcing same surface
In reply to Rodrigo SiqueiraFrom: Sung Joon Kim <[email protected]>
[why]
There are cases where more than 1 stream can be mapped to the same surface. DML2.0 does not seem to handle these cases.
[how]
Make sure to account for the stream id when deriving the plane id. By doing this, each plane id will be unique based on the stream id.
--- .../display/dc/dml2/dml2_dc_resource_mgmt.c | 41 ++++++++++++------- .../display/dc/dml2/dml2_translation_helper.c | 25 ++++++----- .../gpu/drm/amd/display/dc/dml2/dml2_utils.c | 19 +++++---- 3 files changed, 53 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +26 -15
@@ -53,7 +53,8 @@ struct dc_pipe_mapping_scratch {struct dc_plane_pipe_pool pipe_pool; }; -static bool get_plane_id (const struct dc_state *state,const struct dc_plane_state *plane,unsigned int *plane_id) +static bool get_plane_id (const struct dc_state *state,const struct dc_plane_state *plane, +unsigned int stream_id,unsigned int *plane_id) {int i, j;
@@ -61,10 +62,12 @@ static bool get_plane_id(const struct dc_state *state, const struct dc_plane_stareturn false;for (i =0 ; i < state->stream_count; i++) { -for (j =0 ; j < state->stream_status[i].plane_count; j++) { -if (state->stream_status[i].plane_states[j] == plane) { - *plane_id = (i <<16 ) | j; -return true; +if (state->streams[i]->stream_id == stream_id) { +for (j =0 ; j < state->stream_status[i].plane_count; j++) { +if (state->stream_status[i].plane_states[j] == plane) { + *plane_id = (i <<16 ) | j; +return true; + } } } }
@@ -111,13 +114,15 @@ static struct pipe_ctx *find_master_pipe_of_stream(struct dml2_context *ctx, strreturn NULL ; } -static struct pipe_ctx *find_master_pipe_of_plane (struct dml2_context *ctx,struct dc_state *state,unsigned int plane_id) +static struct pipe_ctx *find_master_pipe_of_plane (struct dml2_context *ctx, +struct dc_state *state,unsigned int plane_id) {int i;unsigned int plane_id_assigned_to_pipe;for (i =0 ; i < ctx->config.dcn_pipe_count; i++) { -if (state->res_ctx.pipe_ctx[i].plane_state &&get_plane_id (state, state->res_ctx.pipe_ctx[i].plane_state, &plane_id_assigned_to_pipe)) { +if (state->res_ctx.pipe_ctx[i].plane_state &&get_plane_id (state, state->res_ctx.pipe_ctx[i].plane_state, + state->res_ctx.pipe_ctx[i].stream->stream_id, &plane_id_assigned_to_pipe)) {if (plane_id_assigned_to_pipe == plane_id)return &state->res_ctx.pipe_ctx[i]; }
@@ -126,14 +131,16 @@ static struct pipe_ctx *find_master_pipe_of_plane(struct dml2_context *ctx, strureturn NULL ; } -static unsigned int find_pipes_assigned_to_plane (struct dml2_context *ctx,struct dc_state *state,unsigned int plane_id,unsigned int *pipes) +static unsigned int find_pipes_assigned_to_plane (struct dml2_context *ctx, +struct dc_state *state,unsigned int plane_id,unsigned int *pipes) {int i;unsigned int num_found =0 ;unsigned int plane_id_assigned_to_pipe;for (i =0 ; i < ctx->config.dcn_pipe_count; i++) { -if (state->res_ctx.pipe_ctx[i].plane_state &&get_plane_id (state, state->res_ctx.pipe_ctx[i].plane_state, &plane_id_assigned_to_pipe)) { +if (state->res_ctx.pipe_ctx[i].plane_state &&get_plane_id (state, state->res_ctx.pipe_ctx[i].plane_state, + state->res_ctx.pipe_ctx[i].stream->stream_id, &plane_id_assigned_to_pipe)) {if (plane_id_assigned_to_pipe == plane_id) pipes[num_found++] = i; }
@@ -499,7 +506,7 @@ static struct pipe_ctx *assign_pipes_to_plane(struct dml2_context *ctx, struct dunsigned int next_pipe_to_assign;int odm_slice, mpc_slice; -if (!get_plane_id (state, plane, &plane_id)) { +if (!get_plane_id (state, plane, stream->stream_id, &plane_id)) {ASSERT (false);return master_pipe; }
@@ -545,11 +552,14 @@ static void free_pipe(struct pipe_ctx *pipe)memset (pipe,0 ,sizeof (struct pipe_ctx )); } -static void free_unused_pipes_for_plane (struct dml2_context *ctx,struct dc_state *state,const struct dc_plane_state *plane,const struct dc_plane_pipe_pool *pool) +static void free_unused_pipes_for_plane (struct dml2_context *ctx,struct dc_state *state, +const struct dc_plane_state *plane,const struct dc_plane_pipe_pool *pool,unsigned int stream_id) {int i;for (i =0 ; i < ctx->config.dcn_pipe_count; i++) { -if (state->res_ctx.pipe_ctx[i].plane_state == plane && !is_pipe_used (pool, state->res_ctx.pipe_ctx[i].pipe_idx)) { +if (state->res_ctx.pipe_ctx[i].plane_state == plane && + state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id && + !is_pipe_used (pool, state->res_ctx.pipe_ctx[i].pipe_idx)) {free_pipe (&state->res_ctx.pipe_ctx[i]); } }
@@ -600,7 +610,7 @@ static void map_pipes_for_plane(struct dml2_context *ctx, struct dc_state *statestruct pipe_ctx *master_pipe =NULL ;int i; -if (!get_plane_id (state, plane, &plane_id)) { +if (!get_plane_id (state, plane, stream->stream_id, &plane_id)) {ASSERT (false);return ; }
@@ -631,7 +641,7 @@ static void map_pipes_for_plane(struct dml2_context *ctx, struct dc_state *state } } -free_unused_pipes_for_plane (ctx, state, plane, &scratch->pipe_pool); +free_unused_pipes_for_plane (ctx, state, plane, &scratch->pipe_pool, stream->stream_id); }bool dml2_map_dc_pipes (struct dml2_context *ctx,struct dc_state *state,const struct dml_display_cfg_st *disp_cfg,struct dml2_dml_to_dc_pipe_mapping *mapping,const struct dc_state *existing_state)
@@ -688,7 +698,8 @@ bool dml2_map_dc_pipes(struct dml2_context *ctx, struct dc_state *state, const sfor (plane_index =0 ; plane_index < state->stream_status[stream_index].plane_count; plane_index++) {// Planes are ordered top to bottom. -if (get_plane_id (state, state->stream_status[stream_index].plane_states[plane_index], &plane_id)) { +if (get_plane_id (state, state->stream_status[stream_index].plane_states[plane_index], + stream_id, &plane_id)) { plane_disp_cfg_index =find_disp_cfg_idx_by_plane_id (mapping, plane_id);// Setup mpc_info for this plane
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +15 -10
@@ -926,7 +926,8 @@ static unsigned int map_stream_to_dml_display_cfg(const struct dml2_context *dmlreturn location; } -static bool get_plane_id (const struct dc_state *context,const struct dc_plane_state *plane,unsigned int *plane_id) +static bool get_plane_id (const struct dc_state *context,const struct dc_plane_state *plane, +unsigned int stream_id,unsigned int *plane_id) {int i, j;
@@ -934,10 +935,12 @@ static bool get_plane_id(const struct dc_state *context, const struct dc_plane_sreturn false;for (i =0 ; i < context->stream_count; i++) { -for (j =0 ; j < context->stream_status[i].plane_count; j++) { -if (context->stream_status[i].plane_states[j] == plane) { - *plane_id = (i <<16 ) | j; -return true; +if (context->streams[i]->stream_id == stream_id) { +for (j =0 ; j < context->stream_status[i].plane_count; j++) { +if (context->stream_status[i].plane_states[j] == plane) { + *plane_id = (i <<16 ) | j; +return true; + } } } }
@@ -945,14 +948,14 @@ static bool get_plane_id(const struct dc_state *context, const struct dc_plane_sreturn false; } -static unsigned int map_plane_to_dml_display_cfg (const struct dml2_context *dml2, -const struct dc_plane_state *plane,const struct dc_state *context,const struct dml_display_cfg_st *dml_dispcfg) +static unsigned int map_plane_to_dml_display_cfg (const struct dml2_context *dml2,const struct dc_plane_state *plane, +const struct dc_state *context,const struct dml_display_cfg_st *dml_dispcfg,unsigned int stream_id) {unsigned int plane_id;int i =0 ;int location =-1 ; -if (!get_plane_id (context, plane, &plane_id)) { +if (!get_plane_id (context, plane, stream_id, &plane_id)) {ASSERT (false);return -1 ; }
@@ -1035,7 +1038,8 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, const struct d dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true; }else {for (j =0 ; j < context->stream_status[i].plane_count; j++) { - disp_cfg_plane_location =map_plane_to_dml_display_cfg (dml2, context->stream_status[i].plane_states[j], context, dml_dispcfg); + disp_cfg_plane_location =map_plane_to_dml_display_cfg (dml2, + context->stream_status[i].plane_states[j], context, dml_dispcfg, context->streams[i]->stream_id);if (disp_cfg_plane_location <0 ) disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
@@ -1059,7 +1063,8 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, const struct d dml_dispcfg->plane.BlendingAndTiming[disp_cfg_plane_location] = disp_cfg_stream_location; -if (get_plane_id (context, context->stream_status[i].plane_states[j], &dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id[disp_cfg_plane_location])) +if (get_plane_id (context, context->stream_status[i].plane_states[j], context->streams[i]->stream_id, + &dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id[disp_cfg_plane_location])) dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id_valid[disp_cfg_plane_location] = true;if (j >=1 ) {
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c +12 -7
@@ -207,7 +207,8 @@ static int find_dml_pipe_idx_by_plane_id(struct dml2_context *ctx, unsigned intreturn -1 ; } -static bool get_plane_id (const struct dc_state *state,const struct dc_plane_state *plane,unsigned int *plane_id) +static bool get_plane_id (const struct dc_state *state,const struct dc_plane_state *plane, +unsigned int stream_id,unsigned int *plane_id) {int i, j;
@@ -215,10 +216,12 @@ static bool get_plane_id(const struct dc_state *state, const struct dc_plane_stareturn false;for (i =0 ; i < state->stream_count; i++) { -for (j =0 ; j < state->stream_status[i].plane_count; j++) { -if (state->stream_status[i].plane_states[j] == plane) { - *plane_id = (i <<16 ) | j; -return true; +if (state->streams[i]->stream_id == stream_id) { +for (j =0 ; j < state->stream_status[i].plane_count; j++) { +if (state->stream_status[i].plane_states[j] == plane) { + *plane_id = (i <<16 ) | j; +return true; + } } } }
@@ -299,7 +302,8 @@ void dml2_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *cont* there is a need to know which DML pipe index maps to which DC pipe. The code below * finds a dml_pipe_index from the plane id if a plane is valid. If a plane is not valid then * it finds a dml_pipe_index from the stream id. */ -if (get_plane_id (context, context->res_ctx.pipe_ctx[dc_pipe_ctx_index].plane_state, &plane_id)) { +if (get_plane_id (context, context->res_ctx.pipe_ctx[dc_pipe_ctx_index].plane_state, + context->res_ctx.pipe_ctx[dc_pipe_ctx_index].stream->stream_id, &plane_id)) { dml_pipe_idx =find_dml_pipe_idx_by_plane_id (in_ctx, plane_id); }else { dml_pipe_idx =dml2_helper_find_dml_pipe_idx_by_stream_id (in_ctx, context->res_ctx.pipe_ctx[dc_pipe_ctx_index].stream->stream_id);
@@ -435,7 +439,8 @@ bool dml2_verify_det_buffer_configuration(struct dml2_context *in_ctx, struct dcfor (i =0 ; i <MAX_PIPES ; i++) {if (!display_state->res_ctx.pipe_ctx[i].stream)continue ; -if (get_plane_id (display_state, display_state->res_ctx.pipe_ctx[i].plane_state, &plane_id)) +if (get_plane_id (display_state, display_state->res_ctx.pipe_ctx[i].plane_state, + display_state->res_ctx.pipe_ctx[i].stream->stream_id, &plane_id)) dml_pipe_idx =find_dml_pipe_idx_by_plane_id (in_ctx, plane_id);else dml_pipe_idx =dml2_helper_find_dml_pipe_idx_by_stream_id (in_ctx, display_state->res_ctx.pipe_ctx[i].stream->stream_id);
Signature · 1 line
2.40.1
PATCH v3 9/16 drm/amd/display: Use fixed DET Buffer Size
In reply to Rodrigo SiqueiraFrom: Sung Joon Kim <[email protected]>
[why]
Regression from DML1.0 where we use differen DET buffer sizes for each pipe. From the spec, we need to use DET buffer size of 384 kb for each pipe
[how]
Ensure to use 384 kb DET buffer sizes for each available pipe.
--- .../drm/amd/display/dc/dcn35/dcn35_resource.c | 3 ++- .../gpu/drm/amd/display/dc/dml2/dml2_utils.c | 22 +++++++++++-------- .../drm/amd/display/dc/dml2/dml2_wrapper.h | 1 + 3 files changed, 16 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_resource.c +2 -1
@@ -2078,7 +2078,8 @@ static bool dcn35_resource_construct( dc->dml2_options.callbacks.build_scaling_params = &resource_build_scaling_params; dc->dml2_options.callbacks.can_support_mclk_switch_using_fw_based_vblank_stretch = &dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch; dc->dml2_options.callbacks.acquire_secondary_pipe_for_mpc_odm = &dc_resource_acquire_secondary_pipe_for_mpc_odm_legacy; - dc->dml2_options.max_segments_per_hubp =18 ; + dc->dml2_options.max_segments_per_hubp =24 ; + dc->dml2_options.det_segment_size =DCN3_2_DET_SEG_SIZE ;/*todo*/ if (dc->config.sdpif_request_limit_words_per_umc ==0 )
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c +13 -9
@@ -414,17 +414,21 @@ void dml2_apply_det_buffer_allocation_policy(struct dml2_context *in_ctx, structfor (plane_index =0 ; plane_index < dml_dispcfg->num_surfaces; plane_index++) { - dml_dispcfg->plane.DETSizeOverride[plane_index] = ((max_det_size / num_of_streams) / num_of_planes_per_stream[stream_index] / in_ctx->det_helper_scratch.dpps_per_surface[plane_index]); +if (in_ctx->config.override_det_buffer_size_kbytes) + dml_dispcfg->plane.DETSizeOverride[plane_index] = max_det_size / in_ctx->config.dcn_pipe_count; +else { + dml_dispcfg->plane.DETSizeOverride[plane_index] = ((max_det_size / num_of_streams) / num_of_planes_per_stream[stream_index] / in_ctx->det_helper_scratch.dpps_per_surface[plane_index]); + +/* If the override size is not divisible by det_segment_size then round off to nearest number divisible by det_segment_size as +* this is a requirement. +*/ +if (dml_dispcfg->plane.DETSizeOverride[plane_index] % in_ctx->config.det_segment_size !=0 ) { + dml_dispcfg->plane.DETSizeOverride[plane_index] = dml_dispcfg->plane.DETSizeOverride[plane_index] & ~0x3F ; + } -/* If the override size is not divisible by det_segment_size then round off to nearest number divisible by det_segment_size as -* this is a requirement. -*/ -if (dml_dispcfg->plane.DETSizeOverride[plane_index] % in_ctx->config.det_segment_size !=0 ) { - dml_dispcfg->plane.DETSizeOverride[plane_index] = dml_dispcfg->plane.DETSizeOverride[plane_index] & ~0x3F ; +if (plane_index +1 < dml_dispcfg->num_surfaces && dml_dispcfg->plane.BlendingAndTiming[plane_index] != dml_dispcfg->plane.BlendingAndTiming[plane_index +1 ]) + stream_index++; } - -if (plane_index +1 < dml_dispcfg->num_surfaces && dml_dispcfg->plane.BlendingAndTiming[plane_index] != dml_dispcfg->plane.BlendingAndTiming[plane_index +1 ]) - stream_index++; } }
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.h +1 -0
@@ -137,6 +137,7 @@ struct dml2_configuration_options {bool skip_hw_state_mapping;bool optimize_odm_4to1;bool minimize_dispclk_using_odm; +bool override_det_buffer_size_kbytes;struct dml2_dc_callbacks callbacks;struct {bool force_disable_subvp;
Signature · 1 line
2.40.1
PATCH v3 10/16 drm/amd/display: Split pipe for stereo timings
In reply to Rodrigo SiqueiraFrom: Taimur Hassan <[email protected]>
[Why & How]
DML2 did not carry over DML1 logic that splits pipe for stero timings. Pipe splitting is needed in this case to pass stereo tests.
--- .../drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +11 -0
@@ -708,6 +708,17 @@ bool dml2_map_dc_pipes(struct dml2_context *ctx, struct dc_state *state, const s// If ODM combine is not inuse, then the number of pipes // per plane is determined by MPC combine factor scratch.mpc_info.mpc_factor = DPPPerSurface[plane_disp_cfg_index]; + +//For stereo timings, we need to pipe split +if ((state->streams[stream_index]->view_format == +VIEW_3D_FORMAT_SIDE_BY_SIDE || + state->streams[stream_index]->view_format == +VIEW_3D_FORMAT_TOP_AND_BOTTOM ) && + (state->streams[stream_index]->timing.timing_3d_format == +TIMING_3D_FORMAT_TOP_AND_BOTTOM || + state->streams[stream_index]->timing.timing_3d_format == +TIMING_3D_FORMAT_SIDE_BY_SIDE )) + scratch.mpc_info.mpc_factor =2 ; }else {// If ODM combine is enabled, then we use at most 1 pipe per // odm slice per plane, i.e. MPC combine is never used
Signature · 1 line
2.40.1
PATCH v3 11/16 drm/amd/display: Move stereo timing check to helper
In reply to Rodrigo SiqueiraFrom: Taimur Hassan <[email protected]>
Rework dml2_map_dc_pipes to keep the logic clean.
--- .../amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 9 +-------- .../gpu/drm/amd/display/dc/dml2/dml2_utils.c | 17 +++++++++++++++++ .../gpu/drm/amd/display/dc/dml2/dml2_utils.h | 1 + 3 files changed, 19 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +1 -8
@@ -710,14 +710,7 @@ bool dml2_map_dc_pipes(struct dml2_context *ctx, struct dc_state *state, const s scratch.mpc_info.mpc_factor = DPPPerSurface[plane_disp_cfg_index];//For stereo timings, we need to pipe split -if ((state->streams[stream_index]->view_format == -VIEW_3D_FORMAT_SIDE_BY_SIDE || - state->streams[stream_index]->view_format == -VIEW_3D_FORMAT_TOP_AND_BOTTOM ) && - (state->streams[stream_index]->timing.timing_3d_format == -TIMING_3D_FORMAT_TOP_AND_BOTTOM || - state->streams[stream_index]->timing.timing_3d_format == -TIMING_3D_FORMAT_SIDE_BY_SIDE )) +if (dml2_is_stereo_timing (state->streams[stream_index])) scratch.mpc_info.mpc_factor =2 ; }else {// If ODM combine is enabled, then we use at most 1 pipe per
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c +17 -0
@@ -461,3 +461,20 @@ bool dml2_verify_det_buffer_configuration(struct dml2_context *in_ctx, struct dcreturn need_recalculation; } + +bool dml2_is_stereo_timing (struct dc_stream_state *stream) +{ +bool is_stereo = false; + +if ((stream->view_format == +VIEW_3D_FORMAT_SIDE_BY_SIDE || + stream->view_format == +VIEW_3D_FORMAT_TOP_AND_BOTTOM ) && + (stream->timing.timing_3d_format == +TIMING_3D_FORMAT_TOP_AND_BOTTOM || + stream->timing.timing_3d_format == +TIMING_3D_FORMAT_SIDE_BY_SIDE )) + is_stereo = true; + +return is_stereo; +}
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h +1 -0
@@ -42,6 +42,7 @@ void dml2_copy_clocks_to_dc_state(struct dml2_dcn_clocks *out_clks, struct dc_stvoid dml2_extract_watermark_set (struct dcn_watermarks *watermark,struct display_mode_lib_st *dml_core_ctx);int dml2_helper_find_dml_pipe_idx_by_stream_id (struct dml2_context *ctx,unsigned int stream_id);bool is_dtbclk_required (const struct dc *dc,struct dc_state *context); +bool dml2_is_stereo_timing (struct dc_stream_state *stream);/* * dml2_dc_construct_pipes - This function will determine if we need additional pipes based
Signature · 1 line
2.40.1
PATCH v3 12/16 drm/amd/display: Fix Chroma Surface height/width initialization
In reply to Rodrigo SiqueiraFrom: Sung Joon Kim <[email protected]>
[why]
Surface height/width for Chroma has another variable that it should be intialized to, chroma_size. Fixing this will help pass DML2.0 validation for YCbCr420 tests, DCHB006.109,129, DCHB014.011,012.
[how]
Assign SurfaceHeight/WidthC to chroma_size.height/width
--- drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +2 -2
@@ -721,8 +721,8 @@ static void populate_dml_surface_cfg_from_plane_state(enum dml_project_id dml2_p out->PitchY[location] = in->plane_size.surface_pitch; out->SurfaceHeightY[location] = in->plane_size.surface_size.height; out->SurfaceWidthY[location] = in->plane_size.surface_size.width; - out->SurfaceHeightC[location] = in->plane_size.surface_size.height; - out->SurfaceWidthC[location] = in->plane_size.surface_size.width; + out->SurfaceHeightC[location] = in->plane_size.chroma_size.height; + out->SurfaceWidthC[location] = in->plane_size.chroma_size.width; out->PitchC[location] = in->plane_size.chroma_pitch; out->DCCEnable[location] = in->dcc.enable; out->DCCMetaPitchY[location] = in->dcc.meta_pitch;
Signature · 1 line
2.40.1
PATCH v3 13/16 drm/amd/display: correct dml2 input and dlg_refclk
In reply to Rodrigo SiqueiraFrom: Charlene Liu <[email protected]>
dc->dml2_options.use_native_pstate_optimization flag will make driver use dcn32 legacy_svp_drr related tuning. Set this to false fixed the stutter underflow issue also based on HW suggest disable ODM by default and let DML choose it.
--- drivers/gpu/drm/amd/display/dc/dcn35/dcn35_resource.c | 7 +++---- drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 8 ++++++-- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_resource.c +3 -4
@@ -733,8 +733,7 @@ static const struct dc_debug_options debug_defaults_drv = { .support_eDP1_5 = true, .enable_hpo_pg_support = false, .enable_legacy_fast_update = true, - .disable_stutter = true, - .enable_single_display_2to1_odm_policy = true, + .enable_single_display_2to1_odm_policy = false, .disable_idle_power_optimizations = true, .dmcub_emulation = false, .disable_boot_optimizations = false,
@@ -1835,6 +1834,7 @@ static bool dcn35_resource_construct(/* Use pipe context based otg sync logic */ dc->config.use_pipe_ctx_sync_logic = true; + dc->config.use_default_clock_table = true;/* read VBIOS LTTPR caps */ {if (ctx->dc_bios->funcs->get_lttpr_caps) {
@@ -2065,11 +2065,10 @@ static bool dcn35_resource_construct( dc->cap_funcs = cap_funcs; - dc->dcn_ip->max_num_dpp = pool->base.pipe_count; dc->dml2_options.dcn_pipe_count = pool->base.pipe_count; - dc->dml2_options.use_native_pstate_optimization = false; + dc->dml2_options.use_native_pstate_optimization = true; dc->dml2_options.use_native_soc_bb_construction = true;if (dc->config.EnableMinDispClkODM) dc->dml2_options.minimize_dispclk_using_odm = true;
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +6 -2
@@ -67,8 +67,12 @@ static void map_hw_resources(struct dml2_context *dml2, in_out_display_cfg->hw.DPPPerSurface[i] = mode_support_info->DPPPerSurface[i]; in_out_display_cfg->hw.DSCEnabled[i] = mode_support_info->DSCEnabled[i]; in_out_display_cfg->hw.NumberOfDSCSlices[i] = mode_support_info->NumberOfDSCSlices[i]; - in_out_display_cfg->hw.DLGRefClkFreqMHz =50 ; - + in_out_display_cfg->hw.DLGRefClkFreqMHz =24 ; +if (dml2->v20.dml_core_ctx.project != dml_project_dcn35 && + dml2->v20.dml_core_ctx.project != dml_project_dcn351) { +/*dGPU default as 50Mhz*/ + in_out_display_cfg->hw.DLGRefClkFreqMHz =50 ; + }for (j =0 ; j < mode_support_info->DPPPerSurface[i]; j++) { dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id[num_pipes] = dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id[i]; dml2->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id_valid[num_pipes] = true;
Signature · 1 line
2.40.1
PATCH v3 14/16 drm/amd/display: Modify Pipe Selection for Policy for ODM
In reply to Rodrigo SiqueiraFrom: Saaem Rizvi <[email protected]>
[Why]
There are certain cases during a transition to ODM that might cause corruption on the display. This occurs when we choose certain pipes in a particular state.
[How]
We now will store the pipe indexes of the any pipes that might be problematic to switch to during an ODM transition, and only use them as a last resort.
--- .../display/dc/dml2/dml2_dc_resource_mgmt.c | 140 ++++++++++++++++-- 1 file changed, 126 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +126 -14
@@ -213,6 +213,82 @@ static bool is_pipe_free(const struct pipe_ctx *pipe)return false; } +static unsigned int find_preferred_pipe_candidates (const struct dc_state *existing_state, +const int pipe_count, +const unsigned int stream_id, +unsigned int *preferred_pipe_candidates) +{ +unsigned int num_preferred_candidates =0 ; +int i; + +/* There is only one case which we consider for adding a pipe to the preferred +* pipe candidate array: +* +* 1. If the existing stream id of the pipe is equivalent to the stream id +* of the stream we are trying to achieve MPC/ODM combine for. This allows +* us to minimize the changes in pipe topology during the transition. +* +* However this condition comes with a caveat. We need to ignore pipes that will +* require a change in OPP but still have the same stream id. For example during +* an MPC to ODM transiton. +*/ +if (existing_state) { +for (i =0 ; i < pipe_count; i++) { +if (existing_state->res_ctx.pipe_ctx[i].stream && existing_state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id) { +if (existing_state->res_ctx.pipe_ctx[i].plane_res.hubp && + existing_state->res_ctx.pipe_ctx[i].plane_res.hubp->opp_id != i) +continue ; + + preferred_pipe_candidates[num_preferred_candidates++] = i; + } + } + } + +return num_preferred_candidates; +} + +static unsigned int find_last_resort_pipe_candidates (const struct dc_state *existing_state, +const int pipe_count, +const unsigned int stream_id, +unsigned int *last_resort_pipe_candidates) +{ +unsigned int num_last_resort_candidates =0 ; +int i; + +/* There are two cases where we would like to add a given pipe into the last +* candidate array: +* +* 1. If the pipe requires a change in OPP, for example during an MPC +* to ODM transiton. +* +* 2. If the pipe already has an enabled OTG. +*/ +if (existing_state) { +for (i =0 ; i < pipe_count; i++) { +if ((existing_state->res_ctx.pipe_ctx[i].plane_res.hubp && + existing_state->res_ctx.pipe_ctx[i].plane_res.hubp->opp_id != i) || + existing_state->res_ctx.pipe_ctx[i].stream_res.tg) + last_resort_pipe_candidates[num_last_resort_candidates++] = i; + } + } + +return num_last_resort_candidates; +} + +static bool is_pipe_in_candidate_array (const unsigned int pipe_idx, +const unsigned int *candidate_array, +const unsigned int candidate_array_size) +{ +int i; + +for (i =0 ; i < candidate_array_size; i++) { +if (candidate_array[i] == pipe_idx) +return true; + } + +return false; +} + static bool find_more_pipes_for_stream(struct dml2_context *ctx, struct dc_state *state, // The state we want to find a free mapping in unsigned int stream_id, // The stream we want this pipe to drive
@@ -222,16 +298,18 @@ static bool find_more_pipes_for_stream(struct dml2_context *ctx, const struct dc_state *existing_state) // The state (optional) that we want to minimize remapping relative to {struct pipe_ctx *pipe =NULL ; -unsigned int preferred_pipe_candidates[MAX_PIPES ]; +unsigned int preferred_pipe_candidates[MAX_PIPES ] = {0 }; +unsigned int last_resort_pipe_candidates[MAX_PIPES ] = {0 };unsigned int num_preferred_candidates =0 ; +unsigned int num_last_resort_candidates =0 ;int i;if (existing_state) { -// To minimize prioritize candidates from existing stream -for (i =0 ; i < ctx->config.dcn_pipe_count; i++) { -if (existing_state->res_ctx.pipe_ctx[i].stream && existing_state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id) - preferred_pipe_candidates[num_preferred_candidates++] = existing_state->res_ctx.pipe_ctx[i].pipe_idx; - } + num_preferred_candidates = +find_preferred_pipe_candidates (existing_state, ctx->config.dcn_pipe_count, stream_id, preferred_pipe_candidates); + + num_last_resort_candidates = +find_last_resort_pipe_candidates (existing_state, ctx->config.dcn_pipe_count, stream_id, last_resort_pipe_candidates); }// First see if any of the preferred are unmapped, and choose those instead
@@ -247,6 +325,11 @@ static bool find_more_pipes_for_stream(struct dml2_context *ctx,// We like to pair pipes starting from the higher order indicies for combining for (i = ctx->config.dcn_pipe_count -1 ; pipes_needed >0 && i >=0 ; i--) { +// Ignore any pipes that are the preferred or last resort candidate +if (is_pipe_in_candidate_array (i, preferred_pipe_candidates, num_preferred_candidates) || +is_pipe_in_candidate_array (i, last_resort_pipe_candidates, num_last_resort_candidates)) +continue ; + pipe = &state->res_ctx.pipe_ctx[i];if (!is_plane_using_pipe (pipe)) { pipes_needed--;
@@ -256,6 +339,17 @@ static bool find_more_pipes_for_stream(struct dml2_context *ctx, } } +// Only use the last resort pipe candidates as a last resort +for (i =0 ; pipes_needed >0 && i < num_last_resort_candidates; i++) { + pipe = &state->res_ctx.pipe_ctx[last_resort_pipe_candidates[i]]; +if (!is_plane_using_pipe (pipe)) { + pipes_needed--; +// TODO: This doens't make sense really, pipe_idx should always be valid + pipe->pipe_idx = last_resort_pipe_candidates[i]; + assigned_pipes[(*assigned_pipe_count)++] = pipe->pipe_idx; + } + } +ASSERT (pipes_needed <=0 );// Validation should prevent us from building a pipe context that exceeds the number of HW resoruces available return pipes_needed <=0 ;
@@ -270,16 +364,18 @@ static bool find_more_free_pipes(struct dml2_context *ctx, const struct dc_state *existing_state) // The state (optional) that we want to minimize remapping relative to {struct pipe_ctx *pipe =NULL ; -unsigned int preferred_pipe_candidates[MAX_PIPES ]; +unsigned int preferred_pipe_candidates[MAX_PIPES ] = {0 }; +unsigned int last_resort_pipe_candidates[MAX_PIPES ] = {0 };unsigned int num_preferred_candidates =0 ; +unsigned int num_last_resort_candidates =0 ;int i;if (existing_state) { -// To minimize prioritize candidates from existing stream -for (i =0 ; i < ctx->config.dcn_pipe_count; i++) { -if (existing_state->res_ctx.pipe_ctx[i].stream && existing_state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id) - preferred_pipe_candidates[num_preferred_candidates++] = existing_state->res_ctx.pipe_ctx[i].pipe_idx; - } + num_preferred_candidates = +find_preferred_pipe_candidates (existing_state, ctx->config.dcn_pipe_count, stream_id, preferred_pipe_candidates); + + num_last_resort_candidates = +find_last_resort_pipe_candidates (existing_state, ctx->config.dcn_pipe_count, stream_id, last_resort_pipe_candidates); }// First see if any of the preferred are unmapped, and choose those instead
@@ -295,6 +391,11 @@ static bool find_more_free_pipes(struct dml2_context *ctx,// We like to pair pipes starting from the higher order indicies for combining for (i = ctx->config.dcn_pipe_count -1 ; pipes_needed >0 && i >=0 ; i--) { +// Ignore any pipes that are the preferred or last resort candidate +if (is_pipe_in_candidate_array (i, preferred_pipe_candidates, num_preferred_candidates) || +is_pipe_in_candidate_array (i, last_resort_pipe_candidates, num_last_resort_candidates)) +continue ; + pipe = &state->res_ctx.pipe_ctx[i];if (is_pipe_free (pipe)) { pipes_needed--;
@@ -304,6 +405,17 @@ static bool find_more_free_pipes(struct dml2_context *ctx, } } +// Only use the last resort pipe candidates as a last resort +for (i =0 ; pipes_needed >0 && i < num_last_resort_candidates; i++) { + pipe = &state->res_ctx.pipe_ctx[last_resort_pipe_candidates[i]]; +if (is_pipe_free (pipe)) { + pipes_needed--; +// TODO: This doens't make sense really, pipe_idx should always be valid + pipe->pipe_idx = last_resort_pipe_candidates[i]; + assigned_pipes[(*assigned_pipe_count)++] = pipe->pipe_idx; + } + } +ASSERT (pipes_needed ==0 );// Validation should prevent us from building a pipe context that exceeds the number of HW resoruces available return pipes_needed ==0 ;
@@ -465,7 +577,7 @@ static struct pipe_ctx *assign_pipes_to_stream(struct dml2_context *ctx, structstruct pipe_ctx *master_pipe;unsigned int pipes_needed;unsigned int pipes_assigned; -unsigned int pipes[MAX_PIPES ]; +unsigned int pipes[MAX_PIPES ] = {0 };unsigned int next_pipe_to_assign;int odm_slice;
@@ -502,7 +614,7 @@ static struct pipe_ctx *assign_pipes_to_plane(struct dml2_context *ctx, struct dunsigned int plane_id;unsigned int pipes_needed;unsigned int pipes_assigned; -unsigned int pipes[MAX_PIPES ]; +unsigned int pipes[MAX_PIPES ] = {0 };unsigned int next_pipe_to_assign;int odm_slice, mpc_slice;
Signature · 1 line
2.40.1
PATCH v3 15/16 drm/amd/display: Port replay vblank logic to DML2
In reply to Rodrigo SiqueiraFrom: Daniel Miess <[email protected]>
Update DML2 with replay vblank logic found in DML1.
--- .../amd/display/dc/dml2/display_mode_core.c | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +22 -3
@@ -6153,6 +6153,13 @@ static void CalculateImmediateFlipBandwithSupport(#endif } +static dml_uint_t MicroSecToVertLines (dml_uint_t num_us,dml_uint_t h_total,dml_float_t pixel_clock) +{ +dml_uint_t lines_time_in_ns =1000.0 * (h_total *1000.0 ) / (pixel_clock *1000.0 ); + +return dml_ceil (1000.0 * num_us / lines_time_in_ns,1.0 ); +} +/// @brief Calculate the maximum vstartup for mode support and mode programming consideration /// Bounded by min of actual vblank and input vblank_nom, dont want vstartup/ready to start too early if actual vbllank is huge static dml_uint_t CalculateMaxVStartup(
@@ -6164,12 +6171,24 @@ static dml_uint_t CalculateMaxVStartup( {dml_uint_t vblank_size =0 ;dml_uint_t max_vstartup_lines =0 ; +const dml_uint_t max_allowed_vblank_nom =1023 ;dml_float_t line_time_us = (dml_float_t ) timing->HTotal[plane_idx] / timing->PixelClock[plane_idx];dml_uint_t vblank_actual = timing->VTotal[plane_idx] - timing->VActive[plane_idx]; -dml_uint_t vblank_nom_default_in_line = (dml_uint_t )dml_floor ((dml_float_t ) vblank_nom_default_us/line_time_us,1.0 ); -dml_uint_t vblank_nom_input = (dml_uint_t )dml_min (timing->VBlankNom[plane_idx], vblank_nom_default_in_line); -dml_uint_t vblank_avail = (vblank_nom_input ==0 ) ? vblank_nom_default_in_line : vblank_nom_input; + +dml_uint_t vblank_nom_default_in_line =MicroSecToVertLines (vblank_nom_default_us, timing->HTotal[plane_idx], + timing->PixelClock[plane_idx]); +dml_uint_t vblank_nom_input = (dml_uint_t )dml_min (vblank_actual, vblank_nom_default_in_line); + +// vblank_nom should not be smaller than (VSync (VTotal - VActive - VFrontPorch) + 2) +// + 2 is because +// 1 -> VStartup_start should be 1 line before VSync +// 1 -> always reserve 1 line between start of VBlank to VStartup signal +dml_uint_t vblank_nom_vsync_capped =dml_max (vblank_nom_input, + timing->VTotal[plane_idx] - timing->VActive[plane_idx] - timing->VFrontPorch[plane_idx] +2 ); +dml_uint_t vblank_nom_max_allowed_capped =dml_min (vblank_nom_vsync_capped, max_allowed_vblank_nom); +dml_uint_t vblank_avail = (vblank_nom_max_allowed_capped ==0 ) ? + vblank_nom_default_in_line : vblank_nom_max_allowed_capped; vblank_size = (dml_uint_t )dml_min (vblank_actual, vblank_avail);
Signature · 1 line
2.40.1
PATCH v3 16/16 drm/amd/display: add check in validate_only in dml2
In reply to Rodrigo SiqueiraFrom: Gabe Teeger <[email protected]>
[what]does_configuration_meet_sw_policies check was not done in the validate_only portion of dml2, so some unsupported modes were passing bw validation, only to fail the same check later in validate_and_build. now we add the check to validate_only.
Also add line in dcn35_resource to ensure that value set for enable_windowed_mpo_odm gets passed to dml.
[why]
Immediate black screen during video playback at 4k144hz. The debugger showed that we were failing validation in dml on every updateplanes().
--- drivers/gpu/drm/amd/display/dc/dcn35/dcn35_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_resource.c +1 -0
@@ -2072,6 +2072,7 @@ static bool dcn35_resource_construct( dc->dml2_options.use_native_soc_bb_construction = true;if (dc->config.EnableMinDispClkODM) dc->dml2_options.minimize_dispclk_using_odm = true; + dc->dml2_options.enable_windowed_mpo_odm = dc->config.enable_windowed_mpo_odm; dc->dml2_options.callbacks.dc = dc; dc->dml2_options.callbacks.build_scaling_params = &resource_build_scaling_params;
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +3 -0
@@ -659,6 +659,9 @@ static bool dml2_validate_only(const struct dc_state *context) &dml2->v20.scratch.cur_display_config, &dml2->v20.scratch.mode_support_info); +if (result) + result =does_configuration_meet_sw_policies (dml2, &dml2->v20.scratch.cur_display_config, &dml2->v20.scratch.mode_support_info); +return (result ==1 ) ? true : false; }
Signature · 1 line
2.40.1