From: Yihan Zhu <[email protected]>

[WHY & HOW]
Fix RMCM programming sequence errors and mapping issues to pass the RMCM
test.

Cc: Mario Limonciello <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: [email protected]
Reviewed-by: Dmytro Laktyushkin <[email protected]>
Signed-off-by: Yihan Zhu <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
---
 .../dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c       | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
 
b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
index 0addef1f844e..5dceab1208f2 100644
--- 
a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
+++ 
b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
@@ -4685,7 +4685,10 @@ static void calculate_tdlut_setting(
        //the tdlut is fetched during the 2 row times of prefetch.
        if (p->setup_for_tdlut) {
                *p->tdlut_groups_per_2row_ub = (unsigned 
int)math_ceil2((double) *p->tdlut_bytes_per_frame / *p->tdlut_bytes_per_group, 
1);
-               *p->tdlut_opt_time = (*p->tdlut_bytes_per_frame - 
p->cursor_buffer_size * 1024) / tdlut_drain_rate;
+               if (*p->tdlut_bytes_per_frame > p->cursor_buffer_size * 1024)
+                       *p->tdlut_opt_time = (*p->tdlut_bytes_per_frame - 
p->cursor_buffer_size * 1024) / tdlut_drain_rate;
+               else
+                       *p->tdlut_opt_time = 0;
                *p->tdlut_drain_time = p->cursor_buffer_size * 1024 / 
tdlut_drain_rate;
                *p->tdlut_bytes_to_deliver = (unsigned int) 
(p->cursor_buffer_size * 1024.0);
        }
-- 
2.43.0

Reply via email to