AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "George Zhang" <george.zhang@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2
Date: Tue, 01 Dec 2026 20:55:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-244256@kernel.org> (raw)
In-Reply-To: <20261201202451.463794-16-george.zhang@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: partial DSC sequence on config failure in
  dcn401_add_step()
- [Medium] drm/amd/display: missing DSC resource check on kept streams
  in DC2 builder
--

commit b1940a96d693c6dd5b7ea3ce521afe04d2fe9fac
Author: Tony Cheng <tony.cheng@amd.com>

drm/amd/display: Program DSC on one stream in DC2

This commit adds DSC programming and state checks to the DCN401 DC2
non-seamless and seamless block sequence builders and executor.

> diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> index bc7dd933e35ee..38b40fe8b02b9 100644
> --- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> +++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
[ ... ]
> @@ -921,6 +944,43 @@ static bool check_no_cursor(const struct dc *dc,
>  	return !new_state->streams[i]->cursor_attributes.address.quad_part;
>  }
>  
> +static bool dcn401_same_opp_heads(const struct dc_state *current_state,
> +		const struct dc_state *new_state,
> +		const struct dc_stream_state *stream)
> +{
> +	const struct pipe_ctx *cur = dcn401_otg_master(current_state, stream);
> +	const struct pipe_ctx *new = dcn401_otg_master(new_state, stream);
> +	struct pipe_ctx *cur_heads[MAX_PIPES], *new_heads[MAX_PIPES];
> +	int i, n;
> +
> +	if (!cur || !new)
> +		return false;
> +	n = resource_get_opp_heads_for_otg_master(cur,
> +			(struct resource_context *)&current_state->res_ctx,
> +			cur_heads);
> +	if (n != resource_get_opp_heads_for_otg_master(new,
> +			(struct resource_context *)&new_state->res_ctx,
> +			new_heads))
> +		return false;
> +	for (i = 0; i < n; i++)
> +		if (!cur_heads[i]->stream_res.opp ||
> +				!new_heads[i]->stream_res.opp ||
> +				cur_heads[i]->stream_res.opp->inst !=
> +				new_heads[i]->stream_res.opp->inst)
> +			return false;
> +	return true;
> +}
> +
> +static bool check_dsc_odm_kept(const struct dc *dc,
> +		const struct dc_state *current_state,
> +		const struct dc_state *new_state, unsigned int i)
> +{
> +	(void)dc;
> +	return !new_state->streams[i]->timing.flags.DSC ||
> +			dcn401_same_opp_heads(current_state, new_state,
> +			new_state->streams[i]);
> +}

[Severity: Medium]
Can a kept stream change its DSC instance or drop DSC without the update
programming the new DSC block or disabling the old one?

dcn401_same_opp_heads(), dcn401_pipe_layout_unchanged(), and
dcn401_eval_pipe_deltas() compare stream_res.opp->inst without checking
DCN401_SAME_INST(cur->stream_res.dsc, new->stream_res.dsc), and
check_dsc_odm_kept() only inspects new_state->streams[i]->timing.flags.DSC.
For example, if the top plane of a two-plane MPC-blended DSC stream is
removed so the bottom pipe becomes the OTG master on the same OTG and OPP
with a different stream_res.dsc instance, deltas.hubp_dpp_already_enabled
and deltas.odm_kept are both true, so bls_stream_update skips dsc[] and
optc_dsc[] and never disconnects the old DSC or enables the new one.

[ ... ]

> @@ -1848,6 +1945,22 @@ static void dcn401_odm_combine_params(struct pipe_ctx *otg_master,
>  			true);
>  }
>  
> +static void dcn401_dsc_config_params(struct pipe_ctx *otg_master,
> +		bool enable, struct tg_set_dsc_config_params *p)
> +{
> +	struct dsc_optc_config optc;
> +
> +	p->tg = otg_master->stream_res.tg;
> +	p->dsc_mode = OPTC_DSC_DISABLED;
> +	if (!enable || !hwss_prepare_dsc_config_for_pipe(otg_master,
> +			resource_get_odm_slice_count(otg_master), 0, &optc))
> +		return;
> +	p->dsc_mode = optc.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 :
> +			OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
> +	p->bytes_per_pixel = optc.bytes_per_pixel;
> +	p->slice_width = optc.slice_width;
> +}
[ ... ]
> @@ -2200,6 +2313,39 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
>  		p->opp_program_left_edge_extra_pixel_params.is_otg_master =
>  				!pipe->prev_odm_pipe;
>  		break;
> +	case DCCG_SET_DTO_DSCCLK:
> +		p->dccg_set_dto_dscclk_params.dccg = dc->res_pool->dccg;
> +		p->dccg_set_dto_dscclk_params.inst = pipe->stream_res.dsc->inst;
> +		p->dccg_set_dto_dscclk_params.num_slices_h =
> +				pipe->stream->timing.dsc_cfg.num_slices_h /
> +				resource_get_odm_slice_count(pipe);
> +		break;
> +	case DSC_SET_CONFIG:
> +		if (!hwss_prepare_dsc_config_for_pipe(pipe,
> +				resource_get_odm_slice_count(pipe), 0, NULL)) {
> +			(*sequence->num_steps)--;
> +			return;
> +		}
> +		p->dsc_set_config_params.dsc = pipe->stream_res.dsc;
> +		break;
> +	case DSC_ENABLE:
> +		p->dsc_enable_params.dsc = pipe->stream_res.dsc;
> +		p->dsc_enable_params.opp_inst = pipe->stream_res.opp->inst;
> +		break;
> +	case TG_SET_DSC_CONFIG:
> +		dcn401_dsc_config_params(pipe, m->tg_set_dsc_config.enable,
> +				&p->tg_set_dsc_config_params);
> +		break;

