drm/amd/display: Move populate phaton function to dml
authorRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Thu, 7 Jul 2022 20:03:40 +0000 (16:03 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 25 Jul 2022 13:31:03 +0000 (09:31 -0400)
The function dcn32_helper_populate_phantom_dlg_params uses FPU
operations. For this reason, this commit moves this function to the
dcn32_fpu file, and we ensure that we only invoke it under the
kernel_fpu protection.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h

index 1b499f42f459d99ea98c7ecbb6fb411e3e52fa14..efbae88c492a5b579c407af9773c0f8f6b45053b 100644 (file)
@@ -88,6 +88,7 @@
 #include "dml/dcn30/display_mode_vba_30.h"
 #include "vm_helper.h"
 #include "dcn20/dcn20_vmid.h"
+#include "dml/dcn32/dcn32_fpu.h"
 
 #define DCN_BASE__INST0_SEG1                       0x000000C0
 #define DCN_BASE__INST0_SEG2                       0x000034C0
@@ -312,6 +313,7 @@ enum dcn32_clk_src_array_id {
                .reg_name = NBIO_BASE(regBIF_BX0_ ## reg_name ## _BASE_IDX) + \
                                        regBIF_BX0_ ## reg_name
 
+#undef CTX
 #define CTX ctx
 #define REG(reg_name) \
        (DCN_BASE.instance[0].segment[reg ## reg_name ## _BASE_IDX] + reg ## reg_name)
@@ -2666,6 +2668,11 @@ static void dcn32_full_validate_bw_helper(struct dc *dc,
                        memset(merge, 0, MAX_PIPES * sizeof(bool));
                        *vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, *vlevel, split, merge);
 
+                       // Most populate phantom DLG params before programming hardware / timing for phantom pipe
+                       DC_FP_START();
+                       dcn32_helper_populate_phantom_dlg_params(dc, context, pipes, *pipe_cnt);
+                       DC_FP_END();
+
                        // Note: We can't apply the phantom pipes to hardware at this time. We have to wait
                        // until driver has acquired the DMCUB lock to do it safely.
                }
index a6ef1dba01fe45ddcec98ad4b628818f0325e41c..633d3ee18cfa33b9c94d527fe2f1733e206673c6 100644 (file)
 #include "dcn20/dcn20_resource.h"
 #include "dml/dcn32/display_mode_vba_util_32.h"
 
-/**
- * ********************************************************************************************
- * dcn32_helper_populate_phantom_dlg_params: Get DLG params for phantom pipes and populate pipe_ctx
- * with those params.
- *
- * This function must be called AFTER the phantom pipes are added to context and run through DML
- * (so that the DLG params for the phantom pipes can be populated), and BEFORE we program the
- * timing for the phantom pipes.
- *
- * @param [in] dc: current dc state
- * @param [in] context: new dc state
- * @param [in] pipes: DML pipe params array
- * @param [in] pipe_cnt: DML pipe count
- *
- * @return: void
- *
- * ********************************************************************************************
- */
-void dcn32_helper_populate_phantom_dlg_params(struct dc *dc,
-               struct dc_state *context,
-               display_e2e_pipe_params_st *pipes,
-               int pipe_cnt)
-{
-       uint32_t i, pipe_idx;
-       for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
-               struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
-               if (!pipe->stream)
-                       continue;
-
-               if (pipe->plane_state && pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
-                       pipes[pipe_idx].pipe.dest.vstartup_start = get_vstartup(&context->bw_ctx.dml, pipes, pipe_cnt,
-                                       pipe_idx);
-                       pipes[pipe_idx].pipe.dest.vupdate_offset = get_vupdate_offset(&context->bw_ctx.dml, pipes, pipe_cnt,
-                                       pipe_idx);
-                       pipes[pipe_idx].pipe.dest.vupdate_width = get_vupdate_width(&context->bw_ctx.dml, pipes, pipe_cnt,
-                                       pipe_idx);
-                       pipes[pipe_idx].pipe.dest.vready_offset = get_vready_offset(&context->bw_ctx.dml, pipes, pipe_cnt,
-                                       pipe_idx);
-                       pipe->pipe_dlg_param = pipes[pipe_idx].pipe.dest;
-               }
-               pipe_idx++;
-       }
-}
-
 /**
  * ********************************************************************************************
  * dcn32_helper_calculate_num_ways_for_subvp: Calculate number of ways needed for SubVP
index 89b596599c3d31bb1e9cb16161b7445218ffce4f..253ff9659b0d1c7c604973b35957a0c8ed74f927 100644 (file)
@@ -111,3 +111,46 @@ void dcn32_build_wm_range_table_fpu(struct clk_mgr_internal *clk_mgr)
        clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].pmfw_breakdown.max_uclk = 0xFFFF;
 }
 
+/**
+ * dcn32_helper_populate_phantom_dlg_params - Get DLG params for phantom pipes
+ * and populate pipe_ctx with those params.
+ *
+ * This function must be called AFTER the phantom pipes are added to context
+ * and run through DML (so that the DLG params for the phantom pipes can be
+ * populated), and BEFORE we program the timing for the phantom pipes.
+ *
+ * @dc: [in] current dc state
+ * @context: [in] new dc state
+ * @pipes: [in] DML pipe params array
+ * @pipe_cnt: [in] DML pipe count
+ */
+void dcn32_helper_populate_phantom_dlg_params(struct dc *dc,
+                                             struct dc_state *context,
+                                             display_e2e_pipe_params_st *pipes,
+                                             int pipe_cnt)
+{
+       uint32_t i, pipe_idx;
+
+       dc_assert_fp_enabled();
+
+       for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
+               struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+
+               if (!pipe->stream)
+                       continue;
+
+               if (pipe->plane_state && pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
+                       pipes[pipe_idx].pipe.dest.vstartup_start =
+                               get_vstartup(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
+                       pipes[pipe_idx].pipe.dest.vupdate_offset =
+                               get_vupdate_offset(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
+                       pipes[pipe_idx].pipe.dest.vupdate_width =
+                               get_vupdate_width(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
+                       pipes[pipe_idx].pipe.dest.vready_offset =
+                               get_vready_offset(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
+                       pipe->pipe_dlg_param = pipes[pipe_idx].pipe.dest;
+               }
+               pipe_idx++;
+       }
+}
+
index 72a6dd75af0e01fd08234e4c8d2850bd2d433b92..492f99b6d561913d741f6097f834e94338b455c1 100644 (file)
@@ -31,4 +31,9 @@
 
 void dcn32_build_wm_range_table_fpu(struct clk_mgr_internal *clk_mgr);
 
+void dcn32_helper_populate_phantom_dlg_params(struct dc *dc,
+                                             struct dc_state *context,
+                                             display_e2e_pipe_params_st *pipes,
+                                             int pipe_cnt);
+
 #endif