public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear
@ 2019-02-14 16:59 Chris Wilson
  2019-02-14 17:27 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2019-02-15  0:29 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2019-02-14 16:59 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Matthew Auld

The kernel must not return stale information back to userspace when they
create a new object. For that purpose, we always clear objects on
creation, so verify that this is so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 tests/i915/gem_create.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index 25c5e8088..9d1a4af4f 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -141,6 +141,32 @@ static void invalid_nonaligned_size(int fd)
 	gem_close(fd, handle);
 }
 
+static void always_clear(int i915, int timeout)
+{
+	uint64_t max = intel_get_avail_ram_mb() << (20 - 12); /* in pages */
+
+	igt_until_timeout(timeout) {
+		uint64_t npages;
+		uint32_t handle;
+
+		npages = random();
+		npages <<= 32;
+		npages |= random();
+		npages %= max;
+
+		handle = gem_create(i915, npages << 12);
+		for (uint64_t page = 0; page < npages; page++) {
+			uint64_t x;
+
+			gem_read(i915, handle,
+				 page % (4096 - sizeof(x)),
+				 &x, sizeof(x));
+			igt_assert_eq_u64(x, 0);
+		}
+		gem_close(i915, handle);
+	}
+}
+
 igt_main
 {
 	int fd = -1;
@@ -162,4 +188,7 @@ igt_main
 
 	igt_subtest("create-invalid-nonaligned")
 		invalid_nonaligned_size(fd);
+
+	igt_subtest("create-clear")
+		always_clear(fd, 30);
 }
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-15  0:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-14 16:59 [igt-dev] [PATCH i-g-t] i915/gem_create: Verify that all new objects are clear Chris Wilson
2019-02-14 17:27 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-02-15  0:29 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox