From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4877606A31A for ; Tue, 1 Dec 2026 20:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MgQHxxwT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5159210FD14; Tue, 1 Dec 2026 20:56:03 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 789B210FD14 for ; Tue, 1 Dec 2026 20:55:57 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 1B77E4444D; Tue, 1 Dec 2026 20:55:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD0481F000C1; Tue, 1 Dec 2026 20:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796158557; bh=SHf1AC20g892Pmf9e6/y7Y5hA0DQeXafg0U24bpsAis=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=MgQHxxwTauBuzbgmN6kkcFgARzgKHlB7o7xW7lK+r2Izpqh2NpC40qaq7ZEIiNlrx Jbh7zE9kVGAlr6QL0G+RDfCPVbjCUxTPBTEp878FBWF4vYI3Em4ZSdZI3Obmm3JKaV MKQwCisAque8Xn4idU6Yg/faY2eHcOBra5scwYlDqrQnFKjIRv/DavvN018AiQf056 uJ8WIrpgFymdDraOsIdzE0oDZzIpAkAfMozc03Wd8btcSTHgv1XoelPC1E3EpDYaFa a4jOtmw444xxh9IWSoNUfswxDcc2ZzMvFJ/fygekxoOSl5wtuW4RHZuCChFQiGH9mE 9hzVEdHFLqgKw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2 To: "George Zhang" , amd-gfx@lists.freedesktop.org In-Reply-To: <20261201202451.463794-16-george.zhang@amd.com> References: <20261201202451.463794-2-george.zhang@amd.com> <20261201202451.463794-16-george.zhang@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 20:55:56 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "amd-gfx" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 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_b= uilder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_build= er.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; > } > =20 > +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 =3D dcn401_otg_master(current_state, stream); > + const struct pipe_ctx *new =3D 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 =3D resource_get_opp_heads_for_otg_master(cur, > + (struct resource_context *)¤t_state->res_ctx, > + cur_heads); > + if (n !=3D resource_get_opp_heads_for_otg_master(new, > + (struct resource_context *)&new_state->res_ctx, > + new_heads)) > + return false; > + for (i =3D 0; i < n; i++) > + if (!cur_heads[i]->stream_res.opp || > + !new_heads[i]->stream_res.opp || > + cur_heads[i]->stream_res.opp->inst !=3D > + 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); > } > =20 > +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 =3D otg_master->stream_res.tg; > + p->dsc_mode =3D 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 =3D optc.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 : > + OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED; > + p->bytes_per_pixel =3D optc.bytes_per_pixel; > + p->slice_width =3D 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 =3D > !pipe->prev_odm_pipe; > break; > + case DCCG_SET_DTO_DSCCLK: > + p->dccg_set_dto_dscclk_params.dccg =3D dc->res_pool->dccg; > + p->dccg_set_dto_dscclk_params.inst =3D pipe->stream_res.dsc->inst; > + p->dccg_set_dto_dscclk_params.num_slices_h =3D > + 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 =3D pipe->stream_res.dsc; > + break; > + case DSC_ENABLE: > + p->dsc_enable_params.dsc =3D pipe->stream_res.dsc; > + p->dsc_enable_params.opp_inst =3D 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 =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201202451.4637= 94-2-george.zhang@amd.com?part=3D14