From: Tom Chung <[email protected]>

[why]
The CRTC state in the amdgpu_dm_crtc_get_cursor_mode() tests is
zero-initialised, so base.enable is false in all of them. Nothing in the
function reads it today, so they pass, but they are not describing the
case they mean to describe: each one is meant to exercise an enabled CRTC
driving real planes.

[how]
Set base.enable in the shared fixture, and in the no_change test which
builds its own CRTC state instead of using the fixture. No functional
change, since the function does not look at base.enable yet.

Reviewed-by: Wayne Lin <[email protected]>
Signed-off-by: Tom Chung <[email protected]>
Signed-off-by: James Lin <[email protected]>
---
 .../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c | 2 ++
 1 file changed, 2 insertions(+)

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..9e76dfa887ea 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
@@ -147,6 +147,7 @@ static struct dm_cursor_mode_fixture 
dm_test_alloc_cursor_mode_fixture(struct ku
        fixture.state->planes[1].old_state = fixture.old_primary_state;
        fixture.state->planes[1].new_state = fixture.primary_state;
        fixture.dm_crtc_state->base.crtc = fixture.crtc;
+       fixture.dm_crtc_state->base.enable = true;
        fixture.dm_crtc_state->base.plane_mask = drm_plane_mask(fixture.cursor) 
|
                                                 
drm_plane_mask(fixture.primary);
        fixture.dm_crtc_state->base.zpos_changed = true;
@@ -535,6 +536,7 @@ static void dm_test_crtc_get_cursor_mode_no_change(struct 
kunit *test)
        dm_crtc_state = kunit_kzalloc(test, sizeof(*dm_crtc_state), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, dm_crtc_state);
        state->dev = &adev->ddev;
+       dm_crtc_state->base.enable = true;
        dm_crtc_state->cursor_mode = DM_CURSOR_OVERLAY_MODE;
 
        ret = amdgpu_dm_crtc_get_cursor_mode(adev, state, dm_crtc_state, 
&cursor_mode);
-- 
2.43.0

Reply via email to