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 1CDE4606A31A for ; Tue, 1 Dec 2026 20:51:10 +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=PuP9frtI Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FB3210E2C5; Tue, 1 Dec 2026 20:51:04 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC5DB10E2C5 for ; Tue, 1 Dec 2026 20:50:58 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 51B10409D5; Tue, 1 Dec 2026 20:50:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2494E1F000C1; Tue, 1 Dec 2026 20:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796158258; bh=au90lC7sNdDjdil2WFZf6rLuV35ut0vzGebuyjhPZ/s=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=PuP9frtITKjHfFHGrCBo3aXljcsNhaaQm4aU7yhOeDteZea9YTJH9immf0zkCaI+Q NHCriM/OEN+DWx2c2HpiqB4u2vyeEyN1N70Hwy1/BJdBalcXmWSezdkrb0Y5OJqL9W YMVXri+rLu/IqrMEu9PQjQotQeYMqmiAWQbdJygFzaGoqiJZCtKCmAXDPoZ4dGZ+5C bN7Ek4OFiIEokaO90sJCIi/99ztDoWrrYSiRRpnPTaV2WFkW1WVuz9sNCH2SmTLFD0 Q9dbzDLkisYU+3D2lhUYjrzKePOdQ8oujMCs+77lPAPVZBB0F0mESH+v2ytSJphL0U nIbRLBEi2+iUA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic To: "George Zhang" , amd-gfx@lists.freedesktop.org In-Reply-To: <20261201202451.463794-23-george.zhang@amd.com> References: <20261201202451.463794-2-george.zhang@amd.com> <20261201202451.463794-23-george.zhang@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 20:50:57 +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: vblank_nom not replaced in dcn6_build_pstate_meta_per_stream() - [Medium] drm/amd/display: v_total vs vblank_nom mismatch in DCN6 pstate admissibility -- commit 0206c2992e2de04f212b5f64a6b0b9d2d0262f39 Author: Dillon Varone drm/amd/display: Improve P-state admissability logic This commit updates DCN6 P-state schedule window and admissibility calculations to include unallocated VBlank lines when VStartup is smaller than VBlank, and clamps the per-stream ideal P-state disallow time to the allow delay divided by the number of streams. > diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dm= l2_core_dcn6_calcs_dchub.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/sr= c/dml2_core/dml2_core_dcn6_calcs_dchub.c > index 69439ec644e01..7b7fa428958eb 100644 > --- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core= _dcn6_calcs_dchub.c > +++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core= _dcn6_calcs_dchub.c > @@ -1715,6 +1715,8 @@ void dcn6_calculate_pstate_schedule_windows( > int num_active_planes, > const unsigned int v_blank_start[DML2_MAX_PLANES], > const unsigned int v_blank_end[DML2_MAX_PLANES], > + const unsigned int v_startup[DML2_MAX_PLANES], > + const unsigned int v_total[DML2_MAX_PLANES], > const double otg_vline_time_us[DML2_MAX_PLANES], > const double det_fill_delay_us[DML2_MAX_PLANES], > const double reserved_vblank_us[DML2_MAX_PLANES], > @@ -1728,6 +1730,7 @@ void dcn6_calculate_pstate_schedule_windows( > int det_fill_delay_otg_vlines; > int blackout_otg_vlines; > int reserved_vblank_otg_vlines; > + int unallocated_vblank_otg_vlines; > =20 > /** > * Calculate allow start and end for pstate in vactive: > @@ -1742,10 +1745,13 @@ void dcn6_calculate_pstate_schedule_windows( > blackout_otg_vlines =3D (int)(math_ceil(blackout_us / otg_vline_time_u= s[k])); > det_fill_delay_otg_vlines =3D (int)(math_ceil(det_fill_delay_us[k] / o= tg_vline_time_us[k])); > reserved_vblank_otg_vlines =3D (int)(math_ceil(reserved_vblank_us[k] /= otg_vline_time_us[k])); > + unallocated_vblank_otg_vlines =3D v_total[k] - v_blank_start[k] + v_bl= ank_end[k] - v_startup[k]; > =20 > /* for vactive only, make relative to vblank end */ > allow_start_otg_vlines =3D det_fill_delay_otg_vlines; > - allow_end_otg_vlines =3D v_blank_start[k] - v_blank_end[k] - (blackout= _otg_vlines - reserved_vblank_otg_vlines); > + allow_end_otg_vlines =3D v_blank_start[k] - v_blank_end[k] + > + unallocated_vblank_otg_vlines - > + (blackout_otg_vlines - reserved_vblank_otg_vlines); > =20 > /* Convert them back to time since the start of a frame */ > allow_start_us[k] =3D allow_start_otg_vlines * otg_vline_time_us[k]; [Severity: Medium] Does adding unallocated_vblank_otg_vlines (computed from v_total) to allow_end_otg_vlines cause dcn6_calculate_pstate_schedule_admissibility() to under-calculate disallow_window_us when v_total - v_active exceeds vblank_nom? dcn6_ms_check_pstate_schedule_admissibility() computes frame_time_us[k] via dml2_core_utils_get_frame_time_us(), which uses vblank_nom + v_active rather than v_total: drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.c= :dml2_core_utils_get_frame_time_us() { double otg_vline_time_us =3D (double)stream->timing.h_total / (double)stre= am->timing.pixel_clock_khz * 1000.0; double non_vtotal =3D stream->timing.vblank_nom + stream->timing.v_active; double frame_time_us =3D non_vtotal * otg_vline_time_us; When dcn6_calculate_pstate_schedule_admissibility() computes disallow_window_us[cur_id] =3D group_frame_time_us - allow_window_us[cur_id= ], subtracting a v_total-based allow_window_us from a (vblank_nom + v_active) frame time double-subtracts (v_total - v_active - vblank_nom) lines. On timings whose VBlank exceeds vblank_nom, this reduces or zeroes disallow_window_us and lets non-admissible P-state schedules pass mode support validation. [ ... ] > diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml= 2_pmo_dcn6_stage_optimizers.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21= /src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c > index 71407eec2d836..44cc7de4d8dc7 100644 > --- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_d= cn6_stage_optimizers.c > +++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_d= cn6_stage_optimizers.c [ ... ] > @@ -836,11 +848,12 @@ static void dcn6_build_pstate_meta_per_stream(const= struct dml2_display_cfg *dis > if (stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_us > = 0.0) { > stream_pstate_meta->method_vactive.common.allow_start_otg_vline =3D > timing->v_blank_end + stream_pstate_meta->method_vactive.max_vactive= _det_fill_delay_otg_vlines; > + > stream_pstate_meta->method_vactive.common.allow_end_otg_vline =3D > stream_pstate_meta->vblank_start + > stream_pstate_meta->nom_vtotal - > stream_descriptor->timing.v_active - > - stream_descriptor->timing.vblank_nom - > + stream_pstate_meta->method_vactive.vstartup_lines - > stream_pstate_meta->blackout_otg_vlines + > stream_pstate_meta->method_vactive.reserved_blank_required_vlines; > } else { [Severity: Medium] Should the max allow delay enforcement immediately above in dcn6_build_pstate_meta_per_stream() also subtract stream_pstate_meta->method_vactive.vstartup_lines instead of stream_descriptor->timing.vblank_nom? drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stag= e_optimizers.c:dcn6_build_pstate_meta_per_stream() { ... /* consider max allow delay enforcement */ if (stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlin= es > 0) { stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines = =3D (int)math_min2( (double)stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_o= tg_vlines, math_max2(0.0, stream_pstate_meta->max_allow_delay_otg_vlines + stream_pstate_meta->method_vactive.reserved_blank_required_vlines - (int)stream_descriptor->timing.vblank_nom - stream_pstate_meta->blackout_otg_vlines)); } else { stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines = =3D (int)math_max2(0.0, stream_pstate_meta->max_allow_delay_otg_vlines + stream_pstate_meta->method_vactive.reserved_blank_required_vlines - (int)stream_descriptor->timing.vblank_nom - stream_pstate_meta->blackout_otg_vlines); } ... } When vstartup_lines < vblank_nom, subtracting vblank_nom underestimates max_vactive_det_fill_delay_otg_vlines by (vblank_nom - vstartup_lines) and can clamp max_vactive_det_fill_delay_us to 0.0, which skips the allow window calculation above and leaves allow_start_otg_vline and allow_end_otg_vline at 0. Similarly, dcn6_update_worksheet_for_pstate_admissibility() still computes vblank_time_us from timing.vblank_nom rather than vstartup_lines when bounding delta_reserved_vblank_time_us, which can reserve more VBlank time than fits in VStartup. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201202451.4637= 94-2-george.zhang@amd.com?part=3D21