mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
drm/amd/display: add KUnit tests for stutter quirk
[WHAT] Add KUnit tests for dm_should_disable_stutter covering a full quirk match, a non-matching device, and a partial match that differs only in the PCI revision. Assisted-by: Copilot:Claude-Opus-4.8 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
b01e10bd9f
commit
753f41b30f
|
|
@ -424,7 +424,7 @@ static const struct amdgpu_stutter_quirk amdgpu_stutter_quirk_list[] = {
|
|||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static bool dm_should_disable_stutter(struct pci_dev *pdev)
|
||||
STATIC_IFN_KUNIT bool dm_should_disable_stutter(struct pci_dev *pdev)
|
||||
{
|
||||
const struct amdgpu_stutter_quirk *p = amdgpu_stutter_quirk_list;
|
||||
|
||||
|
|
@ -440,6 +440,7 @@ static bool dm_should_disable_stutter(struct pci_dev *pdev)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
EXPORT_IF_KUNIT(dm_should_disable_stutter);
|
||||
|
||||
|
||||
void*
|
||||
|
|
|
|||
|
|
@ -1178,6 +1178,8 @@ bool is_dc_timing_adjust_needed(struct dm_crtc_state *old_state,
|
|||
struct dm_crtc_state *new_state);
|
||||
void set_multisync_trigger_params(struct dc_stream_state *stream);
|
||||
void set_master_stream(struct dc_stream_state *stream_set[], int stream_count);
|
||||
struct pci_dev;
|
||||
bool dm_should_disable_stutter(struct pci_dev *pdev);
|
||||
void reset_freesync_config_for_crtc(struct dm_crtc_state *new_crtc_state);
|
||||
void get_freesync_config_for_crtc(struct dm_crtc_state *new_crtc_state,
|
||||
struct dm_connector_state *new_con_state);
|
||||
|
|
|
|||
|
|
@ -1937,6 +1937,66 @@ static void dm_test_per_frame_master_sync_skips_null_stream(struct kunit *test)
|
|||
stream);
|
||||
}
|
||||
|
||||
/* Tests for dm_should_disable_stutter() */
|
||||
|
||||
/**
|
||||
* dm_test_should_disable_stutter_match - Test the quirk device matches
|
||||
* @test: The KUnit test context
|
||||
*/
|
||||
static void dm_test_should_disable_stutter_match(struct kunit *test)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
|
||||
pdev = kunit_kzalloc(test, sizeof(*pdev), GFP_KERNEL);
|
||||
KUNIT_ASSERT_NOT_NULL(test, pdev);
|
||||
|
||||
pdev->vendor = 0x1002;
|
||||
pdev->device = 0x15dd;
|
||||
pdev->subsystem_vendor = 0x1002;
|
||||
pdev->subsystem_device = 0x15dd;
|
||||
pdev->revision = 0xc8;
|
||||
|
||||
KUNIT_EXPECT_TRUE(test, dm_should_disable_stutter(pdev));
|
||||
}
|
||||
|
||||
/**
|
||||
* dm_test_should_disable_stutter_no_match - Test a non-quirk device does not match
|
||||
* @test: The KUnit test context
|
||||
*/
|
||||
static void dm_test_should_disable_stutter_no_match(struct kunit *test)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
|
||||
pdev = kunit_kzalloc(test, sizeof(*pdev), GFP_KERNEL);
|
||||
KUNIT_ASSERT_NOT_NULL(test, pdev);
|
||||
|
||||
pdev->vendor = 0x1002;
|
||||
pdev->device = 0x1234;
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, dm_should_disable_stutter(pdev));
|
||||
}
|
||||
|
||||
/**
|
||||
* dm_test_should_disable_stutter_revision_differs - Test a partial match (revision) fails
|
||||
* @test: The KUnit test context
|
||||
*/
|
||||
static void dm_test_should_disable_stutter_revision_differs(struct kunit *test)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
|
||||
pdev = kunit_kzalloc(test, sizeof(*pdev), GFP_KERNEL);
|
||||
KUNIT_ASSERT_NOT_NULL(test, pdev);
|
||||
|
||||
/* Everything matches the quirk except the revision */
|
||||
pdev->vendor = 0x1002;
|
||||
pdev->device = 0x15dd;
|
||||
pdev->subsystem_vendor = 0x1002;
|
||||
pdev->subsystem_device = 0x15dd;
|
||||
pdev->revision = 0x00;
|
||||
|
||||
KUNIT_EXPECT_FALSE(test, dm_should_disable_stutter(pdev));
|
||||
}
|
||||
|
||||
static struct kunit_case amdgpu_dm_tests[] = {
|
||||
/* Simple DM callbacks */
|
||||
KUNIT_CASE(dm_test_is_idle),
|
||||
|
|
@ -2042,6 +2102,10 @@ static struct kunit_case amdgpu_dm_tests[] = {
|
|||
KUNIT_CASE(dm_test_per_frame_master_sync_single_stream),
|
||||
KUNIT_CASE(dm_test_per_frame_master_sync_two_streams),
|
||||
KUNIT_CASE(dm_test_per_frame_master_sync_skips_null_stream),
|
||||
/* dm_should_disable_stutter */
|
||||
KUNIT_CASE(dm_test_should_disable_stutter_match),
|
||||
KUNIT_CASE(dm_test_should_disable_stutter_no_match),
|
||||
KUNIT_CASE(dm_test_should_disable_stutter_revision_differs),
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user