From: Matthew Schwartz <matthew.schwartz@linux.dev>
To: amd-gfx@lists.freedesktop.org
Cc: Harry Wentland <harry.wentland@amd.com>,
Leo Li <sunpeng.li@amd.com>,
Rodrigo Siqueira <siqueira@igalia.com>,
Alex Deucher <alexander.deucher@amd.com>,
Ivan Lipski <ivan.lipski@amd.com>,
Fangzhi Zuo <jerry.zuo@amd.com>,
Aurabindo Pillai <aurabindo.pillai@amd.com>,
Pei-Hsin Yang <peihsiny@valvesoftware.com>,
Matthew Schwartz <matthew.schwartz@linux.dev>
Subject: [PATCH 2/2] drm/amd/display: Test VRR vtotal limits across a modeset
Date: Wed, 25 Nov 2026 21:36:06 -0800 [thread overview]
Message-ID: <20261126053606.12286-3-matthew.schwartz@linux.dev> (raw)
In-Reply-To: <20261126053606.12286-1-matthew.schwartz@linux.dev>
Check that amdgpu_dm_update_stream_irq_parameters() replaces saved
vtotal limits with the new timing's on a modeset, and keeps them on a
commit that is not one.
Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
---
.../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c
index a2b13de2e9e9..ab8931a4d0dd 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c
@@ -916,6 +916,56 @@ static void dm_test_update_stream_irq_parameters_fixed(struct kunit *test)
60000000U);
}
+static void dm_test_update_stream_irq_parameters_stale(struct kunit *test, bool modeset)
+{
+ struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+ struct amdgpu_crtc *acrtc;
+ struct dm_crtc_state crtc_state = { 0 };
+ struct mod_vrr_params *vrr_params;
+
+ acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, acrtc);
+ crtc_state.base.crtc = &acrtc->base;
+ crtc_state.base.vrr_enabled = true;
+ crtc_state.base.mode_changed = modeset;
+ crtc_state.stream = dm_kunit_alloc_stream(test, NULL);
+ crtc_state.stream->timing.h_total = 4400;
+ crtc_state.stream->timing.v_total = 2250;
+ crtc_state.vrr_supported = true;
+ crtc_state.freesync_config.min_refresh_in_uhz = 40000000;
+ crtc_state.freesync_config.max_refresh_in_uhz = 60000000;
+ adev->dm.adev = adev;
+
+ /* Limits of a 1080p60 timing with a 40-60 Hz range */
+ vrr_params = &acrtc->dm_irq_params.vrr_params;
+ vrr_params->state = VRR_STATE_ACTIVE_VARIABLE;
+ vrr_params->adjust.v_total_min = 1125;
+ vrr_params->adjust.v_total_max = 1687;
+
+ amdgpu_dm_update_stream_irq_parameters(&adev->dm, &crtc_state);
+
+ KUNIT_EXPECT_EQ(test, vrr_params->adjust.v_total_min, modeset ? 2250U : 1125U);
+ KUNIT_EXPECT_EQ(test, vrr_params->adjust.v_total_max, modeset ? 2250U : 1687U);
+}
+
+/**
+ * dm_test_update_stream_irq_parameters_modeset - Test a modeset drops the saved vtotal limits
+ * @test: The KUnit test context
+ */
+static void dm_test_update_stream_irq_parameters_modeset(struct kunit *test)
+{
+ dm_test_update_stream_irq_parameters_stale(test, true);
+}
+
+/**
+ * dm_test_update_stream_irq_parameters_no_modeset - Test saved vtotal limits survive a flip
+ * @test: The KUnit test context
+ */
+static void dm_test_update_stream_irq_parameters_no_modeset(struct kunit *test)
+{
+ dm_test_update_stream_irq_parameters_stale(test, false);
+}
+
/* Tests for amdgpu_dm_handle_vrr_transition() */
/**
@@ -1118,6 +1168,8 @@ static struct kunit_case amdgpu_dm_freesync_tests[] = {
KUNIT_CASE(dm_test_update_stream_irq_parameters_variable),
KUNIT_CASE(dm_test_update_stream_irq_parameters_inactive),
KUNIT_CASE(dm_test_update_stream_irq_parameters_fixed),
+ KUNIT_CASE(dm_test_update_stream_irq_parameters_modeset),
+ KUNIT_CASE(dm_test_update_stream_irq_parameters_no_modeset),
/* amdgpu_dm_handle_vrr_transition */
KUNIT_CASE(dm_test_handle_vrr_transition_inactive),
KUNIT_CASE(dm_test_handle_vrr_transition_round_trip),
--
2.54.0 (Apple Git-157)
prev parent reply other threads:[~2026-11-26 8:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 5:36 [PATCH 0/2] drm/amd/display: Rebuild the VRR vtotal limits on a modeset Matthew Schwartz
2026-11-26 5:36 ` [PATCH 1/2] " Matthew Schwartz
2026-11-26 8:26 ` sashiko-bot
2026-11-26 5:36 ` Matthew Schwartz [this message]
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=20261126053606.12286-3-matthew.schwartz@linux.dev \
--to=matthew.schwartz@linux.dev \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=harry.wentland@amd.com \
--cc=ivan.lipski@amd.com \
--cc=jerry.zuo@amd.com \
--cc=peihsiny@valvesoftware.com \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox