summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/amdgpu_dm/tests
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2026-09-18 11:43:54 +1000
committerDave Airlie <airlied@redhat.com>2026-09-18 11:58:41 +1000
commit762a482b8615e4ce5672ae2b49359ddc51f4072d (patch)
tree8afe0e74e8d9bb248d7c85d8043d2882d3ddd8cb /drivers/gpu/drm/amd/display/amdgpu_dm/tests
parent2446a767ffacee0d247db932621cd4b165ad721a (diff)
parenta8fe4e162ba8212b7e51fdb024b37800f36b496c (diff)
downloadlinux-next-762a482b8615e4ce5672ae2b49359ddc51f4072d.tar.gz
linux-next-762a482b8615e4ce5672ae2b49359ddc51f4072d.zip
Merge tag 'drm-misc-next-2026-09-17' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
drm-misc-next for v7.4: UAPI Changes: ivpu: - add DRM_IVPU_CAP_CMDQ_SET_PRIORITY Cross-subsystem Changes: dma-fence: - fix documentation vga_switcheroo: - disconnect from fbcon; update fbcon from within DRM fbdev emulation Core Changes: atomic: - replace state reset callback with create_state throughout DRM core and drivers panic: - split into core and helpers sched: - clean up interface sysfs: - drop drm_class_device_register() Driver Changes: amdxdna: - fix BO handling arcpgu: - replace simple-display pipeline with regular atomic helpers aspeed: - replace simple-display pipeline with regular atomic helpers gm12u320: - replace simple-display pipeline with regular atomic helpers imagination: - various improvement to firmware interaction ivpu: - support command-queue priority ioctl mcde: - replace simple-display pipeline with regular atomic helpers p111: - replace simple-display pipeline with regular atomic helpers - drop unsupported alpha formats from primary plane panel: - edp: Add support for BOE NV140FHM-T0A - samsung: Share test-key helpers rcar-du: - support Renesas R-Car V4H DSC - dsi: Support larger transfers with AXI memory repaper: - replace simple-display pipeline with regular atomic helpers rockchip: - dsi: improve PHY timings ssd130x: - support Solomon SSD1351 OLED plus DT bindings - ssd133x: upgrade color format to RGB565 tve200: - replace simple-display pipeline with regular atomic helpers xen: - replace simple-display pipeline with regular atomic helpers Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/20260917090534.GA420415@2a02-2455-9062-2500-ec39-e8a6-193-9c05.dyn6.pyur.net
Diffstat (limited to 'drivers/gpu/drm/amd/display/amdgpu_dm/tests')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c24
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c30
2 files changed, 22 insertions, 32 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
index bc2b115b48b0..9b15f53a9c62 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
@@ -1604,18 +1604,18 @@ static void dm_test_crtc_destroy_cleans_up_and_frees(struct kunit *test)
KUNIT_EXPECT_EQ(test, adev->ddev.mode_config.num_crtc, 0);
}
-/* Tests for amdgpu_dm_crtc_reset_state() */
+/* Tests for amdgpu_dm_crtc_create_state() */
/**
- * dm_test_crtc_reset_state_allocates_state - Test reset installs a fresh state
+ * dm_test_crtc_create_state_allocates_state - Test create_state allocates a fresh state
* @test: The KUnit test context
*
- * Resetting a CRTC with no existing state must allocate and install a new
- * drm_crtc_state.
+ * Creating state for a CRTC must allocate a new drm_crtc_state.
*/
-static void dm_test_crtc_reset_state_allocates_state(struct kunit *test)
+static void dm_test_crtc_create_state_allocates_state(struct kunit *test)
{
struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+ struct drm_crtc_state *crtc_state;
struct drm_crtc *crtc;
crtc = kunit_kzalloc(test, sizeof(*crtc), GFP_KERNEL);
@@ -1623,12 +1623,11 @@ static void dm_test_crtc_reset_state_allocates_state(struct kunit *test)
crtc->dev = &adev->ddev;
crtc->state = NULL;
- amdgpu_dm_crtc_reset_state(crtc);
-
- KUNIT_EXPECT_NOT_NULL(test, crtc->state);
+ crtc_state = amdgpu_dm_crtc_create_state(crtc);
+ KUNIT_EXPECT_NOT_ERR_OR_NULL(test, crtc_state);
- if (crtc->state)
- amdgpu_dm_crtc_destroy_state(crtc, crtc->state);
+ if (!IS_ERR(crtc_state))
+ amdgpu_dm_crtc_destroy_state(crtc, crtc_state);
}
/**
@@ -2638,9 +2637,8 @@ static struct kunit_case amdgpu_dm_crtc_tests[] = {
KUNIT_CASE(dm_test_crtc_duplicate_state_null_state_returns_null),
/* amdgpu_dm_crtc_destroy */
KUNIT_CASE(dm_test_crtc_destroy_cleans_up_and_frees),
- /* amdgpu_dm_crtc_reset_state */
- KUNIT_CASE(dm_test_crtc_reset_state_allocates_state),
- KUNIT_CASE(dm_test_crtc_reset_state_replaces_existing),
+ /* amdgpu_dm_crtc_create_state */
+ KUNIT_CASE(dm_test_crtc_create_state_allocates_state),
/* amdgpu_dm_crtc_destroy_state */
KUNIT_CASE(dm_test_crtc_destroy_state_no_stream),
KUNIT_CASE(dm_test_crtc_destroy_state_releases_stream),
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
index 5ae627bb55cc..1b0d3f16ef1a 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
@@ -2937,36 +2937,28 @@ static const struct drm_plane_funcs dm_test_plane_reset_funcs = {
};
/**
- * dm_test_plane_reset_initializes_state() - Verify reset installs default state.
+ * dm_test_plane_create_state_initializes_state() - Verify create_state allocates default state.
* @test: KUnit test context.
*
- * Verify amdgpu_dm_plane_drm_plane_reset() destroys the existing plane state,
- * allocates a fresh dm_plane_state, and initializes the AMD-specific transfer
- * function and HDR multiplier defaults.
+ * Verify amdgpu_dm_plane_drm_plane_create_state() allocates a fresh
+ * dm_plane_state, and initializes the AMD-specific transfer function and HDR
+ * multiplier defaults.
*/
-static void dm_test_plane_reset_initializes_state(struct kunit *test)
+static void dm_test_plane_create_state_initializes_state(struct kunit *test)
{
- struct dm_plane_state *old_state;
+ struct drm_plane_state *plane_state;
struct dm_plane_state *new_state;
struct drm_plane *plane;
plane = kunit_kzalloc(test, sizeof(*plane), GFP_KERNEL);
KUNIT_ASSERT_NOT_NULL(test, plane);
- /*
- * Provide an existing state plus a funcs table so reset exercises the
- * destroy-existing-state path. The destroy hook frees this state, so it
- * must be a plain (non-KUnit-managed) allocation.
- */
- old_state = kzalloc_obj(*old_state);
- KUNIT_ASSERT_NOT_NULL(test, old_state);
plane->funcs = &dm_test_plane_reset_funcs;
- plane->state = &old_state->base;
- amdgpu_dm_plane_drm_plane_reset(plane);
+ plane_state = amdgpu_dm_plane_drm_plane_create_state(plane);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane_state);
- KUNIT_ASSERT_NOT_NULL(test, plane->state);
- new_state = to_dm_plane_state(plane->state);
+ new_state = to_dm_plane_state(plane_state);
KUNIT_EXPECT_EQ(test, new_state->degamma_tf, AMDGPU_TRANSFER_FUNCTION_DEFAULT);
KUNIT_EXPECT_EQ(test, new_state->hdr_mult, AMDGPU_HDR_MULT_DEFAULT);
KUNIT_EXPECT_EQ(test, new_state->shaper_tf, AMDGPU_TRANSFER_FUNCTION_DEFAULT);
@@ -3765,8 +3757,8 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {
KUNIT_CASE(dm_test_atomic_check_scaling_failure),
/* amdgpu_dm_plane_panic_flush() */
KUNIT_CASE(dm_test_panic_flush_no_dc_state),
- /* amdgpu_dm_plane_drm_plane_reset() */
- KUNIT_CASE(dm_test_plane_reset_initializes_state),
+ /* amdgpu_dm_plane_drm_plane_create_state() */
+ KUNIT_CASE(dm_test_plane_create_state_initializes_state),
/* amdgpu_dm_plane_drm_plane_duplicate_state() */
KUNIT_CASE(dm_test_plane_duplicate_state_copies_fields),
KUNIT_CASE(dm_test_plane_duplicate_state_copies_resources),