All of lore.kernel.org
 help / color / mirror / Atom feed
From: <Roman.Li@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
	Leo Li <sunpeng.li@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>
Subject: [PATCH 16/17] drm/amd/display: Send HDMI VRR metadata in VTEM info packet slot
Date: Fri, 2 Oct 2026 15:32:39 -0400	[thread overview]
Message-ID: <20261002193240.3441018-17-Roman.Li@amd.com> (raw)
In-Reply-To: <20261002193240.3441018-1-Roman.Li@amd.com>

From: Ivan Lipski <ivan.lipski@amd.com>

[Why]
Brief blank on HDMI each time VRR engaged and disengaged, with no modeset
at either transition.

amdgpu_dm_update_freesync_state_on_stream() built the VTEM on top of the
buffer holding the AMD FreeSync SPD payload, which becomes
stream->vrr_infopacket. DC routes that to HDMI generic slot 3 (SPD) and
vtem_infopacket to slot 6 (VTEM), and vtem_infopacket was never populated.
So slot 3 carried a VTEM payload the sink parsed as an SPD
InfoFrame, no VTEM was sent, and v_total varied with no valid metadata
describing it. DP uses the VSC/AS-SDP path and is unaffected.

[How]
Build the VTEM into a separate vtem_infopacket, gated on the sink not
advertising AMD FreeSync. Track it in dm_crtc_state, include it in the
freesync_vrr_info_changed comparison and the reset path, and pass it
through bundle->stream_update.vtem_infopacket.

