]> www.infradead.org Git - users/hch/configfs.git/commitdiff
drm/amd/display: fix an incorrect ODM policy assigned for subvp
authorWenjing Liu <wenjing.liu@amd.com>
Fri, 22 Mar 2024 19:29:56 +0000 (15:29 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 10 Apr 2024 02:15:10 +0000 (22:15 -0400)
[why]
When Subvp pipe's index is smaller than main pipe's index, the main
pipe's ODM policy is not yet assigned. If we assign subvp pipe's ODM
policy based on main pipe, we will assign uninitialized ODM policy.

[how]
Instead of copying main pipe's policy we copy the main pipe ODM policy
logic. So it doesn't matter whether if main pipe's ODM policy is set,
phantom pipe will always have the same policy because it running the
same calcualtion to derive ODM policy.

Cc: stable@vger.kernel.org
Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c

index e2bff9b9d55ad7f314897892e42c178bcadaffae..9aa39bd25be9df0721f2b3ed2dc63ee7d77daf59 100644 (file)
@@ -1824,6 +1824,7 @@ int dcn32_populate_dml_pipes_from_context(
        int num_subvp_main = 0;
        int num_subvp_phantom = 0;
        int num_subvp_none = 0;
+       int odm_slice_count;
 
        dcn20_populate_dml_pipes_from_context(dc, context, pipes, fast_validate);
 
@@ -1852,7 +1853,7 @@ int dcn32_populate_dml_pipes_from_context(
                        mall_type = dc_state_get_pipe_subvp_type(context, pipe);
                        if (mall_type == SUBVP_MAIN) {
                                if (resource_is_pipe_type(pipe, OTG_MASTER))
-                                       subvp_main_pipe_index = pipe_cnt;
+                                       subvp_main_pipe_index = i;
                        }
                        pipe_cnt++;
                }
@@ -1878,22 +1879,23 @@ int dcn32_populate_dml_pipes_from_context(
                        mall_type = dc_state_get_pipe_subvp_type(context, pipe);
                        if (single_display_subvp && (mall_type == SUBVP_PHANTOM)) {
                                if (subvp_main_pipe_index < 0) {
+                                       odm_slice_count = -1;
                                        ASSERT(0);
                                } else {
-                                       pipes[pipe_cnt].pipe.dest.odm_combine_policy =
-                                               pipes[subvp_main_pipe_index].pipe.dest.odm_combine_policy;
+                                       odm_slice_count = resource_get_odm_slice_count(&res_ctx->pipe_ctx[subvp_main_pipe_index]);
                                }
                        } else {
-                               switch (resource_get_odm_slice_count(pipe)) {
-                               case 2:
-                                       pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_2to1;
-                                       break;
-                               case 4:
-                                       pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_4to1;
-                                       break;
-                               default:
-                                       pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_dal;
-                               }
+                               odm_slice_count = resource_get_odm_slice_count(pipe);
+                       }
+                       switch (odm_slice_count) {
+                       case 2:
+                               pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_2to1;
+                               break;
+                       case 4:
+                               pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_4to1;
+                               break;
+                       default:
+                               pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_dal;
                        }
                } else {
                        pipes[pipe_cnt].pipe.dest.odm_combine_policy = dm_odm_combine_policy_dal;