[PATCH 1/5] drm/amd/display: add hook for program_tg
Melissa Wen
mwen at igalia.com
Wed Apr 30 14:20:07 UTC 2025
The only actual difference between dcn20_program_pipe and
dcn401_program_pipe is the way they program global sync. Create a hook
to enable hw-family function calls, so that we can reuse
dcn20_program_pipe, avoid code duplication and prevent future partial
fixes for the same portion of code.
Signed-off-by: Melissa Wen <mwen at igalia.com>
---
.../gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 11 ++++++++---
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h | 4 ++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
index 5e78b553adbd..1be9be74564e 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
@@ -1925,9 +1925,14 @@ static void dcn20_program_pipe(
}
/* Only update TG on top pipe */
- if (pipe_ctx->update_flags.bits.global_sync && !pipe_ctx->top_pipe
- && !pipe_ctx->prev_odm_pipe)
- dcn20_program_tg(dc, pipe_ctx, context, hws);
+ if (pipe_ctx->update_flags.bits.global_sync &&
+ !pipe_ctx->top_pipe &&
+ !pipe_ctx->prev_odm_pipe) {
+ if(dc->hwss.program_tg)
+ dc->hwss.program_tg(dc, pipe_ctx, context, hws);
+ else
+ dcn20_program_tg(dc, pipe_ctx, context, hws);
+ }
if (pipe_ctx->update_flags.bits.odm)
hws->funcs.update_odm(dc, context, pipe_ctx);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
index 3a0795045bc6..86ffc7818df7 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
@@ -467,6 +467,10 @@ struct hw_sequencer_funcs {
struct dc_state *new_state,
struct pipe_ctx *old_pipe,
struct pipe_ctx *new_pipe);
+ void (*program_tg)(struct dc *dc,
+ struct pipe_ctx *pipe_ctx,
+ struct dc_state *context,
+ struct dce_hwseq *hws);
void (*enable_plane)(struct dc *dc,
struct pipe_ctx *pipe_ctx,
struct dc_state *context);
--
2.47.2
More information about the dri-devel
mailing list