[PATCH 5/5] drm/amd/display: remove duplicated program_pipe code on dcn401
Melissa Wen
mwen at igalia.com
Wed Apr 30 14:20:11 UTC 2025
Reduce code duplication by reusing dcn20_program_pipe since both
dcn401/dcn20_program_pipe now does the same thing and so its caller on
dcn401.
Signed-off-by: Melissa Wen <mwen at igalia.com>
---
.../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 126 ------------------
.../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 4 -
2 files changed, 130 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
index 10c3ca86df65..dbdfd6502b5c 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
@@ -2214,132 +2214,6 @@ void dcn401_program_tg(struct dc *dc,
hws->funcs.setup_vupdate_interrupt(dc, pipe_ctx);
}
-void dcn401_program_pipe(
- struct dc *dc,
- struct pipe_ctx *pipe_ctx,
- struct dc_state *context)
-{
- struct dce_hwseq *hws = dc->hwseq;
-
- /* Only need to unblank on top pipe */
- if (resource_is_pipe_type(pipe_ctx, OTG_MASTER)) {
- if (pipe_ctx->update_flags.bits.enable ||
- pipe_ctx->update_flags.bits.odm ||
- pipe_ctx->stream->update_flags.bits.abm_level)
- hws->funcs.blank_pixel_data(dc, pipe_ctx,
- !pipe_ctx->plane_state ||
- !pipe_ctx->plane_state->visible);
- }
-
- /* Only update TG on top pipe */
- if (pipe_ctx->update_flags.bits.global_sync && !pipe_ctx->top_pipe
- && !pipe_ctx->prev_odm_pipe)
- dcn401_program_tg(dc, pipe_ctx, context, hws);
-
- if (pipe_ctx->update_flags.bits.odm)
- hws->funcs.update_odm(dc, context, pipe_ctx);
-
- if (pipe_ctx->update_flags.bits.enable) {
- if (hws->funcs.enable_plane)
- hws->funcs.enable_plane(dc, pipe_ctx, context);
- else
- dc->hwss.enable_plane(dc, pipe_ctx, context);
-
- if (dc->res_pool->hubbub->funcs->force_wm_propagate_to_pipes)
- dc->res_pool->hubbub->funcs->force_wm_propagate_to_pipes(dc->res_pool->hubbub);
- }
-
- if (pipe_ctx->update_flags.bits.det_size) {
- if (dc->res_pool->hubbub->funcs->program_det_size)
- dc->res_pool->hubbub->funcs->program_det_size(
- dc->res_pool->hubbub, pipe_ctx->plane_res.hubp->inst, pipe_ctx->det_buffer_size_kb);
- if (dc->res_pool->hubbub->funcs->program_det_segments)
- dc->res_pool->hubbub->funcs->program_det_segments(
- dc->res_pool->hubbub, pipe_ctx->plane_res.hubp->inst, pipe_ctx->hubp_regs.det_size);
- }
-
- if (pipe_ctx->plane_state && (pipe_ctx->update_flags.raw ||
- pipe_ctx->plane_state->update_flags.raw ||
- pipe_ctx->stream->update_flags.raw))
- dc->hwss.update_dchubp_dpp(dc, pipe_ctx, context);
-
- if (pipe_ctx->plane_state && (pipe_ctx->update_flags.bits.enable ||
- pipe_ctx->plane_state->update_flags.bits.hdr_mult))
- hws->funcs.set_hdr_multiplier(pipe_ctx);
-
- if (hws->funcs.populate_mcm_luts) {
- if (pipe_ctx->plane_state) {
- hws->funcs.populate_mcm_luts(dc, pipe_ctx, pipe_ctx->plane_state->mcm_luts,
- pipe_ctx->plane_state->lut_bank_a);
- pipe_ctx->plane_state->lut_bank_a = !pipe_ctx->plane_state->lut_bank_a;
- }
- }
-
- if (pipe_ctx->plane_state &&
- (pipe_ctx->plane_state->update_flags.bits.in_transfer_func_change ||
- pipe_ctx->plane_state->update_flags.bits.gamma_change ||
- pipe_ctx->plane_state->update_flags.bits.lut_3d ||
- pipe_ctx->update_flags.bits.enable))
- hws->funcs.set_input_transfer_func(dc, pipe_ctx, pipe_ctx->plane_state);
-
- /* dcn10_translate_regamma_to_hw_format takes 750us to finish
- * only do gamma programming for powering on, internal memcmp to avoid
- * updating on slave planes
- */
- if (pipe_ctx->update_flags.bits.enable ||
- pipe_ctx->update_flags.bits.plane_changed ||
- pipe_ctx->stream->update_flags.bits.out_tf ||
- (pipe_ctx->plane_state &&
- pipe_ctx->plane_state->update_flags.bits.output_tf_change))
- hws->funcs.set_output_transfer_func(dc, pipe_ctx, pipe_ctx->stream);
-
- /* If the pipe has been enabled or has a different opp, we
- * should reprogram the fmt. This deals with cases where
- * interation between mpc and odm combine on different streams
- * causes a different pipe to be chosen to odm combine with.
- */
- if (pipe_ctx->update_flags.bits.enable
- || pipe_ctx->update_flags.bits.opp_changed) {
-
- pipe_ctx->stream_res.opp->funcs->opp_set_dyn_expansion(
- pipe_ctx->stream_res.opp,
- COLOR_SPACE_YCBCR601,
- pipe_ctx->stream->timing.display_color_depth,
- pipe_ctx->stream->signal);
-
- pipe_ctx->stream_res.opp->funcs->opp_program_fmt(
- pipe_ctx->stream_res.opp,
- &pipe_ctx->stream->bit_depth_params,
- &pipe_ctx->stream->clamping);
- }
-
- /* Set ABM pipe after other pipe configurations done */
- if ((pipe_ctx->plane_state && pipe_ctx->plane_state->visible)) {
- if (pipe_ctx->stream_res.abm) {
- dc->hwss.set_pipe(pipe_ctx);
- pipe_ctx->stream_res.abm->funcs->set_abm_level(pipe_ctx->stream_res.abm,
- pipe_ctx->stream->abm_level);
- }
- }
-
- if (pipe_ctx->update_flags.bits.test_pattern_changed) {
- struct output_pixel_processor *odm_opp = pipe_ctx->stream_res.opp;
- struct bit_depth_reduction_params params;
-
- memset(¶ms, 0, sizeof(params));
- odm_opp->funcs->opp_program_bit_depth_reduction(odm_opp, ¶ms);
- dc->hwss.set_disp_pattern_generator(dc,
- pipe_ctx,
- pipe_ctx->stream_res.test_pattern_params.test_pattern,
- pipe_ctx->stream_res.test_pattern_params.color_space,
- pipe_ctx->stream_res.test_pattern_params.color_depth,
- NULL,
- pipe_ctx->stream_res.test_pattern_params.width,
- pipe_ctx->stream_res.test_pattern_params.height,
- pipe_ctx->stream_res.test_pattern_params.offset);
- }
-}
-
bool dcn401_update_bandwidth(
struct dc *dc,
struct dc_state *context)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h
index acfdc856f543..5f3d9e7364ca 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h
@@ -97,10 +97,6 @@ void dcn401_program_tg(struct dc *dc,
struct pipe_ctx *pipe_ctx,
struct dc_state *context,
struct dce_hwseq *hws);
-void dcn401_program_pipe(
- struct dc *dc,
- struct pipe_ctx *pipe_ctx,
- struct dc_state *context);
void dcn401_perform_3dlut_wa_unlock(struct pipe_ctx *pipe_ctx);
bool dcn401_update_bandwidth(struct dc *dc, struct dc_state *context);
void dcn401_detect_pipe_changes(
--
2.47.2
More information about the dri-devel
mailing list