[PATCH i-g-t] [i-g-t] tests/kms_cursor_legacy: Restructure cursor_vs_flip
Vidya Srinivas
vidya.srinivas at intel.com
Fri Jan 12 09:50:41 UTC 2024
Current code causes reboot issues on some devices during
execution of cursor_vs_flip. Change the code structure
similar to flip_vs_cursor
Signed-off-by: Vidya Srinivas <vidya.srinivas at intel.com>
---
tests/kms_cursor_legacy.c | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 0017659d4..962b2b38b 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1345,19 +1345,18 @@ static void cursor_vs_flip(igt_display_t *display, enum flip_test mode, int nloo
struct igt_fb fb_info, cursor_fb, cursor_fb2, argb_fb;
unsigned vblank_start, vblank_last;
volatile unsigned long *shared;
- long target;
+ int target, cpu;
enum pipe pipe;
igt_output_t *output;
uint32_t vrefresh;
int fail_count;
igt_plane_t *cursor;
+ cpu_set_t mask, oldmask;
+ unsigned long count = 0;
if (mode >= flip_test_atomic)
igt_require(display->is_atomic);
- shared = mmap(NULL, PAGE_SIZE, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
- igt_assert(shared != MAP_FAILED);
-
pipe = find_connected_pipe(display, false, &output);
igt_require(output);
@@ -1376,19 +1375,37 @@ static void cursor_vs_flip(igt_display_t *display, enum flip_test mode, int nloo
igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
- target = get_cursor_updates_per_vblank(display, pipe, &arg[0]);
+ if (nloops)
+ target = get_cursor_updates_per_vblank(display, pipe, &arg[0]);
+ else
+ target = 1;
fail_count = 0;
for (int i = 0; i < nloops; i++) {
+ shared = mmap(NULL, PAGE_SIZE, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+ igt_assert(shared != MAP_FAILED);
+ cpu = sched_getcpu();
+ igt_assert(cpu >= 0);
+
+ CPU_ZERO(&mask);
+ CPU_SET(cpu, &mask);
+ sched_getaffinity(0, sizeof(oldmask), &oldmask);
+ sched_setaffinity(0, sizeof(mask), &mask);
+
shared[0] = 0;
+
igt_fork(child, 1) {
- unsigned long count = 0;
+ struct sched_param parm = { .sched_priority = 0 };
+
+ igt_assert(sched_setscheduler(0, SCHED_IDLE, &parm) == 0);
+
while (!shared[0]) {
do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[i & 1]);
+ sched_yield();
+ igt_debug("child: %lu cursor updates\n", count);
count++;
}
- igt_debug("child: %lu cursor updates\n", count);
shared[0] = count;
}
@@ -1428,6 +1445,8 @@ static void cursor_vs_flip(igt_display_t *display, enum flip_test mode, int nloo
shared[0], vrefresh / 2,
vrefresh*target, vrefresh*target / 2);
}
+ munmap((void *)shared, PAGE_SIZE);
+ sched_setaffinity(0, sizeof(oldmask), &oldmask);
}
igt_assert_f(fail_count == 0,
@@ -1443,7 +1462,6 @@ static void cursor_vs_flip(igt_display_t *display, enum flip_test mode, int nloo
igt_remove_fb(display->drm_fd, &fb_info);
igt_remove_fb(display->drm_fd, &cursor_fb);
- munmap((void *)shared, PAGE_SIZE);
if (argb_fb.gem_handle)
igt_remove_fb(display->drm_fd, &argb_fb);
if (cursor_fb2.gem_handle)
--
2.33.0
More information about the Intel-gfx-trybot
mailing list