diff options
| author | Tom Chung <chiahsuan.chung@amd.com> | 2026-08-07 13:22:03 +0800 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-08-25 18:25:26 -0400 |
| commit | 22183b73a08eaa79bf451a1718138e76afa38958 (patch) | |
| tree | b13366fc42685490b52513eace839f336e4ed4dc | |
| parent | d24695f377379061842ee4d59a8c5c3b92f34aa7 (diff) | |
| download | linux-next-22183b73a08eaa79bf451a1718138e76afa38958.tar.gz linux-next-22183b73a08eaa79bf451a1718138e76afa38958.zip | |
drm/amd/display: test native cursor mode on a disabled CRTC
[why]
Upstream has no KUnit coverage for amdgpu_dm_crtc_get_cursor_mode(),
which is why the fix in the previous commit came with no test. The
disabled-CRTC path is easy to regress again: it has already been lost
once to a refactor.
[how]
Add a test whose plane setup would otherwise select overlay mode, and
check that a disabled CRTC still reports native mode. Reverting the
previous commit makes only this test fail.
Reviewed-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: James Lin <pinglei.lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
| -rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c index f085eb1a616d..30fbacce0094 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c @@ -499,6 +499,27 @@ static void dm_test_plane_color_pipeline_ignores_other_plane(struct kunit *test) /* Tests for amdgpu_dm_crtc_get_cursor_mode() */ /** + * dm_test_crtc_get_cursor_mode_disabled_crtc - Test a disabled CRTC uses native cursor + * @test: The KUnit test context + * + * A disabled CRTC must report native mode regardless of what the planes look + * like, so that a commit disabling the CRTC is not rejected. The plane setup + * here would otherwise select overlay mode. + */ +static void dm_test_crtc_get_cursor_mode_disabled_crtc(struct kunit *test) +{ + struct dm_cursor_mode_fixture fixture = dm_test_alloc_cursor_mode_fixture(test); + enum amdgpu_dm_cursor_mode cursor_mode = DM_CURSOR_OVERLAY_MODE; + + fixture.dm_crtc_state->base.enable = false; + fixture.old_primary_state->crtc_w = 1280; + fixture.primary_state->crtc_w = 1280; + + KUNIT_EXPECT_EQ(test, dm_test_get_cursor_mode(&fixture, &cursor_mode), 0); + KUNIT_EXPECT_EQ(test, cursor_mode, DM_CURSOR_NATIVE_MODE); +} + +/** * dm_test_crtc_get_cursor_mode_new_hardware - Test new hardware always uses native mode * @test: The KUnit test context */ @@ -923,6 +944,7 @@ static struct kunit_case amdgpu_dm_cursor_tests[] = { KUNIT_CASE(dm_test_plane_color_pipeline_active), KUNIT_CASE(dm_test_plane_color_pipeline_ignores_other_plane), /* amdgpu_dm_crtc_get_cursor_mode */ + KUNIT_CASE(dm_test_crtc_get_cursor_mode_disabled_crtc), KUNIT_CASE(dm_test_crtc_get_cursor_mode_new_hardware), KUNIT_CASE(dm_test_crtc_get_cursor_mode_no_change), KUNIT_CASE(dm_test_crtc_get_cursor_mode_disabled_cursor), |
