summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/igt_rand.c8
-rw-r--r--lib/igt_rand.h1
-rw-r--r--tests/i915/gem_pwrite.c43
-rw-r--r--tests/intel-ci/blacklist.txt1
4 files changed, 52 insertions, 1 deletions
diff --git a/lib/igt_rand.c b/lib/igt_rand.c
index 664a4764..16a6ba9b 100644
--- a/lib/igt_rand.c
+++ b/lib/igt_rand.c
@@ -23,6 +23,14 @@ uint32_t hars_petruska_f54_1_random(uint32_t *s)
#undef rol
}
+uint64_t hars_petruska_f54_1_random64(uint32_t *s)
+{
+ uint32_t l = hars_petruska_f54_1_random(s);
+ uint32_t h = hars_petruska_f54_1_random(s);
+
+ return (uint64_t)h << 32 | l;
+}
+
uint32_t hars_petruska_f54_1_random_unsafe(void)
{
return hars_petruska_f54_1_random(&global);
diff --git a/lib/igt_rand.h b/lib/igt_rand.h
index c9cb3243..00156804 100644
--- a/lib/igt_rand.h
+++ b/lib/igt_rand.h
@@ -27,6 +27,7 @@
#include <stdint.h>
uint32_t hars_petruska_f54_1_random(uint32_t *state);
+uint64_t hars_petruska_f54_1_random64(uint32_t *s);
uint32_t hars_petruska_f54_1_random_seed(uint32_t seed);
uint32_t hars_petruska_f54_1_random_unsafe(void);
diff --git a/tests/i915/gem_pwrite.c b/tests/i915/gem_pwrite.c
index 69f823d5..20e9728b 100644
--- a/tests/i915/gem_pwrite.c
+++ b/tests/i915/gem_pwrite.c
@@ -25,7 +25,6 @@
*
*/
-#include "igt.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
@@ -37,8 +36,12 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+
#include "drm.h"
+#include "igt.h"
+#include "igt_rand.h"
+
#define MiB(x) ((x) * 1024 * 1024)
typedef void *(*mmap_fn_t)(int, uint32_t, uint64_t, uint64_t, unsigned int);
@@ -238,6 +241,41 @@ static void test_big_gtt(int fd, int scale, unsigned flags)
gem_close(fd, handle);
}
+static void test_random(int fd)
+{
+ uint32_t prng = 0xdeadbeef;
+ unsigned long count;
+ uint32_t handle;
+ uint64_t *map;
+ uint64_t size;
+
+ gem_require_mmap_wc(fd);
+
+ size = min(intel_get_total_ram_mb() / 2,
+ gem_mappable_aperture_size() + 4096);
+ intel_require_memory(1, size, CHECK_RAM);
+
+ handle = gem_create(fd, size);
+ map = gem_mmap__wc(fd, handle, 0, size, PROT_WRITE);
+
+ count = 0;
+ igt_until_timeout(5) {
+ uint64_t a = hars_petruska_f54_1_random64(&prng) % (size / sizeof(uint64_t));
+ uint64_t x = hars_petruska_f54_1_random64(&prng);
+
+ gem_write(fd, handle, a * sizeof(x), &x, sizeof(x));
+
+ gem_set_domain(fd, handle, I915_GEM_DOMAIN_WC, 0);
+ igt_assert_eq_u64(map[a], x);
+
+ count++;
+ }
+ igt_info("Completed %lu cycles\n", count);
+
+ munmap(map, handle);
+ gem_close(fd, handle);
+}
+
uint32_t *src, dst;
uint32_t *src_user, dst_stolen;
int fd;
@@ -369,6 +407,9 @@ igt_main_args("s:", NULL, help_str, opt_handler, NULL)
gem_close(fd, dst_stolen);
}
+ igt_subtest_f("basic-random")
+ test_random(fd);
+
{
const struct mode {
const char *name;
diff --git a/tests/intel-ci/blacklist.txt b/tests/intel-ci/blacklist.txt
index 390e4fa0..8085719f 100644
--- a/tests/intel-ci/blacklist.txt
+++ b/tests/intel-ci/blacklist.txt
@@ -44,6 +44,7 @@ igt@gem_lut_handle(@.*)?
igt@gem_mmap_gtt@.*(huge|swap|clflush|forked).*
igt@gem_mmap@.*(swap|huge).*
igt@gem_pread_after_blit(@.*)?
+igt@gem_pwrite@(?!.*basic).*
igt@gem_read_read_speed(@.*)?
igt@gem_render_linear_blits@(?!.*basic).*
igt@gem_render_tiled_blits@(?!.*basic).*