All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Lin <PingLei.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
	Leo Li <sunpeng.li@amd.com>,
	Aurabindo Pillai <aurabindo.pillai@amd.com>,
	Roman Li <roman.li@amd.com>, Wayne Lin <wayne.lin@amd.com>,
	Tom Chung <chiahsuan.chung@amd.com>,
	"Fangzhi Zuo" <jerry.zuo@amd.com>,
	Dan Wheeler <daniel.wheeler@amd.com>, Ray Wu <Ray.Wu@amd.com>,
	Ivan Lipski <ivan.lipski@amd.com>, Alex Hung <alex.hung@amd.com>,
	James Lin <PingLei.Lin@amd.com>,
	Chenyu Chen <Chen-Yu.Chen@amd.com>,
	Tony Cheng <tony.cheng@amd.com>, James Lin <pinglei.lin@amd.com>
Subject: [PATCH 26/33] drm/amd/display: Add a plane beside a kept plane in DC2 update
Date: Tue, 17 Nov 2026 05:51:03 +0800	[thread overview]
Message-ID: <20261116215641.2800595-27-PingLei.Lin@amd.com> (raw)
In-Reply-To: <20261116215641.2800595-1-PingLei.Lin@amd.com>

From: Tony Cheng <tony.cheng@amd.com>

[Why]
The DC2 seamless update builder accepts a plane add only on a stream
with no plane. An update that adds a second plane to a stream fails.

[How]
Accept one or two kept planes and at most one added plane. Each kept
plane stays on its pipe, HUBP and DPP. Skip the first-enable steps of a
kept pipe, and program the DET segments when its DET size changes.

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: James Lin <pinglei.lin@amd.com>
---
 .../bls_builder/bls_builder_private_types.h   |  7 +-
 .../dc/bls_builder/dcn401_seamless_builder.c  | 72 ++++++++++++++-----
 2 files changed, 59 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
index cc301a02c494..ed9d2f7fc0a2 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
@@ -116,10 +116,13 @@ struct dcn401_commit_step_meta {
 		/* The OPP MPC tree has no plane yet. */
 		bool opp_tree_empty;
 		/*
-		 * The HUBP/DPP block is already on. The step is part of
-		 * enabling that block the first time, not of reconfiguring it.
+		 * The pipe already showed the plane on this HUBP. The step is
+		 * part of enabling that block the first time, not of
+		 * reconfiguring it.
 		 */
 		bool hubp_dpp_already_enabled;
+		/* As hubp_dpp_already_enabled, and the DET size is the same. */
+		bool det_unchanged;
 		/*
 		 * Neither the plane scaling, the plane position nor the
 		 * stream scaling changed. A full update sets every plane bit,
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 09ea7ba26452..178598f18517 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
@@ -30,14 +30,15 @@
  * DCN_DECL_NON_SEAMLESS_COMMIT (dcn401_non_seamless_builder.c) enabled.
  * The other streams keep their pipes and planes, and the update programs
  * none of them. The update either adds one plane, or two MPC-blended
- * planes, to the stream, or keeps one plane and programs its surface,
- * address, scaler and viewport. The sequence follows the full update in
+ * planes, to the stream, or keeps its planes and programs their surface,
+ * address, scaler and viewport, and may add a second plane below a kept
+ * one. The sequence follows the full update in
  * commit_planes_for_stream on dcn401, all in head_sequence: the
  * outstanding updates, prepare_bandwidth and the pending-update waits,
  * then the locked front-end programming and
- * post_unlock_program_front_end. A kept-plane update skips enable_plane
- * and the stream unblank. The bandwidth lower stays with
- * dc_post_update_surfaces_to_stream.
+ * post_unlock_program_front_end. A kept plane skips the first-enable steps
+ * of enable_plane, and a stream that had a plane skips the unblank. The
+ * bandwidth lower stays with dc_post_update_surfaces_to_stream.
  *
  * This file also holds what both builders share: the dc and stream
  * support checks, and the step walkers that turn a table into BLS entries.
@@ -517,17 +518,40 @@ static bool dcn401_is_plane_add(const struct dc_state *current_state,
 			(planes == 1 || planes == 2);
 }
 
+/*
+ * Each current plane stays on its pipe, HUBP and DPP, and at most one
+ * plane is added under them.
+ */
 static bool dcn401_is_plane_kept(const struct dc_state *current_state,
 		const struct dc_state *new_state, unsigned int i)
 {
-	return dcn401_current_plane_count(current_state, new_state, i) == 1 &&
-			new_state->stream_status[i].plane_count == 1;
+	unsigned int planes = dcn401_current_plane_count(current_state,
+			new_state, i);
+	const struct pipe_ctx *cur, *new;
+	unsigned int j;
+
+	if (!planes || new_state->stream_status[i].plane_count < planes ||
+			new_state->stream_status[i].plane_count > 2)
+		return false;
+	for (j = 0; j < MAX_PIPES; j++) {
+		cur = &current_state->res_ctx.pipe_ctx[j];
+		new = &new_state->res_ctx.pipe_ctx[j];
+		if (cur->stream != new_state->streams[i] || !cur->plane_state)
+			continue;
+		if (new->stream != cur->stream ||
+				new->plane_state != cur->plane_state ||
+				new->plane_res.hubp != cur->plane_res.hubp ||
+				new->plane_res.dpp != cur->plane_res.dpp ||
+				!new->top_pipe != !cur->top_pipe)
+			return false;
+	}
+	return true;
 }
 
 /*
  * The seamless update either adds the first one or two planes, or keeps
- * one plane and programs its surface, address, scaler and viewport. Each
- * plane has its own DPP pipe.
+ * the planes and programs their surface, address, scaler and viewport,
+ * and may add a second plane below one. Each plane has its own DPP pipe.
  */
 static bool check_plane_add_or_kept(const struct dc *dc,
 		const struct dc_state *current_state,
@@ -940,7 +964,7 @@ static enum bls_builder_result dcn401_check_seamless_update_support(
 	CHECK_UPDATE(streams_kept,
 			"a stream is not kept, or another stream changes");
 	CHECK_UPDATE(plane_add_or_kept,
-			"update is not a plane add or a kept-plane surface update");
+			"update is not a plane add, or keeps a plane off its pipe");
 	CHECK_UPDATE(same_otg_master_blocks, "otg, opp or odm changes");
 	CHECK_UPDATE_RESOURCE(new_plane_blocks, "plane is missing hubp or dpp");
 	CHECK_RESOURCE(pool_funcs, "resource pool or hubbub has no funcs");
@@ -1104,7 +1128,7 @@ static const struct dcn401_commit_step enable_plane[] = {
 	  .meta.skip_if.hubp_dpp_already_enabled = true },
 	{ .func = HUBP_PROGRAM_DET_SEGMENTS,
 	  .meta.hubp_program_det_segments.allocate = true,
-	  .meta.skip_if.hubp_dpp_already_enabled = true },
+	  .meta.skip_if.det_unchanged = true },
 	/*
 	 * update_dchubp_dpp. First enable runs the whole table. A reconfigure
 	 * skips the steps that only bring the HUBP/DPP up, and programs the
@@ -2069,6 +2093,16 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
 	}
 }
 
+static bool dcn401_pipe_already_enabled(
+		const struct dcn401_commit_step_args *args)
+{
+	const struct pipe_ctx *cur =
+			&args->current_state->res_ctx.pipe_ctx[args->pipe->pipe_idx];
+
+	return cur->plane_state && cur->stream == args->pipe->stream &&
+			cur->plane_res.hubp == args->pipe->plane_res.hubp;
+}
+
 static bool dcn401_skip_step(const struct dcn401_commit_step_args *args,
 		const struct dcn401_commit_step *step)
 {
@@ -2087,10 +2121,12 @@ static bool dcn401_skip_step(const struct dcn401_commit_step_args *args,
 			!args->pipe->stream_res.opp->mpc_tree_params.opp_list))
 		return true;
 	if (step->meta.skip_if.hubp_dpp_already_enabled &&
-			dcn401_stream_index(args->current_state,
-			args->pipe->stream) >= 0 &&
-			args->current_state->stream_status[dcn401_stream_index(
-			args->current_state, args->pipe->stream)].plane_count)
+			dcn401_pipe_already_enabled(args))
+		return true;
+	if (step->meta.skip_if.det_unchanged &&
+			dcn401_pipe_already_enabled(args) &&
+			args->current_state->res_ctx.pipe_ctx[args->pipe->pipe_idx]
+			.hubp_regs.det_size == args->pipe->hubp_regs.det_size)
 		return true;
 	if (step->meta.skip_if.scaling_unchanged &&
 			!args->pipe->plane_state->update_bits.scaling_change &&
@@ -2223,9 +2259,9 @@ void dcn401_init_and_unpack_params(
 }
 
 /*
- * The updated stream only. skip_if drops first-enable steps when the
- * HUBP/DPP is already on, so a kept-plane surface update is the same
- * table. The enable_plane list runs per DPP pipe, top pipe first, so the
+ * The updated stream only. skip_if drops first-enable steps on a pipe
+ * that already showed its plane, so a kept-plane surface update is the
+ * same table. The enable_plane list runs per DPP pipe, top pipe first, so the
  * top MPCC is inserted before the bottom one.
  */
 static const struct dcn401_sub_sequence bls_update_head[] = {
-- 
2.43.0


  parent reply	other threads:[~2026-11-17 17:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 21:50 [PATCH 00/33] DC Patches November 23, 2026 James Lin
2026-11-16 21:50 ` [PATCH 01/33] drm/amd/display: Clear OTG_AUTO_FORCE_VSYNC_MODE on OTG disable James Lin
2026-11-16 21:50 ` [PATCH 02/33] drm/amd/display: Rename DPMS to DPMS_v1 James Lin
2026-11-16 21:50 ` [PATCH 03/33] drm/amd/display: Power up eDP when detect link James Lin
2026-11-16 21:50 ` [PATCH 04/33] drm/amd/display: Add DPMS-v2 files James Lin
2026-11-16 21:50 ` [PATCH 05/33] drm/amd/display: Refactor DP retrain link HW sequence James Lin
2026-11-16 21:50 ` [PATCH 06/33] drm/amd/display: add extra 0.25 line reserved for TSetup/TCalc inefficiency James Lin
2026-11-16 21:50 ` [PATCH 07/33] drm/amd/display: Use panel luminance range for AUX backlight in power module James Lin
2026-11-16 21:50 ` [PATCH 08/33] drm/amd/display: Read PWM back linearly with the linear backlight curve James Lin
2026-11-16 21:50 ` [PATCH 09/33] drm/amd/display: Add API to set brightness percent James Lin
2026-11-16 21:50 ` [PATCH 10/33] drm/amd/display: Pass linear brightness percent to power module James Lin
2026-11-16 21:50 ` [PATCH 11/33] drm/amd/display: Add DPMS-v2 types James Lin
2026-11-16 21:50 ` [PATCH 12/33] drm/amd/display: Always apply 0ppm pixel clock adjustment James Lin
2026-11-16 21:50 ` [PATCH 13/33] drm/amd/display: Add otg versions of get_vblank_counter/scanoutpos James Lin
2026-11-16 21:50 ` [PATCH 14/33] drm/amd/display: Queue vblank control work to sleepable context James Lin
2026-11-16 21:50 ` [PATCH 15/33] drm/amd/display: Fix KUnit tests for vblank control rework James Lin
2026-11-16 21:50 ` [PATCH 16/33] drm/amd/display: Add urgent request and assertion probes James Lin
2026-11-16 21:50 ` [PATCH 17/33] drm/amd/display: Fix G7 P-state aperture addresses James Lin
2026-11-16 21:50 ` [PATCH 18/33] drm/amd/display: Set stream min/max refresh from VRR config James Lin
2026-11-16 21:50 ` [PATCH 19/33] drm/amd/display: Add DC2 wrapped initialization for DCN401 James Lin
2026-11-16 21:50 ` [PATCH 20/33] drm/amd/display: Honor the Replay stream regeneration wait event James Lin
2026-11-16 21:50 ` [PATCH 21/33] drm/amd/display: Disable Replay when link off frame count is below 2 James Lin
2026-11-16 21:50 ` [PATCH 22/33] drm/amd/display: Skip DSC padding borrow estimate for zero padding James Lin
2026-11-16 21:51 ` [PATCH 23/33] drm/amd/display: Drop unused DC interfaces James Lin
2026-11-16 21:51 ` [PATCH 24/33] drm/amd/display: Let the DC2 commit replace or keep a stream James Lin
2026-11-16 21:51 ` [PATCH 25/33] drm/amd/display: Support two streams in the dcn401 DC2 builders James Lin
2026-11-16 21:51 ` James Lin [this message]
2026-11-16 21:51 ` [PATCH 27/33] drm/amd/display: Keep an unchanged stream in the DC2 commit James Lin
2026-11-16 21:51 ` [PATCH 28/33] drm/amd/display: Change the ODM and MPC layout in DC2 update James Lin
2026-11-16 21:51 ` [PATCH 29/33] drm/amd/display: Give the DC2 builders State pipe facts James Lin
2026-11-16 21:51 ` [PATCH 30/33] drm/amd/display: Add RGBA8888 surface pixel format support James Lin
2026-11-16 21:51 ` [PATCH 31/33] drm/amd/display: Fix DCE crossbar for RGBA8888 surface format James Lin
2026-11-16 21:51 ` [PATCH 32/33] drm/amd/display: [FW Promotion] Release 0.1.85.0 James Lin
2026-11-16 21:51 ` [PATCH 33/33] drm/amd/display: Promote DC to 3.2.408 James Lin

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=20261116215641.2800595-27-PingLei.Lin@amd.com \
    --to=pinglei.lin@amd.com \
    --cc=Chen-Yu.Chen@amd.com \
    --cc=Ray.Wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=ivan.lipski@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=roman.li@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=tony.cheng@amd.com \
    --cc=wayne.lin@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.