From fd81d335f067cd8055710d08798c36557b5a6b91 Mon Sep 17 00:00:00 2001 From: Ovidiu Bunea Date: Thu, 3 Sep 2026 16:40:57 -0400 Subject: [PATCH] drm/amd/display: Add condition to skip MALL calculations if there is no MALL [Why & How] DCN42 has 0 bytes allocated for MALL, but this results in a 0 <= 0 comparison in CalculateMALLUseForStaticScreen(), which blindly returns true. This causes DML to calculate with is_using_mall_for_ss[n] = true. Example: 0 + 0 <= 0 -> true | v is_using_mall_for_ss[1] = true | v use_one_row_for_frame[1] = true PTE_BUFFER_MODE[1] = true | v dpte_row_height : 128 -> 808 dpte_row_width_ub : 196,608 -> 1,204,224 | +--> DST_Y_PER_PTE_ROW_NOM_L = 808 | +--> N_groups = ceil(1,204,224 / 65,536 / 2) = 10 | v REFCYC_PER_PTE_GROUP_NOM_L = 8416 (0x20E0) Currently, DML does not plumb out the programming for PTE_BUFFER_MODE and FORCE_ONE_ROW_FOR_FRAME, but even adding that programming does not enable the mode to work with these values. The simplest fix is to just block any opportunistic MALL calculations. Reviewed-by: Dillon Varone Signed-off-by: Ovidiu Bunea Signed-off-by: Chenyu Chen Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher --- .../dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c index 47d63dd69a90..64afb67054d5 100644 --- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c @@ -2001,6 +2001,10 @@ static void CalculateMALLUseForStaticScreen( #endif } + /* If no MALL is allocated for DCN, there is no need to calculate usage for static screen. */ + if (MALLAllocatedForDCN == 0) + return; + SurfaceToAddToMALL = 0; CanAddAnotherSurfaceToMALL = true; while (CanAddAnotherSurfaceToMALL) {