mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 01:16:18 +00:00
tests/pm_rpm: add disable_or_dpms_all_screens()
And its and_wait() version. The goal is to extract common code patterns into functions/macros, so the code for the test cases gets easier to read and write. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
This commit is contained in:
parent
1892059842
commit
5a978121d3
@ -240,6 +240,19 @@ static void disable_all_screens(struct mode_set_data *data)
|
||||
igt_assert(wait_for_suspended()); \
|
||||
} while (0)
|
||||
|
||||
static void disable_or_dpms_all_screens(struct mode_set_data *data, bool dpms)
|
||||
{
|
||||
if (dpms)
|
||||
disable_all_screens_dpms(&ms_data);
|
||||
else
|
||||
disable_all_screens(&ms_data);
|
||||
}
|
||||
|
||||
#define disable_or_dpms_all_screens_and_wait(data, dpms) do { \
|
||||
disable_or_dpms_all_screens((data), (dpms)); \
|
||||
igt_assert(wait_for_suspended()); \
|
||||
} while (0)
|
||||
|
||||
static struct scanout_fb *create_fb(struct mode_set_data *data, int width,
|
||||
int height)
|
||||
{
|
||||
@ -1445,11 +1458,7 @@ static void cursor_subtest(bool dpms)
|
||||
igt_assert(rc == 0);
|
||||
igt_assert(wait_for_active());
|
||||
|
||||
if (dpms)
|
||||
disable_all_screens_dpms(&ms_data);
|
||||
else
|
||||
disable_all_screens(&ms_data);
|
||||
igt_assert(wait_for_suspended());
|
||||
disable_or_dpms_all_screens_and_wait(&ms_data, dpms);
|
||||
|
||||
/* First, just move the cursor. */
|
||||
rc = drmModeMoveCursor(drm_fd, crtc_id, 1, 1);
|
||||
@ -1599,11 +1608,7 @@ static void test_one_plane(bool dpms, uint32_t plane_id,
|
||||
plane_fb1.height << 16);
|
||||
igt_assert(rc == 0);
|
||||
|
||||
if (dpms)
|
||||
disable_all_screens_dpms(&ms_data);
|
||||
else
|
||||
disable_all_screens(&ms_data);
|
||||
igt_assert(wait_for_suspended());
|
||||
disable_or_dpms_all_screens_and_wait(&ms_data, dpms);
|
||||
|
||||
/* Just move the plane around. */
|
||||
if (plane_type != PLANE_PRIMARY) {
|
||||
@ -1721,11 +1726,7 @@ static void fences_subtest(bool dpms)
|
||||
igt_assert(rc == 0);
|
||||
igt_assert(wait_for_active());
|
||||
|
||||
if (dpms)
|
||||
disable_all_screens_dpms(&ms_data);
|
||||
else
|
||||
disable_all_screens(&ms_data);
|
||||
igt_assert(wait_for_suspended());
|
||||
disable_or_dpms_all_screens_and_wait(&ms_data, dpms);
|
||||
|
||||
for (i = 0; i < scanout_fb.size/sizeof(uint32_t); i++)
|
||||
igt_assert_eq(buf_ptr[i], i);
|
||||
|
Loading…
x
Reference in New Issue
Block a user