From: Ovidiu Bunea <[email protected]>

[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 <[email protected]>
Signed-off-by: Ovidiu Bunea <[email protected]>
Signed-off-by: Chenyu Chen <[email protected]>
---
 .../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) {
-- 
2.43.0

Reply via email to