mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
igt/gem_userptr_blits: Test interruptible create-destroy
In order to exercise https://bugs.freedesktop.org/show_bug.cgi?id=84207 we need to interrupt the mmu_notifier_register with a signal. This is likely to be quite difficult, but let's just try running the create-destroy test in an interruptible loop for 5s. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
3e766b8255
commit
f2775039b1
@ -47,6 +47,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "drm.h"
|
||||
#include "i915_drm.h"
|
||||
@ -833,19 +834,32 @@ static int test_usage_restrictions(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_create_destroy(int fd)
|
||||
static int test_create_destroy(int fd, int time)
|
||||
{
|
||||
void *ptr;
|
||||
int ret;
|
||||
struct timespec start, now;
|
||||
uint32_t handle;
|
||||
void *ptr;
|
||||
int n;
|
||||
|
||||
igt_assert(posix_memalign(&ptr, PAGE_SIZE, PAGE_SIZE) == 0);
|
||||
igt_fork_signal_helper();
|
||||
|
||||
ret = gem_userptr(fd, ptr, PAGE_SIZE, 0, &handle);
|
||||
igt_assert(ret == 0);
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
do {
|
||||
for (n = 0; n < 1000; n++) {
|
||||
igt_assert(posix_memalign(&ptr, PAGE_SIZE, PAGE_SIZE) == 0);
|
||||
|
||||
gem_close(fd, handle);
|
||||
free(ptr);
|
||||
do_or_die(gem_userptr(fd, ptr, PAGE_SIZE, 0, &handle));
|
||||
|
||||
gem_close(fd, handle);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
now.tv_sec -= time;
|
||||
} while (now.tv_sec < start.tv_sec ||
|
||||
(now.tv_sec == start.tv_sec && now.tv_nsec < start.tv_nsec));
|
||||
|
||||
igt_stop_signal_helper();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1264,7 +1278,7 @@ int main(int argc, char **argv)
|
||||
gem_userptr_test_unsynchronized();
|
||||
|
||||
igt_subtest("create-destroy-unsync")
|
||||
test_create_destroy(fd);
|
||||
test_create_destroy(fd, 5);
|
||||
|
||||
igt_subtest("unsync-overlap")
|
||||
test_overlap(fd, 0);
|
||||
@ -1355,7 +1369,7 @@ int main(int argc, char **argv)
|
||||
test_process_exit(fd, PE_GTT_MAP | PE_BUSY);
|
||||
|
||||
igt_subtest("create-destroy-sync")
|
||||
test_create_destroy(fd);
|
||||
test_create_destroy(fd, 5);
|
||||
|
||||
igt_subtest("sync-overlap")
|
||||
test_overlap(fd, EINVAL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user