Reviewed-by: Jerry Zuo <jerry.zuo@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  1 +
 .../display/amdgpu_dm/amdgpu_dm_freesync.c    | 26 +++++++++++++++----
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 6e5dbe0bd82e..f3ed3fef59f9 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4141,6 +4141,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state,
 			if (acrtc_state->freesync_vrr_info_changed) {
 				bundle->stream_update.vrr_infopacket =
 					&acrtc_state->stream->vrr_infopacket;
+				bundle->stream_update.vtem_infopacket =
+					&acrtc_state->stream->vtem_infopacket;
 				bundle->stream_update.vsp_infopacket =
 					&acrtc_state->stream->vsp_infopacket;
 				stream_update_needed = true;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 2ead9bc8e439..594d275918d5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -1076,6 +1076,7 @@ struct dm_crtc_state {
 	bool vrr_supported;
 	struct mod_freesync_config freesync_config;
 	struct dc_info_packet vrr_infopacket;
+	struct dc_info_packet vtem_infopacket;
 
 	int abm_level;
 
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c
index 1d9148ccfd4f..f4ce389fd0aa 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c
@@ -107,6 +107,8 @@ void amdgpu_dm_reset_freesync_config_for_crtc(
 
 	memset(&new_crtc_state->vrr_infopacket, 0,
 	       sizeof(new_crtc_state->vrr_infopacket));
+	memset(&new_crtc_state->vtem_infopacket, 0,
+	       sizeof(new_crtc_state->vtem_infopacket));
 }
 EXPORT_SYMBOL_IF_KUNIT(amdgpu_dm_reset_freesync_config_for_crtc);
 
@@ -172,6 +174,7 @@ void amdgpu_dm_update_freesync_state_on_stream(
 {
 	struct mod_vrr_params vrr_params;
 	struct dc_info_packet vrr_infopacket = {0};
+	struct dc_info_packet vtem_infopacket = {0};
 	struct amdgpu_device *adev = dm->adev;
 	struct amdgpu_crtc *acrtc = to_amdgpu_crtc(new_crtc_state->base.crtc);
 	unsigned long flags;
@@ -238,21 +241,34 @@ void amdgpu_dm_update_freesync_state_on_stream(
 		&vrr_infopacket,
 		pack_sdp_v1_3);
 
-	/* Per HDMI 2.1, VTEM is valid on TMDS as well as FRL */
-	if (new_stream->signal == SIGNAL_TYPE_HDMI_FRL ||
-	    (new_stream->signal == SIGNAL_TYPE_HDMI_TYPE_A &&
-	     aconn && aconn->base.display_info.hdmi.vrr_cap.supported))
-		mod_build_infopacket_vtem(new_stream, &vrr_params, 0, &vrr_infopacket);
+	/*
+	 * If the sink does not support FreeSync, but it does support VRR,
+	 * we need to build a VTEM packet to enable VRR.
+	 */
+	if (aconn && !aconn->vsdb_info.freesync_supported &&
+	    aconn->base.display_info.hdmi.vrr_cap.supported &&
+	    (new_stream->signal == SIGNAL_TYPE_HDMI_FRL ||
+	     new_stream->signal == SIGNAL_TYPE_HDMI_TYPE_A)) {
+		mod_build_infopacket_vtem(new_stream, &vrr_params, 0, &vtem_infopacket);
+		memset(&vrr_infopacket, 0, sizeof(vrr_infopacket));
+	}
 
 	new_crtc_state->freesync_vrr_info_changed |=
 		(memcmp(&new_crtc_state->vrr_infopacket,
 			&vrr_infopacket,
 			sizeof(vrr_infopacket)) != 0);
 
+	new_crtc_state->freesync_vrr_info_changed |=
+		(memcmp(&new_crtc_state->vtem_infopacket,
+			&vtem_infopacket,
+			sizeof(vtem_infopacket)) != 0);
+
 	acrtc->dm_irq_params.vrr_params = vrr_params;
 	new_crtc_state->vrr_infopacket = vrr_infopacket;
+	new_crtc_state->vtem_infopacket = vtem_infopacket;
 
 	new_stream->vrr_infopacket = vrr_infopacket;
+	new_stream->vtem_infopacket = vtem_infopacket;
 	new_stream->allow_freesync = mod_freesync_get_freesync_enabled(&vrr_params);
 
 	/*
-- 
2.34.1


  parent reply	other threads:[~2026-10-02 19:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 19:32 [PATCH 00/17] DC Patches October 2, 2026 Roman.Li
2026-10-02 19:32 ` [PATCH 01/17] drm/amd/display: enable shaper when programming 3DLUT Roman.Li
2026-10-02 19:32 ` [PATCH 02/17] drm/amd/display: log MCM shaper and 3D LUT mode in the DTN log Roman.Li
2026-10-02 19:32 ` [PATCH 03/17] drm/amd/display: only reprogram DRR when v_total values change Roman.Li
2026-10-20  0:37   ` Bruno
2026-10-02 19:32 ` [PATCH 04/17] drm/amd/display: Add HDMI RR and SCDC skips Roman.Li
2026-10-02 19:32 ` [PATCH 05/17] drm/amd/display: Set cursor_offload for all pipes for a given stream Roman.Li
2026-10-02 19:32 ` [PATCH 06/17] drm/amd/display: Refactor DMUB fast lock sequencing Roman.Li
2026-10-20 13:22   ` Melissa Wen
2026-10-02 19:32 ` [PATCH 07/17] drm/amd/display: Skip link off frame count for general UI Roman.Li
2026-10-02 19:32 ` [PATCH 08/17] drm/amd/display: allow skipping link bandwidth clear Roman.Li
2026-10-02 19:32 ` [PATCH 09/17] drm/amd/display: Prepare DSC configuration before BLS execution Roman.Li
2026-10-02 19:32 ` [PATCH 10/17] drm/amd/display: Assign alt wa bit in fams2 cmd Roman.Li
2026-10-02 19:32 ` [PATCH 11/17] drm/amd/display: Update link training no timeout behaviour on HDMI Roman.Li
2026-10-02 19:32 ` [PATCH 12/17] drm/amd/display: Revert "avoid to write signal specific for tmds" Roman.Li
2026-10-02 19:32 ` [PATCH 13/17] drm/amd/display: Handle virtual link encoder Roman.Li
2026-10-02 19:32 ` [PATCH 14/17] drm/amd/display: Add dcn42b project id Roman.Li
2026-10-02 19:32 ` [PATCH 15/17] drm/amd/display: Add debug option to override low power SR latencies Roman.Li
2026-10-02 19:32 ` Roman.Li [this message]
2026-10-02 19:32 ` [PATCH 17/17] drm/amd/display: Promote DC to 3.2.401 Roman.Li
2026-10-05 13:30 ` [PATCH 00/17] DC Patches October 2, 2026 Wheeler, Daniel

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=20261002193240.3441018-17-Roman.Li@amd.com \
    --to=roman.li@amd.com \
    --cc=Chen-Yu.Chen@amd.com \
    --cc=PingLei.Lin@amd.com \
    --cc=Ray.Wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --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=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.