drm/amd/display: Pass tg and hubp inst instead of pipe index for SubVP
authorAlvin Lee <Alvin.Lee2@amd.com>
Fri, 24 Feb 2023 15:39:17 +0000 (10:39 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Mar 2023 19:22:41 +0000 (14:22 -0500)
[Description]
- For pipe harvesting cases, the pipe index does not necessarily
  match up with the OTG instance, so pass index by OTG Instance instead
- For pipe split cases pass HUBP instance, since the split index is
  only used for HUBP programming
- Also check for OPP ID when accessing opp for pipe harvesting cases

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c

index 9f085af00f15f09b352d589f20c239448f8a9de2..05923593ec66ce3f51853b79d33430cb377ae7f9 100644 (file)
@@ -1079,6 +1079,7 @@ static void phantom_pipe_blank(
        struct output_pixel_processor *opp = NULL;
        uint32_t num_opps, opp_id_src0, opp_id_src1;
        uint32_t otg_active_width, otg_active_height;
+       uint32_t i;
 
        /* program opp dpg blank color */
        color_space = COLOR_SPACE_SRGB;
@@ -1090,17 +1091,24 @@ static void phantom_pipe_blank(
        /* get the OPTC source */
        tg->funcs->get_optc_source(tg, &num_opps, &opp_id_src0, &opp_id_src1);
        ASSERT(opp_id_src0 < dc->res_pool->res_cap->num_opp);
-       opp = dc->res_pool->opps[opp_id_src0];
-
-       opp->funcs->opp_set_disp_pattern_generator(
-                       opp,
-                       CONTROLLER_DP_TEST_PATTERN_SOLID_COLOR,
-                       CONTROLLER_DP_COLOR_SPACE_UDEFINED,
-                       COLOR_DEPTH_UNDEFINED,
-                       &black_color,
-                       otg_active_width,
-                       otg_active_height,
-                       0);
+
+       for (i = 0; i < dc->res_pool->res_cap->num_opp; i++) {
+               if (dc->res_pool->opps[i] != NULL && dc->res_pool->opps[i]->inst == opp_id_src0) {
+                       opp = dc->res_pool->opps[i];
+                       break;
+               }
+       }
+
+       if (opp && opp->funcs->opp_set_disp_pattern_generator)
+               opp->funcs->opp_set_disp_pattern_generator(
+                               opp,
+                               CONTROLLER_DP_TEST_PATTERN_SOLID_COLOR,
+                               CONTROLLER_DP_COLOR_SPACE_UDEFINED,
+                               COLOR_DEPTH_UNDEFINED,
+                               &black_color,
+                               otg_active_width,
+                               otg_active_height,
+                               0);
 
        if (tg->funcs->is_tg_enabled(tg))
                hws->funcs.wait_for_blank_complete(opp);
index 027f6ebe0496b0a8b2d15c94482c808680833544..b5c6501c28fcc5a027ade40c6e300e7ee5bb2a87 100644 (file)
@@ -637,7 +637,7 @@ static void populate_subvp_cmd_pipe_info(struct dc *dc,
        pipe_data->pipe_config.subvp_data.main_vblank_end =
                        main_timing->v_total - main_timing->v_front_porch - main_timing->v_addressable;
        pipe_data->pipe_config.subvp_data.mall_region_lines = phantom_timing->v_addressable;
-       pipe_data->pipe_config.subvp_data.main_pipe_index = subvp_pipe->pipe_idx;
+       pipe_data->pipe_config.subvp_data.main_pipe_index = subvp_pipe->stream_res.tg->inst;
        pipe_data->pipe_config.subvp_data.is_drr = subvp_pipe->stream->ignore_msa_timing_param;
 
        /* Calculate the scaling factor from the src and dst height.
@@ -679,11 +679,11 @@ static void populate_subvp_cmd_pipe_info(struct dc *dc,
                struct pipe_ctx *phantom_pipe = &context->res_ctx.pipe_ctx[j];
 
                if (phantom_pipe->stream == subvp_pipe->stream->mall_stream_config.paired_stream) {
-                       pipe_data->pipe_config.subvp_data.phantom_pipe_index = phantom_pipe->pipe_idx;
+                       pipe_data->pipe_config.subvp_data.phantom_pipe_index = phantom_pipe->stream_res.tg->inst;
                        if (phantom_pipe->bottom_pipe) {
-                               pipe_data->pipe_config.subvp_data.phantom_split_pipe_index = phantom_pipe->bottom_pipe->pipe_idx;
+                               pipe_data->pipe_config.subvp_data.phantom_split_pipe_index = phantom_pipe->bottom_pipe->plane_res.hubp->inst;
                        } else if (phantom_pipe->next_odm_pipe) {
-                               pipe_data->pipe_config.subvp_data.phantom_split_pipe_index = phantom_pipe->next_odm_pipe->pipe_idx;
+                               pipe_data->pipe_config.subvp_data.phantom_split_pipe_index = phantom_pipe->next_odm_pipe->plane_res.hubp->inst;
                        } else {
                                pipe_data->pipe_config.subvp_data.phantom_split_pipe_index = 0;
                        }