[Severity: Medium]
Does a failure in hwss_prepare_dsc_config_for_pipe() emit a partial DSC
sequence instead of aborting execution?

When hwss_prepare_dsc_config_for_pipe() fails in the DSC_SET_CONFIG case,
decrementing *sequence->num_steps removes DSC_SET_CONFIG from the sequence
(bypassing dc2_bls_step_supported()), while DCCG_SET_DTO_DSCCLK and
DSC_ENABLE are still emitted and dcn401_dsc_config_params() populates
p->tg with p->dsc_mode = OPTC_DSC_DISABLED.  Executing that sequence
enables DSC forwarding on the OPP head into an unconfigured DSC block
while disabling DSC in OPTC, corrupting or hanging display output.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=14

  reply	other threads:[~2026-12-01 20:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
2026-12-01 20:22 ` [PATCH v2 01/30] drm/amd/display: cast clamped rate conversion George Zhang
2026-12-01 20:22 ` [PATCH v2 02/30] drm/amd/display: Split HWSS_CURSOR_LOCK into flat BLS operations George Zhang
2026-12-01 20:22 ` [PATCH v2 03/30] drm/amd/display: clamp AUX reply length as unsigned George Zhang
2026-12-01 20:22 ` [PATCH v2 04/30] drm/amd/display: keep the DPCD read result signed in the MST ISR George Zhang
2026-12-01 20:22 ` [PATCH v2 05/30] drm/amd/display: copy only the status byte on a DMUB AUX write status retry George Zhang
2026-12-01 20:22 ` [PATCH v2 06/30] drm/amd/display: test the DMUB AUX write status reply copy George Zhang
2026-12-01 20:22 ` [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation George Zhang
2026-12-01 20:49   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 08/30] drm/amd/display: Read max LSDMA BW from DMU George Zhang
2026-12-01 20:22 ` [PATCH v2 09/30] drm/amd/display: Precompute EASF lookup thresholds George Zhang
2026-12-01 20:22 ` [PATCH v2 10/30] drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant George Zhang
2026-12-01 20:22 ` [PATCH v2 11/30] drm/amd/display: Add pipe init to core2 George Zhang
2026-12-01 20:54   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior George Zhang
2026-12-01 20:42   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 13/30] drm/amd/display: Re-enable HUBP/DPP Driver PG on DCN42 George Zhang
2026-12-01 20:22 ` [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2 George Zhang
2026-12-01 20:55   ` sashiko-bot [this message]
2026-12-01 20:22 ` [PATCH v2 15/30] drm/amd/display: enable dcn42b hubp/dpp pg control from driver side George Zhang
2026-12-01 20:22 ` [PATCH v2 16/30] drm/amd/display: cover gamma 2.4 and 2.6 on the wide curve George Zhang
2026-12-01 20:22 ` [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown George Zhang
2026-12-01 21:09   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 18/30] drm/amd/display: block pr in mst right George Zhang
2026-12-01 20:46   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 19/30] drm/amd/display: Add a per-ASIC default for the DC2 selection George Zhang
2026-12-01 20:22 ` [PATCH v2 20/30] drm/amd/display: Refactor Max VStartup calculations for DCN6 George Zhang
2026-12-01 20:22 ` [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic George Zhang
2026-12-01 20:50   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2 George Zhang
2026-12-01 21:00   ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 23/30] drm/amd/display: Report a DC2 BLS step overflow behind a debug option George Zhang
2026-12-01 20:22 ` [PATCH v2 24/30] drm/amd/display: VRR Support on Direct MST Sinks George Zhang
2026-12-01 20:22 ` [PATCH v2 25/30] drm/amd/display: Program YCbCr output in DC2 George Zhang
2026-12-01 20:23 ` [PATCH v2 26/30] drm/amd/display: Skip a stream with no OTG master " George Zhang
2026-12-01 20:23 ` [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit George Zhang
2026-12-01 20:57   ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 28/30] drm/amd/display: Move shared dcn401 builder code to its own file George Zhang
2026-12-01 20:23 ` [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone George Zhang
2026-12-01 20:52   ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410 George Zhang
2026-12-01 20:45   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-244256@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=george.zhang@amd.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox