From: Alex Hung <alex.hung@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>,
Alvin Lee <Alvin.Lee2@amd.com>, Samson Tam <samson.tam@amd.com>
Subject: [PATCH 04/28] drm/amd/display: Add visual confirm full viewport debug option
Date: Tue, 27 Oct 2026 17:17:00 -0600 [thread overview]
Message-ID: <20261027232005.2879750-5-alex.hung@amd.com> (raw)
In-Reply-To: <20261027232005.2879750-1-alex.hung@amd.com>
From: Alvin Lee <Alvin.Lee2@amd.com>
[WHAT]
The visual confirm overlay shrinks the recout before the viewport is
derived from it, so the viewport shrinks too. The viewport then
programmed into hardware no longer matches the one DML calculated, since
DML sized the pipe for the full viewport. Keep the viewport full and
shrink only the recout used by the overlay. This is to avoid discrepency
between HW programming and DML calculations.
- Add visual_confirm_full_viewport to struct dc_debug_options.
- Derive the viewport from the full recout on the legacy and SPL paths.
- Shrink the recout for HW only after viewport derivation, including the
dscl_prog_data recout the SPL path programs.
Cc: Samson Tam <samson.tam@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
---
.../gpu/drm/amd/display/dc/core/dc_resource.c | 47 ++++++++++++++++---
drivers/gpu/drm/amd/display/dc/dc.h | 2 +
.../dc/resource/dcn60/dcn60_resource.c | 1 +
3 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index fa44c68b3340..832286f0c0b1 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1241,9 +1241,15 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx)
pipe_ctx->plane_res.scl_data.recout = shift_rec(
&overlapping_area,
-odm_slice_src.x, -odm_slice_src.y);
- adjust_recout_for_visual_confirm(
- &pipe_ctx->plane_res.scl_data.recout,
- pipe_ctx);
+ /* Non-SPL path: shrinking the recout here, before the viewport is
+ * derived from it, shrinks the viewport too (legacy behavior). To keep
+ * the HW viewport full, skip this and shrink the recout for HW only at
+ * the tail of resource_build_scaling_params.
+ */
+ if (!pipe_ctx->stream->ctx->dc->debug.visual_confirm_full_viewport)
+ adjust_recout_for_visual_confirm(
+ &pipe_ctx->plane_res.scl_data.recout,
+ pipe_ctx);
} else {
/* if there is no overlap, zero recout */
memset(&pipe_ctx->plane_res.scl_data.recout, 0,
@@ -1606,10 +1612,22 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
// Convert pipe_ctx to respective input params for SPL
translate_SPL_in_params_from_pipe_ctx(pipe_ctx, spl_in);
- /* Pass visual confirm debug information */
- calculate_adjust_recout_for_visual_confirm(pipe_ctx,
- &spl_in->debug.visual_confirm_base_offset,
- &spl_in->debug.visual_confirm_dpp_offset);
+ /* Pass visual confirm debug information. These offsets are SPL inputs:
+ * SPL subtracts them from the recout and then derives the viewport from
+ * that shrunk recout, so the viewport shrinks together with the recout.
+ */
+ if (pipe_ctx->stream->ctx->dc->debug.visual_confirm_full_viewport) {
+ /* pass 0 so SPL keeps both recout and viewport full; the recout is
+ * shrunk for HW only at the tail of this function
+ */
+ spl_in->debug.visual_confirm_base_offset = 0;
+ spl_in->debug.visual_confirm_dpp_offset = 0;
+ } else {
+ /* legacy: let SPL shrink both the recout and the viewport */
+ calculate_adjust_recout_for_visual_confirm(pipe_ctx,
+ &spl_in->debug.visual_confirm_base_offset,
+ &spl_in->debug.visual_confirm_dpp_offset);
+ }
// Set SPL output parameters to dscl_prog_data to be used for hw registers
spl_out->dscl_prog_data = resource_get_dscl_prog_data(pipe_ctx);
// Calculate scaler parameters from SPL
@@ -1723,6 +1741,21 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
#ifdef CONFIG_DRM_AMD_DC_FP
}
#endif
+ /* Common tail for both paths (legacy and SPL): the viewport has now been derived from the
+ * full recout, so shrink the recout for HW only. This runs only when
+ * keeping the viewport full; the legacy paths above already shrank the
+ * recout before the viewport was computed.
+ */
+ if (pipe_ctx->stream->ctx->dc->debug.visual_confirm_full_viewport) {
+ adjust_recout_for_visual_confirm(
+ &pipe_ctx->plane_res.scl_data.recout, pipe_ctx);
+ /* SPL programs the HW recout from dscl_prog_data, not scl_data.recout */
+ if (pipe_ctx->stream->ctx->dc->config.use_spl &&
+ !pipe_ctx->stream->ctx->dc->debug.disable_spl)
+ adjust_recout_for_visual_confirm((struct rect *)
+ &pipe_ctx->plane_res.scl_data.dscl_prog_data.recout,
+ pipe_ctx);
+ }
DC_LOG_SCALER("%s pipe %d:\nViewport: height:%d width:%d x:%d y:%d Recout: height:%d width:%d x:%d y:%d HACTIVE:%d VACTIVE:%d\n"
"src_rect: height:%d width:%d x:%d y:%d dst_rect: height:%d width:%d x:%d y:%d clip_rect: height:%d width:%d x:%d y:%d\n",
__func__,
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index d983bab7eea3..fa4c142ac271 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -1350,6 +1350,8 @@ struct dc_debug_options {
uint32_t dml21_custom_derate_at_dpm[DML2_MAX_NUM_DPM_LVL];
bool override_utm_client_qc_profile;
uint8_t utm_client_qc_profiles[4];
+ /* keep HW viewport unchanged by shrinking only recout for visual confirm */
+ bool visual_confirm_full_viewport;
};
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c
index 3b70e97c0a6a..f192c95952ab 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c
@@ -675,6 +675,7 @@ static const struct dc_debug_options debug_defaults_drv = {
}
},
.force_cositing = CHROMA_COSITING_NONE + 1,
+ .visual_confirm_full_viewport = true,
};
static const struct dc_check_config config_defaults = {
--
2.53.0
next prev parent reply other threads:[~2026-10-27 23:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 23:16 [PATCH 00/28] DC Patches Oct 27, 2026 Alex Hung
2026-10-27 23:16 ` [PATCH 01/28] drm/amd/display: Use DCN6 driver_if for PPCLK_e enum Alex Hung
2026-10-27 23:16 ` [PATCH 02/28] drm/amd/display: Allow bypassing link_off_frame_count check for replay debug mode Alex Hung
2026-10-27 23:16 ` [PATCH 03/28] drm/amd/display: Clarify endianness error Alex Hung
2026-10-27 23:17 ` Alex Hung [this message]
2026-10-27 23:17 ` [PATCH 05/28] drm/amd/display: Remove DCN401 RDPCS PHY state reads Alex Hung
2026-10-27 23:17 ` [PATCH 06/28] drm/amd/display: Adjust DSC slice calc. policy Alex Hung
2026-10-27 23:17 ` [PATCH 07/28] drm/amd/display: Configure alternate-channel apertures Alex Hung
2026-10-27 23:17 ` [PATCH 08/28] drm/amd/display: Avoid closing unowned DDC pins Alex Hung
2026-10-27 23:17 ` [PATCH 09/28] drm/amd/display: Support replay frame update interval Alex Hung
2026-10-27 23:17 ` [PATCH 10/28] drm/amd/display: Indicate wait_resp based on FAMS even in disable path Alex Hung
2026-10-27 23:17 ` [PATCH 11/28] drm/amd/display: Update Rounding For VM stage groups Alex Hung
2026-10-27 23:17 ` [PATCH 12/28] drm/amd/display: Fix unadvertised mode detection Alex Hung
2026-10-27 23:17 ` [PATCH 13/28] drm/amd/display: Parameterize FCLK/PPT/Temp Read P-State Optimizer Alex Hung
2026-10-27 23:17 ` [PATCH 14/28] drm/amd/display: Reset DET of HUBPs without a plane before outstanding updates Alex Hung
2026-10-27 23:17 ` [PATCH 15/28] drm/amd/display: Decouple FAMS2 config update from dc/dc_state and add BLS opcode Alex Hung
2026-10-27 23:17 ` [PATCH 16/28] drm/amd/display: Add missing OTG_CRC1 reg/mask entries for DCN3.1.4 Alex Hung
2026-10-27 23:17 ` [PATCH 17/28] drm/amd/display: Add missing OTG_CRC1 reg/mask entries for DCN3.1.2 Alex Hung
2026-10-27 23:17 ` [PATCH 18/28] drm/amd/display: Skip dsc sequence for stream if dpms off Alex Hung
2026-10-27 23:17 ` [PATCH 19/28] drm/amd/display: Add debugfs override for HDMI VRR Alex Hung
2026-10-27 23:17 ` [PATCH 20/28] drm/amd/display: Enable immediate restore for FAMS on DCN6 Alex Hung
2026-10-27 23:17 ` [PATCH 21/28] drm/amd/display: Expand DSCCLK support check Alex Hung
2026-10-27 23:17 ` [PATCH 22/28] drm/amd/display: Add more backlight Kunit tests Alex Hung
2026-10-27 23:17 ` [PATCH 23/28] drm/amd/display: Add more color KUnit tests Alex Hung
2026-10-27 23:17 ` [PATCH 24/28] drm/amd/display: Add more CRC " Alex Hung
2026-10-27 23:17 ` [PATCH 25/28] drm/amd/display: Add more connector " Alex Hung
2026-10-27 23:17 ` [PATCH 26/28] drm/amd/display: Update alt shared lib to use dynamic state Alex Hung
2026-10-27 23:17 ` [PATCH 27/28] drm/amd/display: [FW Promotion] Release 0.1.82.0 Alex Hung
2026-10-27 23:17 ` [PATCH 28/28] drm/amd/display: Promote DC to 3.2.405 Alex Hung
2026-10-30 15:42 ` [PATCH 00/28] DC Patches Oct 27, 2026 Leo Li
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=20261027232005.2879750-5-alex.hung@amd.com \
--to=alex.hung@amd.com \
--cc=Alvin.Lee2@amd.com \
--cc=Chen-Yu.Chen@amd.com \
--cc=PingLei.Lin@amd.com \
--cc=Ray.Wu@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=samson.tam@amd.com \
--cc=sunpeng.li@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.