All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork
@ 2018-02-09 23:38 Antonio Argenziano
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 02/10] lib/igt_gt: add intel_measure_ring_size Antonio Argenziano
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:38 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

The "cork" bo (imported bo with attached fence) is used in several
tests to stall execution. Moving it to a common place makes the codebase
cleaner.

Note that the actual test updates is done in follow up patches as it is
simpler to do in one go after one more common function is added in the
next patch.

v2: don't use new/free naming, don't use dynamic alloc (Chris)

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_dummyload.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_dummyload.h |  8 ++++++++
 2 files changed, 66 insertions(+)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 27eb402b..ddaa6f0c 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -29,12 +29,14 @@
 #include <i915_drm.h>
 
 #include "igt_core.h"
+#include "drmtest.h"
 #include "igt_dummyload.h"
 #include "igt_gt.h"
 #include "intel_chipset.h"
 #include "intel_reg.h"
 #include "ioctl_wrappers.h"
 #include "sw_sync.h"
+#include "igt_vgem.h"
 
 /**
  * SECTION:igt_dummyload
@@ -371,3 +373,59 @@ void igt_terminate_spin_batches(void)
 		igt_spin_batch_end(iter);
 	pthread_mutex_unlock(&list_lock);
 }
+
+/**
+ * igt_cork_plug:
+ * @fd: open drm file descriptor
+ * @cork: structure that will be filled with the state of the cork bo
+ *
+ * Imports a vgem bo with a fence attached to it. This bo can be used as a
+ * dependency during submission to stall execution until the fence is signaled.
+ * The parameters required to unblock the execution and to cleanup are stored in
+ * the provided cork structure.
+ *
+ * Returns:
+ * Handle of the imported BO.
+ */
+uint32_t igt_cork_plug(int fd, struct igt_cork *cork)
+{
+	struct vgem_bo bo;
+	int dmabuf;
+	uint32_t handle;
+
+	igt_assert(cork);
+
+	cork->device = drm_open_driver(DRIVER_VGEM);
+
+	igt_require(vgem_has_fences(cork->device));
+
+	bo.width = bo.height = 1;
+	bo.bpp = 4;
+	vgem_create(cork->device, &bo);
+	cork->fence = vgem_fence_attach(cork->device, &bo, VGEM_FENCE_WRITE);
+
+	dmabuf = prime_handle_to_fd(cork->device, bo.handle);
+	handle = prime_fd_to_handle(fd, dmabuf);
+	close(dmabuf);
+
+	return handle;
+}
+
+/**
+ * igt_cork_unplug:
+ * @cork: cork state from igt_cork_plug()
+ *
+ * This function unblocks the execution by signaling the fence attached to the
+ * imported bo and does the necessary post-processing.
+ * NOTE: the imported bo handle returned by igt_cork_plug is not closed during
+ * this phase.
+ */
+void igt_cork_unplug(struct igt_cork *cork)
+{
+	if (!cork || !cork->device)
+		return;
+
+	vgem_fence_signal(cork->device, cork->fence);
+	close(cork->device);
+	cork->device = 0;
+}
diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h
index ffa7e351..0e87abbf 100644
--- a/lib/igt_dummyload.h
+++ b/lib/igt_dummyload.h
@@ -61,4 +61,12 @@ void igt_spin_batch_free(int fd, igt_spin_t *spin);
 
 void igt_terminate_spin_batches(void);
 
+struct igt_cork {
+	int device;
+	uint32_t fence;
+};
+
+uint32_t igt_cork_plug(int fd, struct igt_cork *cork);
+void igt_cork_unplug(struct igt_cork *cork);
+
 #endif /* __IGT_DUMMYLOAD_H__ */
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 02/10] lib/igt_gt: add intel_measure_ring_size
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
@ 2018-02-09 23:38 ` Antonio Argenziano
  2018-02-10  9:28   ` Chris Wilson
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 03/10] tests/gem_exec_schedule: use new common functions Antonio Argenziano
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:38 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

The logic to measure the ring size is replicated almost identically in
several tests. Adding it as a common function will make the code
cleaner.

The tests are updated in follow up patches.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_gt.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_gt.h |  2 ++
 2 files changed, 85 insertions(+)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index ad6e6205..703d4d50 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -40,6 +40,7 @@
 #include "ioctl_wrappers.h"
 #include "intel_reg.h"
 #include "intel_chipset.h"
+#include "igt_dummyload.h"
 
 /**
  * SECTION:igt_gt
@@ -577,6 +578,88 @@ unsigned intel_detect_and_clear_missed_interrupts(int fd)
 	return missed;
 }
 
+static void alarm_handler(int sig)
+{
+}
+
+/**
+ * intel_measure_ring_size:
+ * @fd: open i915 drm file descriptor
+ * @engine: execbuf engine flag
+ * @new_ctx: use a new context to account for the space used by the lrc init
+ *
+ * This function calculates the maximum number of batches that can be inserted
+ * at the same time in the ring on the selected engine.
+ *
+ * Returns:
+ * Number of batches that fit in the ring
+ */
+unsigned int intel_measure_ring_size(int fd, unsigned int engine, bool new_ctx)
+{
+	struct sigaction old_sa, sa = { .sa_handler = alarm_handler };
+	struct drm_i915_gem_exec_object2 obj[2];
+	struct drm_i915_gem_execbuffer2 execbuf;
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
+	unsigned int count, last;
+	struct itimerval itv;
+	struct igt_cork cork;
+
+	igt_require_intel(fd);
+
+	memset(obj, 0, sizeof(obj));
+	obj[1].handle = gem_create(fd, 4096);
+	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
+
+	memset(&execbuf, 0, sizeof(execbuf));
+	execbuf.buffers_ptr = to_user_pointer(&obj[1]);
+	execbuf.buffer_count = 1;
+	execbuf.flags = engine;
+	gem_execbuf(fd, &execbuf);
+	gem_sync(fd, obj[1].handle);
+
+	obj[0].handle = igt_cork_plug(fd, &cork);
+
+	execbuf.buffers_ptr = to_user_pointer(obj);
+	execbuf.buffer_count = 2;
+
+	if (new_ctx)
+		execbuf.rsvd1 = gem_context_create(fd);
+
+	sigaction(SIGALRM, &sa, &old_sa);
+	itv.it_interval.tv_sec = 0;
+	itv.it_interval.tv_usec = 100;
+	itv.it_value.tv_sec = 0;
+	itv.it_value.tv_usec = 1000;
+	setitimer(ITIMER_REAL, &itv, NULL);
+
+	last = -1;
+	count = 0;
+	do {
+		if (ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0) {
+			count++;
+			continue;
+		}
+
+		if (last == count)
+			break;
+
+		last = count;
+	} while (1);
+
+	memset(&itv, 0, sizeof(itv));
+	setitimer(ITIMER_REAL, &itv, NULL);
+	sigaction(SIGALRM, &old_sa, NULL);
+
+	igt_cork_unplug(&cork);
+	gem_close(fd, obj[0].handle);
+	gem_close(fd, obj[1].handle);
+
+	if (new_ctx)
+		gem_context_destroy(fd, execbuf.rsvd1);
+
+	return count;
+}
+
 const struct intel_execution_engine intel_execution_engines[] = {
 	{ "default", NULL, 0, 0 },
 	{ "render", "rcs0", I915_EXEC_RENDER, 0 },
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index 68592410..67723ae0 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -66,6 +66,8 @@ void igt_clflush_range(void *addr, int size);
 
 unsigned intel_detect_and_clear_missed_interrupts(int fd);
 
+unsigned int intel_measure_ring_size(int fd, unsigned int engine, bool new_ctx);
+
 extern const struct intel_execution_engine {
 	const char *name;
 	const char *full_name;
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 03/10] tests/gem_exec_schedule: use new common functions
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 02/10] lib/igt_gt: add intel_measure_ring_size Antonio Argenziano
@ 2018-02-09 23:38 ` Antonio Argenziano
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 04/10] tests/gem_exec_fence: " Antonio Argenziano
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:38 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

With intel_measure_ring_size and igt_cork added as common utilities we
can use them instead of the local copy of those utilities

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_schedule.c | 161 ++++++++++++----------------------------------
 1 file changed, 40 insertions(+), 121 deletions(-)

diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c
index aeb7610b..03d35df3 100644
--- a/tests/gem_exec_schedule.c
+++ b/tests/gem_exec_schedule.c
@@ -99,35 +99,6 @@ static void store_dword(int fd, uint32_t ctx, unsigned ring,
 	gem_close(fd, obj[2].handle);
 }
 
-struct cork {
-	int device;
-	uint32_t handle;
-	uint32_t fence;
-};
-
-static void plug(int fd, struct cork *c)
-{
-	struct vgem_bo bo;
-	int dmabuf;
-
-	c->device = drm_open_driver(DRIVER_VGEM);
-
-	bo.width = bo.height = 1;
-	bo.bpp = 4;
-	vgem_create(c->device, &bo);
-	c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
-
-	dmabuf = prime_handle_to_fd(c->device, bo.handle);
-	c->handle = prime_fd_to_handle(fd, dmabuf);
-	close(dmabuf);
-}
-
-static void unplug(struct cork *c)
-{
-	vgem_fence_signal(c->device, c->fence);
-	close(c->device);
-}
-
 static uint32_t create_highest_priority(int fd)
 {
 	uint32_t ctx = gem_context_create(fd);
@@ -142,7 +113,7 @@ static uint32_t create_highest_priority(int fd)
 	return ctx;
 }
 
-static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)
+static void unplug_show_queue(int fd, struct igt_cork *c, unsigned int engine)
 {
 	igt_spin_t *spin[BUSY_QLEN];
 
@@ -152,7 +123,7 @@ static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)
 		gem_context_destroy(fd, ctx);
 	}
 
-	unplug(c); /* batches will now be queued on the engine */
+	igt_cork_unplug(c); /* batches will now be queued on the engine */
 	igt_debugfs_dump(fd, "i915_engine_info");
 
 	for (int n = 0; n < ARRAY_SIZE(spin); n++)
@@ -162,19 +133,20 @@ static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)
 
 static void fifo(int fd, unsigned ring)
 {
-	struct cork cork;
-	uint32_t scratch;
+	struct igt_cork cork;
+	uint32_t scratch, plug;
 	uint32_t *ptr;
 
 	scratch = gem_create(fd, 4096);
 
-	plug(fd, &cork);
+	plug = igt_cork_plug(fd, &cork);
 
 	/* Same priority, same timeline, final result will be the second eb */
-	store_dword(fd, 0, ring, scratch, 0, 1, cork.handle, 0);
-	store_dword(fd, 0, ring, scratch, 0, 2, cork.handle, 0);
+	store_dword(fd, 0, ring, scratch, 0, 1, plug, 0);
+	store_dword(fd, 0, ring, scratch, 0, 2, plug, 0);
 
 	unplug_show_queue(fd, &cork, ring);
+	gem_close(fd, plug);
 
 	ptr = gem_mmap__gtt(fd, scratch, 4096, PROT_READ);
 	gem_set_domain(fd, scratch, /* no write hazard lies! */
@@ -262,8 +234,8 @@ static void smoketest(int fd, unsigned ring, unsigned timeout)
 static void reorder(int fd, unsigned ring, unsigned flags)
 #define EQUAL 1
 {
-	struct cork cork;
-	uint32_t scratch;
+	struct igt_cork cork;
+	uint32_t scratch, plug;
 	uint32_t *ptr;
 	uint32_t ctx[2];
 
@@ -274,15 +246,16 @@ static void reorder(int fd, unsigned ring, unsigned flags)
 	gem_context_set_priority(fd, ctx[HI], flags & EQUAL ? MIN_PRIO : 0);
 
 	scratch = gem_create(fd, 4096);
-	plug(fd, &cork);
+	plug = igt_cork_plug(fd, &cork);
 
 	/* We expect the high priority context to be executed first, and
 	 * so the final result will be value from the low priority context.
 	 */
-	store_dword(fd, ctx[LO], ring, scratch, 0, ctx[LO], cork.handle, 0);
-	store_dword(fd, ctx[HI], ring, scratch, 0, ctx[HI], cork.handle, 0);
+	store_dword(fd, ctx[LO], ring, scratch, 0, ctx[LO], plug, 0);
+	store_dword(fd, ctx[HI], ring, scratch, 0, ctx[HI], plug, 0);
 
 	unplug_show_queue(fd, &cork, ring);
+	gem_close(fd, plug);
 
 	gem_context_destroy(fd, ctx[LO]);
 	gem_context_destroy(fd, ctx[HI]);
@@ -301,10 +274,11 @@ static void reorder(int fd, unsigned ring, unsigned flags)
 
 static void promotion(int fd, unsigned ring)
 {
-	struct cork cork;
+	struct igt_cork cork;
 	uint32_t result, dep;
 	uint32_t *ptr;
 	uint32_t ctx[3];
+	uint32_t plug;
 
 	ctx[LO] = gem_context_create(fd);
 	gem_context_set_priority(fd, ctx[LO], MIN_PRIO);
@@ -318,15 +292,15 @@ static void promotion(int fd, unsigned ring)
 	result = gem_create(fd, 4096);
 	dep = gem_create(fd, 4096);
 
-	plug(fd, &cork);
+	plug = igt_cork_plug(fd, &cork);
 
 	/* Expect that HI promotes LO, so the order will be LO, HI, NOISE.
 	 *
 	 * fifo would be NOISE, LO, HI.
 	 * strict priority would be  HI, NOISE, LO
 	 */
-	store_dword(fd, ctx[NOISE], ring, result, 0, ctx[NOISE], cork.handle, 0);
-	store_dword(fd, ctx[LO], ring, result, 0, ctx[LO], cork.handle, 0);
+	store_dword(fd, ctx[NOISE], ring, result, 0, ctx[NOISE], plug, 0);
+	store_dword(fd, ctx[LO], ring, result, 0, ctx[LO], plug, 0);
 
 	/* link LO <-> HI via a dependency on another buffer */
 	store_dword(fd, ctx[LO], ring, dep, 0, ctx[LO], 0, I915_GEM_DOMAIN_INSTRUCTION);
@@ -335,6 +309,7 @@ static void promotion(int fd, unsigned ring)
 	store_dword(fd, ctx[HI], ring, result, 0, ctx[HI], 0, 0);
 
 	unplug_show_queue(fd, &cork, ring);
+	gem_close(fd, plug);
 
 	gem_context_destroy(fd, ctx[NOISE]);
 	gem_context_destroy(fd, ctx[LO]);
@@ -555,7 +530,8 @@ static void deep(int fd, unsigned ring)
 	const unsigned int nctx = MAX_PRIO - MIN_PRIO;
 	const unsigned size = ALIGN(4*nctx, 4096);
 	struct timespec tv = {};
-	struct cork cork;
+	struct igt_cork cork;
+	uint32_t plug;
 	uint32_t result, dep[XS];
 	uint32_t expected = 0;
 	uint32_t *ptr;
@@ -596,12 +572,12 @@ static void deep(int fd, unsigned ring)
 		gem_sync(fd, result);
 	}
 
-	plug(fd, &cork);
+	plug = igt_cork_plug(fd, &cork);
 
 	/* Create a deep dependency chain, with a few branches */
 	for (int n = 0; n < nctx && igt_seconds_elapsed(&tv) < 8; n++)
 		for (int m = 0; m < XS; m++)
-			store_dword(fd, ctx[n], ring, dep[m], 4*n, ctx[n], cork.handle, I915_GEM_DOMAIN_INSTRUCTION);
+			store_dword(fd, ctx[n], ring, dep[m], 4*n, ctx[n], plug, I915_GEM_DOMAIN_INSTRUCTION);
 
 	for (int n = 0; n < nctx && igt_seconds_elapsed(&tv) < 6; n++) {
 		for (int m = 0; m < XS; m++) {
@@ -612,6 +588,7 @@ static void deep(int fd, unsigned ring)
 	}
 
 	unplug_show_queue(fd, &cork, ring);
+	gem_close(fd, plug);
 	igt_require(expected); /* too slow */
 
 	for (int n = 0; n < nctx; n++)
@@ -654,72 +631,14 @@ static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
 	return err;
 }
 
-static unsigned int measure_ring_size(int fd, unsigned int ring)
-{
-	struct sigaction sa = { .sa_handler = alarm_handler };
-	struct drm_i915_gem_exec_object2 obj[2];
-	struct drm_i915_gem_execbuffer2 execbuf;
-	const uint32_t bbe = MI_BATCH_BUFFER_END;
-	unsigned int count, last;
-	struct itimerval itv;
-	struct cork c;
-
-	memset(obj, 0, sizeof(obj));
-	obj[1].handle = gem_create(fd, 4096);
-	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
-
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = to_user_pointer(obj + 1);
-	execbuf.buffer_count = 1;
-	execbuf.flags = ring;
-	gem_execbuf(fd, &execbuf);
-	gem_sync(fd, obj[1].handle);
-
-	plug(fd, &c);
-	obj[0].handle = c.handle;
-
-	execbuf.buffers_ptr = to_user_pointer(obj);
-	execbuf.buffer_count = 2;
-	execbuf.rsvd1 = gem_context_create(fd);
-
-	sigaction(SIGALRM, &sa, NULL);
-	itv.it_interval.tv_sec = 0;
-	itv.it_interval.tv_usec = 100;
-	itv.it_value.tv_sec = 0;
-	itv.it_value.tv_usec = 1000;
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	last = -1;
-	count = 0;
-	do {
-		if (__execbuf(fd, &execbuf) == 0) {
-			count++;
-			continue;
-		}
-
-		if (last == count)
-			break;
-
-		last = count;
-	} while (1);
-
-	memset(&itv, 0, sizeof(itv));
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	unplug(&c);
-	gem_close(fd, obj[1].handle);
-	gem_context_destroy(fd, execbuf.rsvd1);
-
-	return count;
-}
-
 static void wide(int fd, unsigned ring)
 {
 #define NCTX 4096
 	struct timespec tv = {};
-	unsigned int ring_size = measure_ring_size(fd, ring);
+	unsigned int ring_size = intel_measure_ring_size(fd, ring, true);
 
-	struct cork cork;
+	struct igt_cork cork;
+	uint32_t plug;
 	uint32_t result;
 	uint32_t *ptr;
 	uint32_t *ctx;
@@ -731,20 +650,21 @@ static void wide(int fd, unsigned ring)
 
 	result = gem_create(fd, 4*NCTX);
 
-	plug(fd, &cork);
+	plug = igt_cork_plug(fd, &cork);
 
 	/* Lots of in-order requests, plugged and submitted simultaneously */
 	for (count = 0;
 	     igt_seconds_elapsed(&tv) < 5 && count < ring_size;
 	     count++) {
 		for (int n = 0; n < NCTX; n++) {
-			store_dword(fd, ctx[n], ring, result, 4*n, ctx[n], cork.handle, I915_GEM_DOMAIN_INSTRUCTION);
+			store_dword(fd, ctx[n], ring, result, 4*n, ctx[n], plug, I915_GEM_DOMAIN_INSTRUCTION);
 		}
 	}
 	igt_info("Submitted %d requests over %d contexts in %.1fms\n",
 		 count, NCTX, igt_nsec_elapsed(&tv) * 1e-6);
 
 	unplug_show_queue(fd, &cork, ring);
+	gem_close(fd, plug);
 
 	for (int n = 0; n < NCTX; n++)
 		gem_context_destroy(fd, ctx[n]);
@@ -768,21 +688,20 @@ static void reorder_wide(int fd, unsigned ring)
 	struct drm_i915_gem_exec_object2 obj[3];
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct timespec tv = {};
-	unsigned int ring_size = measure_ring_size(fd, ring);
-	struct cork cork;
-	uint32_t result, target;
+	unsigned int ring_size = intel_measure_ring_size(fd, ring, true);
+	struct igt_cork cork;
+	uint32_t result, target, plug;
 	uint32_t *found, *expected;
 
 	result = gem_create(fd, 4096);
 	target = gem_create(fd, 4096);
-
-	plug(fd, &cork);
+	plug = igt_cork_plug(fd, &cork);
 
 	expected = gem_mmap__cpu(fd, target, 0, 4096, PROT_WRITE);
 	gem_set_domain(fd, target, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
 
 	memset(obj, 0, sizeof(obj));
-	obj[0].handle = cork.handle;
+	obj[0].handle = plug;
 	obj[1].handle = result;
 	obj[2].relocs_ptr = to_user_pointer(&reloc);
 	obj[2].relocation_count = 1;
@@ -850,6 +769,7 @@ static void reorder_wide(int fd, unsigned ring)
 	}
 
 	unplug_show_queue(fd, &cork, ring);
+	gem_close(fd, plug);
 
 	found = gem_mmap__gtt(fd, result, 4096, PROT_READ);
 	gem_set_domain(fd, result, /* no write hazard lies! */
@@ -884,7 +804,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
 	struct drm_i915_gem_exec_object2 obj[2];
 	unsigned int last, count;
 	struct itimerval itv;
-	struct cork c;
+	struct igt_cork c;
 	bool *result;
 
 	result = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
@@ -906,8 +826,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
 	gem_sync(fd, obj[1].handle);
 
 	/* Fill the low-priority ring */
-	plug(fd, &c);
-	obj[0].handle = c.handle;
+	obj[0].handle = igt_cork_plug(fd, &c);
 
 	execbuf.buffers_ptr = to_user_pointer(obj);
 	execbuf.buffer_count = 2;
@@ -981,7 +900,7 @@ static void test_pi_ringfull(int fd, unsigned int engine)
 	igt_assert_f(result[2],
 		     "High priority child unable to submit within 10ms\n");
 
-	unplug(&c);
+	igt_cork_unplug(&c);
 	igt_waitchildren();
 
 	gem_context_destroy(fd, execbuf.rsvd1);
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 04/10] tests/gem_exec_fence: use new common functions
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 02/10] lib/igt_gt: add intel_measure_ring_size Antonio Argenziano
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 03/10] tests/gem_exec_schedule: use new common functions Antonio Argenziano
@ 2018-02-09 23:38 ` Antonio Argenziano
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 05/10] tests/gem_exec_latency: " Antonio Argenziano
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:38 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

With intel_measure_ring_size and igt_cork added as common utilities we
can use them instead of the local copy of those utilities

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_fence.c | 115 +++++--------------------------------------------
 1 file changed, 11 insertions(+), 104 deletions(-)

diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c
index bd7b1263..2dbab6d3 100644
--- a/tests/gem_exec_fence.c
+++ b/tests/gem_exec_fence.c
@@ -321,101 +321,6 @@ static void resubmit(int fd, uint32_t handle, unsigned int ring, int count)
 		gem_execbuf(fd, &execbuf);
 }
 
-struct cork {
-	int device;
-	uint32_t handle;
-	uint32_t fence;
-};
-
-static void plug(int fd, struct cork *c)
-{
-	struct vgem_bo bo;
-	int dmabuf;
-
-	c->device = drm_open_driver(DRIVER_VGEM);
-
-	bo.width = bo.height = 1;
-	bo.bpp = 4;
-	vgem_create(c->device, &bo);
-	c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
-
-	dmabuf = prime_handle_to_fd(c->device, bo.handle);
-	c->handle = prime_fd_to_handle(fd, dmabuf);
-	close(dmabuf);
-}
-
-static void unplug(int fd, struct cork *c)
-{
-	vgem_fence_signal(c->device, c->fence);
-	gem_close(fd, c->handle);
-	close(c->device);
-}
-
-static void alarm_handler(int sig)
-{
-}
-
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
-	return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
-static unsigned int measure_ring_size(int fd)
-{
-	struct sigaction sa = { .sa_handler = alarm_handler };
-	struct drm_i915_gem_exec_object2 obj[2];
-	struct drm_i915_gem_execbuffer2 execbuf;
-	const uint32_t bbe = MI_BATCH_BUFFER_END;
-	unsigned int count, last;
-	struct itimerval itv;
-	struct cork c;
-
-	memset(obj, 0, sizeof(obj));
-	obj[1].handle = gem_create(fd, 4096);
-	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
-
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = to_user_pointer(&obj[1]);
-	execbuf.buffer_count = 1;
-	gem_execbuf(fd, &execbuf);
-	gem_sync(fd, obj[1].handle);
-
-	plug(fd, &c);
-	obj[0].handle = c.handle;
-
-	execbuf.buffers_ptr = to_user_pointer(obj);
-	execbuf.buffer_count = 2;
-
-	sigaction(SIGALRM, &sa, NULL);
-	itv.it_interval.tv_sec = 0;
-	itv.it_interval.tv_usec = 100;
-	itv.it_value.tv_sec = 0;
-	itv.it_value.tv_usec = 1000;
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	last = -1;
-	count = 0;
-	do {
-		if (__execbuf(fd, &execbuf) == 0) {
-			count++;
-			continue;
-		}
-
-		if (last == count)
-			break;
-
-		last = count;
-	} while (1);
-
-	memset(&itv, 0, sizeof(itv));
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	unplug(fd, &c);
-	gem_close(fd, obj[1].handle);
-
-	return count;
-}
-
 static void test_parallel(int fd, unsigned int master)
 {
 	const int SCRATCH = 0;
@@ -430,15 +335,16 @@ static void test_parallel(int fd, unsigned int master)
 	uint32_t batch[16];
 	igt_spin_t *spin;
 	unsigned engine;
-	struct cork c;
+	struct igt_cork c;
+	uint32_t plug;
 	int i, x = 0;
 
-	plug(fd, &c);
+	plug = igt_cork_plug(fd, &c);
 
 	/* Fill the queue with many requests so that the next one has to
 	 * wait before it can be executed by the hardware.
 	 */
-	spin = igt_spin_batch_new(fd, 0, master, c.handle);
+	spin = igt_spin_batch_new(fd, 0, master, plug);
 	resubmit(fd, spin->handle, master, 16);
 
 	/* Now queue the master request and its secondaries */
@@ -559,7 +465,8 @@ static void test_parallel(int fd, unsigned int master)
 	}
 
 	/* Unblock the master */
-	unplug(fd, &c);
+	igt_cork_unplug(&c);
+	gem_close(fd, plug);
 	igt_spin_batch_end(spin);
 
 	/* Wait for all secondaries to complete. If we used a regular fence
@@ -597,7 +504,7 @@ static void test_long_history(int fd, long ring_size, unsigned flags)
 	unsigned int nengine, n, s;
 	unsigned long limit;
 	int all_fences;
-	struct cork c;
+	struct igt_cork c;
 
 	limit = -1;
 	if (!gem_uses_full_ppgtt(fd))
@@ -632,8 +539,7 @@ static void test_long_history(int fd, long ring_size, unsigned flags)
 	execbuf.buffers_ptr = to_user_pointer(obj);
 	execbuf.buffer_count = 2;
 
-	plug(fd, &c);
-	obj[0].handle = c.handle;
+	obj[0].handle = igt_cork_plug(fd, &c);
 
 	igt_until_timeout(5) {
 		execbuf.rsvd1 = gem_context_create(fd);
@@ -661,7 +567,7 @@ static void test_long_history(int fd, long ring_size, unsigned flags)
 		if (!--limit)
 			break;
 	}
-	unplug(fd, &c);
+	igt_cork_unplug(&c);
 
 	igt_info("History depth = %d\n", sync_fence_count(all_fences));
 
@@ -685,6 +591,7 @@ static void test_long_history(int fd, long ring_size, unsigned flags)
 
 	gem_sync(fd, obj[1].handle);
 	gem_close(fd, obj[1].handle);
+	gem_close(fd, obj[0].handle);
 }
 
 static void test_fence_flip(int i915)
@@ -1532,7 +1439,7 @@ igt_main
 		long ring_size = 0;
 
 		igt_fixture {
-			ring_size = measure_ring_size(i915) - 1;
+			ring_size = intel_measure_ring_size(i915, 0, false) - 1;
 			igt_info("Ring size: %ld batches\n", ring_size);
 			igt_require(ring_size);
 
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 05/10] tests/gem_exec_latency: use new common functions
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (2 preceding siblings ...)
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 04/10] tests/gem_exec_fence: " Antonio Argenziano
@ 2018-02-09 23:39 ` Antonio Argenziano
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 06/10] tests/gem_wait: use igt_cork Antonio Argenziano
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:39 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

With intel_measure_ring_size and igt_cork added as common utilities we
can use them instead of the local copy of those utilities

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_latency.c | 98 ++++++------------------------------------------
 1 file changed, 12 insertions(+), 86 deletions(-)

diff --git a/tests/gem_exec_latency.c b/tests/gem_exec_latency.c
index 74044bf4..746e3ac3 100644
--- a/tests/gem_exec_latency.c
+++ b/tests/gem_exec_latency.c
@@ -55,83 +55,6 @@
 
 static unsigned int ring_size;
 
-struct cork {
-	int device;
-	uint32_t handle;
-	uint32_t fence;
-};
-
-static void plug(int fd, struct cork *c)
-{
-	struct vgem_bo bo;
-	int dmabuf;
-
-	c->device = drm_open_driver(DRIVER_VGEM);
-
-	bo.width = bo.height = 1;
-	bo.bpp = 4;
-	vgem_create(c->device, &bo);
-	c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
-
-	dmabuf = prime_handle_to_fd(c->device, bo.handle);
-	c->handle = prime_fd_to_handle(fd, dmabuf);
-	close(dmabuf);
-}
-
-static void unplug(struct cork *c)
-{
-	vgem_fence_signal(c->device, c->fence);
-	close(c->device);
-}
-
-static void alarm_handler(int sig)
-{
-}
-
-static void set_timeout(int seconds)
-{
-	struct sigaction sa = { .sa_handler = alarm_handler };
-
-	sigaction(SIGALRM, seconds ? &sa : NULL, NULL);
-	alarm(seconds);
-}
-
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
-	return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
-static unsigned int measure_ring_size(int fd)
-{
-	struct drm_i915_gem_exec_object2 obj[2];
-	struct drm_i915_gem_execbuffer2 execbuf;
-	const uint32_t bbe = MI_BATCH_BUFFER_END;
-	unsigned int count;
-	struct cork c;
-
-	memset(obj, 0, sizeof(obj));
-	obj[1].handle = gem_create(fd, 4096);
-	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
-
-	plug(fd, &c);
-	obj[0].handle = c.handle;
-
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = to_user_pointer(obj);
-	execbuf.buffer_count = 2;
-
-	count = 0;
-	set_timeout(1);
-	while (__execbuf(fd, &execbuf) == 0)
-		count++;
-	set_timeout(0);
-
-	unplug(&c);
-	gem_close(fd, obj[1].handle);
-
-	return count;
-}
-
 #define RCS_TIMESTAMP (0x2000 + 0x358)
 static void latency_on_ring(int fd,
 			    unsigned ring, const char *name,
@@ -142,7 +65,7 @@ static void latency_on_ring(int fd,
 	struct drm_i915_gem_exec_object2 obj[3];
 	struct drm_i915_gem_relocation_entry reloc;
 	struct drm_i915_gem_execbuffer2 execbuf;
-	struct cork c;
+	struct igt_cork c;
 	volatile uint32_t *reg;
 	unsigned repeats = ring_size;
 	uint32_t start, end, *map, *results;
@@ -206,8 +129,7 @@ static void latency_on_ring(int fd,
 	}
 
 	if (flags & CORK) {
-		plug(fd, &c);
-		obj[0].handle = c.handle;
+		obj[0].handle = igt_cork_plug(fd, &c);
 		execbuf.buffers_ptr = to_user_pointer(&obj[0]);
 		execbuf.buffer_count = 3;
 	}
@@ -228,7 +150,7 @@ static void latency_on_ring(int fd,
 	igt_assert(reloc.presumed_offset == obj[1].offset);
 
 	if (flags & CORK)
-		unplug(&c);
+		igt_cork_unplug(&c);
 
 	gem_set_domain(fd, obj[1].handle, I915_GEM_DOMAIN_GTT, 0);
 	gpu_latency = (results[repeats-1] - results[0]) / (double)(repeats-1);
@@ -269,6 +191,8 @@ static void latency_on_ring(int fd,
 
 	munmap(map, 64*1024);
 	munmap(results, 4096);
+	if (flags & CORK)
+		gem_close(fd, obj[0].handle);
 	gem_close(fd, obj[1].handle);
 	gem_close(fd, obj[2].handle);
 }
@@ -331,7 +255,7 @@ static void latency_from_ring(int fd,
 
 	for (e = intel_execution_engines; e->name; e++) {
 		igt_spin_t *spin = NULL;
-		struct cork c;
+		struct igt_cork c;
 
 		if (e->exec_id == 0)
 			continue;
@@ -347,8 +271,7 @@ static void latency_from_ring(int fd,
 			spin = igt_spin_batch_new(fd, ctx[0], ring, 0);
 
 		if (flags & CORK) {
-			plug(fd, &c);
-			obj[0].handle = c.handle;
+			obj[0].handle = igt_cork_plug(fd, &c);
 			execbuf.buffers_ptr = to_user_pointer(&obj[0]);
 			execbuf.buffer_count = 3;
 		}
@@ -408,7 +331,7 @@ static void latency_from_ring(int fd,
 		}
 
 		if (flags & CORK)
-			unplug(&c);
+			igt_cork_unplug(&c);
 		gem_set_domain(fd, obj[1].handle,
 			       I915_GEM_DOMAIN_GTT,
 			       I915_GEM_DOMAIN_GTT);
@@ -420,6 +343,9 @@ static void latency_from_ring(int fd,
 
 	munmap(map, 64*1024);
 	munmap(results, 4096);
+
+	if (flags & CORK)
+		gem_close(fd, obj[0].handle);
 	gem_close(fd, obj[1].handle);
 	gem_close(fd, obj[2].handle);
 
@@ -441,7 +367,7 @@ igt_main
 
 		gem_submission_print_method(device);
 
-		ring_size = measure_ring_size(device);
+		ring_size = intel_measure_ring_size(device, 0, false);
 		igt_info("Ring size: %d batches\n", ring_size);
 		igt_require(ring_size > 8);
 		ring_size -= 8; /* leave some spare */
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 06/10] tests/gem_wait: use igt_cork
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (3 preceding siblings ...)
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 05/10] tests/gem_exec_latency: " Antonio Argenziano
@ 2018-02-09 23:39 ` Antonio Argenziano
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 07/10] tests/gem_exec_await: use intel_measure_ring_size Antonio Argenziano
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:39 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

With igt_cork added as common utility we can use it instead of the
local copy

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_wait.c | 54 ++++++++++--------------------------------------------
 1 file changed, 10 insertions(+), 44 deletions(-)

diff --git a/tests/gem_wait.c b/tests/gem_wait.c
index cf8c8154..2a272cf0 100644
--- a/tests/gem_wait.c
+++ b/tests/gem_wait.c
@@ -69,51 +69,15 @@ static void invalid_buf(int fd)
 #define AWAIT 4
 #define WRITE 8
 
-struct cork {
-	int device;
-	uint32_t handle;
-	uint32_t fence;
-};
-
-static struct cork plug(int fd, unsigned flags)
-{
-	struct cork c;
-	struct vgem_bo bo;
-	int dmabuf;
-
-	if ((flags & (WRITE | AWAIT)) == 0)
-		return (struct cork){0};
-
-	c.device = drm_open_driver(DRIVER_VGEM);
-
-	bo.width = bo.height = 1;
-	bo.bpp = 4;
-	vgem_create(c.device, &bo);
-	c.fence = vgem_fence_attach(c.device, &bo, VGEM_FENCE_WRITE);
-
-	dmabuf = prime_handle_to_fd(c.device, bo.handle);
-	c.handle = prime_fd_to_handle(fd, dmabuf);
-	close(dmabuf);
-
-	return c;
-}
-
-static void unplug(struct cork *c)
-{
-	if (!c->device)
-		return;
-
-	vgem_fence_signal(c->device, c->fence);
-	close(c->device);
-}
-
 static void basic(int fd, unsigned engine, unsigned flags)
 {
-	struct cork cork = plug(fd, flags);
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, engine, cork.handle);
+	struct igt_cork cork = {0};
+	uint32_t plug =
+		flags & (WRITE | AWAIT) ? igt_cork_plug(fd, &cork) : 0;
+	igt_spin_t *spin = igt_spin_batch_new(fd, 0, engine, plug);
 	struct drm_i915_gem_wait wait = {
-	       	flags & WRITE ? cork.handle : spin->handle
-       	};
+		flags & WRITE ? plug : spin->handle
+	};
 
 	igt_assert_eq(__gem_wait(fd, &wait), -ETIME);
 
@@ -127,7 +91,7 @@ static void basic(int fd, unsigned engine, unsigned flags)
 			timeout = 1;
 		}
 
-		unplug(&cork);
+		igt_cork_unplug(&cork);
 		igt_assert_eq(__gem_wait(fd, &wait), -ETIME);
 
 		while (__gem_wait(fd, &wait) == -ETIME)
@@ -137,7 +101,7 @@ static void basic(int fd, unsigned engine, unsigned flags)
 		igt_assert_eq(__gem_wait(fd, &wait), -ETIME);
 		igt_assert_eq_s64(wait.timeout_ns, 0);
 
-		unplug(&cork);
+		igt_cork_unplug(&cork);
 		wait.timeout_ns = 0;
 		igt_assert_eq(__gem_wait(fd, &wait), -ETIME);
 
@@ -157,6 +121,8 @@ static void basic(int fd, unsigned engine, unsigned flags)
 		igt_assert(wait.timeout_ns == 0);
 	}
 
+	if (plug)
+		gem_close(fd, plug);
 	igt_spin_batch_free(fd, spin);
 }
 
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 07/10] tests/gem_exec_await: use intel_measure_ring_size
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (4 preceding siblings ...)
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 06/10] tests/gem_wait: use igt_cork Antonio Argenziano
@ 2018-02-09 23:39 ` Antonio Argenziano
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 08/10] tests/gem_ringfill: " Antonio Argenziano
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:39 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

With intel_measure_ring_size added as common function we can use it
instead of the local copy

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_await.c | 90 +-------------------------------------------------
 1 file changed, 1 insertion(+), 89 deletions(-)

diff --git a/tests/gem_exec_await.c b/tests/gem_exec_await.c
index e19363c4..0140073a 100644
--- a/tests/gem_exec_await.c
+++ b/tests/gem_exec_await.c
@@ -237,94 +237,6 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)
 	free(exec);
 }
 
-struct cork {
-	int device;
-	uint32_t handle;
-	uint32_t fence;
-};
-
-static void plug(int fd, struct cork *c)
-{
-	struct vgem_bo bo;
-	int dmabuf;
-
-	c->device = drm_open_driver(DRIVER_VGEM);
-
-	bo.width = bo.height = 1;
-	bo.bpp = 4;
-	vgem_create(c->device, &bo);
-	c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
-
-	dmabuf = prime_handle_to_fd(c->device, bo.handle);
-	c->handle = prime_fd_to_handle(fd, dmabuf);
-	close(dmabuf);
-}
-
-static void unplug(struct cork *c)
-{
-	vgem_fence_signal(c->device, c->fence);
-	close(c->device);
-}
-
-static void alarm_handler(int sig)
-{
-}
-
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
-	return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
-static unsigned int measure_ring_size(int fd)
-{
-	struct sigaction sa = { .sa_handler = alarm_handler };
-	struct drm_i915_gem_exec_object2 obj[2];
-	struct drm_i915_gem_execbuffer2 execbuf;
-	const uint32_t bbe = MI_BATCH_BUFFER_END;
-	unsigned int count, last;
-	struct itimerval itv;
-	struct cork c;
-
-	memset(obj, 0, sizeof(obj));
-	obj[1].handle = gem_create(fd, 4096);
-	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
-
-	plug(fd, &c);
-	obj[0].handle = c.handle;
-
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = to_user_pointer(obj);
-	execbuf.buffer_count = 2;
-
-	sigaction(SIGALRM, &sa, NULL);
-	itv.it_interval.tv_sec = 0;
-	itv.it_interval.tv_usec = 100;
-	itv.it_value.tv_sec = 0;
-	itv.it_value.tv_usec = 1000;
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	last = count = 0;
-	do {
-		if (__execbuf(fd, &execbuf) == 0) {
-			count++;
-			continue;
-		}
-
-		if (last == count)
-			break;
-
-		last = count;
-	} while (1);
-
-	memset(&itv, 0, sizeof(itv));
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	unplug(&c);
-	gem_close(fd, obj[1].handle);
-
-	return count;
-}
-
 igt_main
 {
 	int ring_size = 0;
@@ -336,7 +248,7 @@ igt_main
 		igt_require_gem(device);
 		gem_submission_print_method(device);
 
-		ring_size = measure_ring_size(device) - 10;
+		ring_size = intel_measure_ring_size(device, 0, false) - 10;
 		if (!gem_has_execlists(device))
 			ring_size /= 2;
 		igt_info("Ring size: %d batches\n", ring_size);
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 08/10] tests/gem_ringfill: use intel_measure_ring_size
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (5 preceding siblings ...)
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 07/10] tests/gem_exec_await: use intel_measure_ring_size Antonio Argenziano
@ 2018-02-09 23:39 ` Antonio Argenziano
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 09/10] tests/gem_busy: Use intel_measure_ring_size Antonio Argenziano
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:39 UTC (permalink / raw)
  To: igt-dev

From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

With intel_measure_ring_size added as common function we can use it
instead of the local copy

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_ringfill.c | 96 +---------------------------------------------------
 1 file changed, 1 insertion(+), 95 deletions(-)

diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index c3376a67..7ce29f90 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -237,100 +237,6 @@ static void run_test(int fd, unsigned ring, unsigned flags, unsigned timeout)
 		run_test(fd, ring, 0, 0);
 }
 
-struct cork {
-	int device;
-	uint32_t handle;
-	uint32_t fence;
-};
-
-static void plug(int fd, struct cork *c)
-{
-	struct vgem_bo bo;
-	int dmabuf;
-
-	c->device = drm_open_driver(DRIVER_VGEM);
-
-	bo.width = bo.height = 1;
-	bo.bpp = 4;
-	vgem_create(c->device, &bo);
-	c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
-
-	dmabuf = prime_handle_to_fd(c->device, bo.handle);
-	c->handle = prime_fd_to_handle(fd, dmabuf);
-	close(dmabuf);
-}
-
-static void unplug(struct cork *c)
-{
-	vgem_fence_signal(c->device, c->fence);
-	close(c->device);
-}
-
-static void alarm_handler(int sig)
-{
-}
-
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
-	return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
-static unsigned int measure_ring_size(int fd)
-{
-	struct sigaction sa = { .sa_handler = alarm_handler };
-	struct drm_i915_gem_exec_object2 obj[2];
-	struct drm_i915_gem_execbuffer2 execbuf;
-	const uint32_t bbe = MI_BATCH_BUFFER_END;
-	unsigned int count, last;
-	struct itimerval itv;
-	struct cork c;
-
-	memset(obj, 0, sizeof(obj));
-	obj[1].handle = gem_create(fd, 4096);
-	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
-
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = to_user_pointer(obj + 1);
-	execbuf.buffer_count = 1;
-	gem_execbuf(fd, &execbuf);
-	gem_sync(fd, obj[1].handle);
-
-	plug(fd, &c);
-	obj[0].handle = c.handle;
-
-	execbuf.buffers_ptr = to_user_pointer(obj);
-	execbuf.buffer_count = 2;
-
-	sigaction(SIGALRM, &sa, NULL);
-	itv.it_interval.tv_sec = 0;
-	itv.it_interval.tv_usec = 100;
-	itv.it_value.tv_sec = 0;
-	itv.it_value.tv_usec = 1000;
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	last = -1;
-	count = 0;
-	do {
-		if (__execbuf(fd, &execbuf) == 0) {
-			count++;
-			continue;
-		}
-
-		if (last == count)
-			break;
-
-		last = count;
-	} while (1);
-
-	memset(&itv, 0, sizeof(itv));
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	unplug(&c);
-	gem_close(fd, obj[1].handle);
-
-	return count;
-}
-
 igt_main
 {
 	const struct {
@@ -365,7 +271,7 @@ igt_main
 			master = true;
 		}
 
-		ring_size = measure_ring_size(fd);
+		ring_size = intel_measure_ring_size(fd, 0, false);
 		igt_info("Ring size: %d batches\n", ring_size);
 		igt_require(ring_size);
 	}
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 09/10] tests/gem_busy: Use intel_measure_ring_size
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (6 preceding siblings ...)
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 08/10] tests/gem_ringfill: " Antonio Argenziano
@ 2018-02-09 23:39 ` Antonio Argenziano
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 10/10] igt: Use lib gem_execbuf where possible Antonio Argenziano
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:39 UTC (permalink / raw)
  To: igt-dev

With intel_measure_ring_size added as common function we can use it
instead of the local copy

Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
---
 tests/gem_busy.c | 91 +-------------------------------------------------------
 1 file changed, 1 insertion(+), 90 deletions(-)

diff --git a/tests/gem_busy.c b/tests/gem_busy.c
index c349c291..42ac8996 100644
--- a/tests/gem_busy.c
+++ b/tests/gem_busy.c
@@ -305,99 +305,10 @@ struct cork {
 	uint32_t fence;
 };
 
-static void plug(int fd, struct cork *c)
-{
-	struct vgem_bo bo;
-	int dmabuf;
-
-	c->device = drm_open_driver(DRIVER_VGEM);
-
-	bo.width = bo.height = 1;
-	bo.bpp = 4;
-	vgem_create(c->device, &bo);
-	c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
-
-	dmabuf = prime_handle_to_fd(c->device, bo.handle);
-	c->handle = prime_fd_to_handle(fd, dmabuf);
-	close(dmabuf);
-}
-
-static void unplug(struct cork *c)
-{
-	vgem_fence_signal(c->device, c->fence);
-	close(c->device);
-}
-
-static void alarm_handler(int sig)
-{
-}
-
-static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
-{
-	return ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
-}
-
-static unsigned int measure_ring_size(int fd)
-{
-	struct sigaction sa = { .sa_handler = alarm_handler };
-	struct drm_i915_gem_exec_object2 obj[2];
-	struct drm_i915_gem_execbuffer2 execbuf;
-	const uint32_t bbe = MI_BATCH_BUFFER_END;
-	unsigned int count, last;
-	struct itimerval itv;
-	struct cork c;
-
-	memset(obj, 0, sizeof(obj));
-	obj[1].handle = gem_create(fd, 4096);
-	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
-
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = to_user_pointer(obj + 1);
-	execbuf.buffer_count = 1;
-	gem_execbuf(fd, &execbuf);
-	gem_sync(fd, obj[1].handle);
-
-	plug(fd, &c);
-	obj[0].handle = c.handle;
-
-	execbuf.buffers_ptr = to_user_pointer(obj);
-	execbuf.buffer_count = 2;
-
-	sigaction(SIGALRM, &sa, NULL);
-	itv.it_interval.tv_sec = 0;
-	itv.it_interval.tv_usec = 100;
-	itv.it_value.tv_sec = 0;
-	itv.it_value.tv_usec = 1000;
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	last = -1;
-	count = 0;
-	do {
-		if (__execbuf(fd, &execbuf) == 0) {
-			count++;
-			continue;
-		}
-
-		if (last == count)
-			break;
-
-		last = count;
-	} while (1);
-
-	memset(&itv, 0, sizeof(itv));
-	setitimer(ITIMER_REAL, &itv, NULL);
-
-	unplug(&c);
-	gem_close(fd, obj[1].handle);
-	gem_quiescent_gpu(fd);
-
-	return count;
-}
-
 static void close_race(int fd)
 {
 	const unsigned int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
-	const unsigned int nhandles = measure_ring_size(fd) / 2;
+	const unsigned int nhandles = intel_measure_ring_size(fd, 0, false) / 2;
 	unsigned int engines[16], nengine;
 	unsigned long *control;
 	uint32_t *handles;
-- 
2.14.2

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

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

* [igt-dev] [PATCH i-g-t v2 10/10] igt: Use lib gem_execbuf where possible
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (7 preceding siblings ...)
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 09/10] tests/gem_busy: Use intel_measure_ring_size Antonio Argenziano
@ 2018-02-09 23:39 ` Antonio Argenziano
  2018-02-10  9:34   ` Chris Wilson
  2018-02-10  0:08 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,01/10] lib/igt_dummyload: add igt_cork Patchwork
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-09 23:39 UTC (permalink / raw)
  To: igt-dev

Replace custom execbuf ioctl wrapper with the ones in lib.

v2:
	- Lib execbuf wrapper is not signal handling friendly. (Chris)

Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala@intel.com>
---
 tests/gem_close_race.c           |  3 +--
 tests/gem_ctx_exec.c             | 15 +++++----------
 tests/gem_evict_alignment.c      |  7 ++-----
 tests/gem_exec_bad_domains.c     |  6 +-----
 tests/gem_exec_blt.c             |  4 ++--
 tests/gem_exec_lut_handle.c      |  2 +-
 tests/gem_exec_params.c          |  9 ++-------
 tests/gem_gtt_hog.c              |  2 +-
 tests/gem_lut_handle.c           | 11 ++---------
 tests/gem_pwrite_pread.c         | 12 ++++++------
 tests/gen3_mixed_blits.c         | 10 +++++-----
 tests/gen3_render_linear_blits.c |  6 +++---
 tests/gen3_render_mixed_blits.c  |  6 +++---
 tests/gen3_render_tiledx_blits.c |  4 ++--
 tests/gen3_render_tiledy_blits.c |  6 +++---
 tests/pm_rpm.c                   |  6 +++---
 16 files changed, 42 insertions(+), 67 deletions(-)

diff --git a/tests/gem_close_race.c b/tests/gem_close_race.c
index d9a45387..bc1127b1 100644
--- a/tests/gem_close_race.c
+++ b/tests/gem_close_race.c
@@ -119,8 +119,7 @@ static void selfcopy(int fd, uint32_t handle, int loops)
 	gem_pwrite.size = sizeof(buf);
 	gem_pwrite.data_ptr = to_user_pointer(buf);
 	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite) == 0) {
-		while (loops-- &&
-		       drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0)
+		while (loops-- && __gem_execbuf(fd, &execbuf) == 0)
 			;
 	}
 
diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index fa864a21..1f8ed64d 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -52,7 +52,6 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 gem_exec;
-	int ret = 0;
 
 	gem_exec.handle = handle;
 	gem_exec.relocation_count = 0;
@@ -75,10 +74,7 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
 	i915_execbuffer2_set_context_id(execbuf, ctx_id);
 	execbuf.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
-			&execbuf);
-
-	return ret;
+	return __gem_execbuf(fd, &execbuf);
 }
 
 static void big_exec(int fd, uint32_t handle, int ring)
@@ -116,7 +112,7 @@ static void big_exec(int fd, uint32_t handle, int ring)
 
 	execbuf.buffer_count = 1;
 	i915_execbuffer2_set_context_id(execbuf, ctx_id1);
-	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+	gem_execbuf(fd, &execbuf);
 
 	for (i = 0; i < num_buffers; i++) {
 		uint32_t tmp_handle = gem_create(fd, 4096);
@@ -127,8 +123,7 @@ static void big_exec(int fd, uint32_t handle, int ring)
 	execbuf.buffer_count = i + 1;
 
 	/* figure out how many buffers we can exactly fit */
-	while (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
-			&execbuf) != 0) {
+	while (__gem_execbuf(fd, &execbuf) != 0) {
 		i--;
 		gem_close(fd, gem_exec[i].handle);
 		gem_exec[i].handle = handle;
@@ -140,10 +135,10 @@ static void big_exec(int fd, uint32_t handle, int ring)
 	       i - 1, num_buffers);
 
 	/* double check that it works */
-	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+	gem_execbuf(fd, &execbuf);
 
 	i915_execbuffer2_set_context_id(execbuf, ctx_id2);
-	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+	gem_execbuf(fd, &execbuf);
 	gem_sync(fd, handle);
 }
 
diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c
index 239be728..a80aa414 100644
--- a/tests/gem_evict_alignment.c
+++ b/tests/gem_evict_alignment.c
@@ -61,7 +61,7 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo,
 	struct drm_i915_gem_exec_object2 *obj;
 	struct drm_i915_gem_execbuffer2 exec;
 	uint32_t handle;
-	int n, ret, i=0;
+	int n, i=0;
 
 	batch[i++] = (XY_SRC_COPY_BLT_CMD |
 		    XY_SRC_COPY_BLT_WRITE_ALPHA |
@@ -121,10 +121,7 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo,
 	i915_execbuffer2_set_context_id(exec, 0);
 	exec.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
-	if (ret)
-		ret = errno;
-	igt_assert_eq(ret, error);
+	igt_assert_eq(__gem_execbuf(fd, &exec), error);
 
 	gem_close(fd, handle);
 	free(obj);
diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c
index 9a7487e3..cd2c8956 100644
--- a/tests/gem_exec_bad_domains.c
+++ b/tests/gem_exec_bad_domains.c
@@ -95,7 +95,6 @@ static void multi_write_domain(int fd)
 	struct drm_i915_gem_exec_object2 exec[2];
 	struct drm_i915_gem_relocation_entry reloc[1];
 	uint32_t handle, handle_target;
-	int ret;
 
 	handle = gem_create(fd, 4096);
 	handle_target = gem_create(fd, 4096);
@@ -137,10 +136,7 @@ static void multi_write_domain(int fd)
 	i915_execbuffer2_set_context_id(execbuf, 0);
 	execbuf.rsvd2 = 0;
 
-	ret = drmIoctl(fd,
-		       DRM_IOCTL_I915_GEM_EXECBUFFER2,
-		       &execbuf);
-	igt_assert(ret != 0 && errno == EINVAL);
+	igt_assert_eq(__gem_execbuf(fd, &execbuf), -EINVAL);
 
 	gem_close(fd, handle);
 	gem_close(fd, handle_target);
diff --git a/tests/gem_exec_blt.c b/tests/gem_exec_blt.c
index 8c0453f6..8d61dc87 100644
--- a/tests/gem_exec_blt.c
+++ b/tests/gem_exec_blt.c
@@ -228,12 +228,12 @@ static void run(int object_size, bool dumb)
 	execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
 	execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
 
-	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf)) {
+	if (__gem_execbuf(fd, &execbuf)) {
 		len = gem_linear_blt(fd, buf, src, dst, object_size, reloc);
 		igt_assert(len == execbuf.batch_len);
 		gem_write(fd, handle, 0, buf, len);
 		execbuf.flags = ring;
-		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+		gem_execbuf(fd, &execbuf);
 	}
 	gem_sync(fd, handle);
 
diff --git a/tests/gem_exec_lut_handle.c b/tests/gem_exec_lut_handle.c
index 9793133c..98e6ae5a 100644
--- a/tests/gem_exec_lut_handle.c
+++ b/tests/gem_exec_lut_handle.c
@@ -77,7 +77,7 @@ static int has_exec_lut(int fd)
 	execbuf.buffer_count = 1;
 	execbuf.flags = LOCAL_I915_EXEC_HANDLE_LUT;
 
-	return drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf) == 0;
+	return __gem_execbuf(fd, &execbuf) == 0;
 }
 
 #define ELAPSED(a,b) (1e6*((b)->tv_sec - (a)->tv_sec) + ((b)->tv_usec - (a)->tv_usec))
diff --git a/tests/gem_exec_params.c b/tests/gem_exec_params.c
index c3dc0ac2..5909bc93 100644
--- a/tests/gem_exec_params.c
+++ b/tests/gem_exec_params.c
@@ -233,10 +233,7 @@ igt_main
 	}
 
 #define RUN_FAIL(expected_errno) do { \
-		igt_assert(drmIoctl(fd, \
-				    DRM_IOCTL_I915_GEM_EXECBUFFER2, \
-				    &execbuf) == -1); \
-		igt_assert_eq(errno, expected_errno); \
+		igt_assert_eq(errno, __gem_execbuf(fd, &execbuf)); \
 	} while(0)
 
 	igt_subtest("no-bsd") {
@@ -350,9 +347,7 @@ igt_main
 		RUN_FAIL(EPERM);
 
 		igt_device_set_master(fd);
-		igt_assert(drmIoctl(fd,
-				    DRM_IOCTL_I915_GEM_EXECBUFFER2,
-				    &execbuf) == 0);
+		gem_execbuf(fd, &execbuf);
 
 		igt_device_drop_master(fd); /* Only needs temporary master */
 	}
diff --git a/tests/gem_gtt_hog.c b/tests/gem_gtt_hog.c
index a3dbfad4..ca730649 100644
--- a/tests/gem_gtt_hog.c
+++ b/tests/gem_gtt_hog.c
@@ -113,7 +113,7 @@ static void busy(data_t *data, uint32_t handle, int size, int loops)
 	gem_pwrite.data_ptr = to_user_pointer(buf);
 	if (drmIoctl(data->fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite) == 0) {
 		while (loops--)
-			drmIoctl(data->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+			gem_execbuf(data->fd, &execbuf);
 	}
 
 	drmIoctl(data->fd, DRM_IOCTL_GEM_CLOSE, &create.handle);
diff --git a/tests/gem_lut_handle.c b/tests/gem_lut_handle.c
index 10516b4f..27758f39 100644
--- a/tests/gem_lut_handle.c
+++ b/tests/gem_lut_handle.c
@@ -84,12 +84,7 @@ static int exec(int fd, uint32_t handle, unsigned int flags)
 	i915_execbuffer2_set_context_id(execbuf, 0);
 	execbuf.rsvd2 = 0;
 
-	if (drmIoctl(fd,
-		     DRM_IOCTL_I915_GEM_EXECBUFFER2,
-		     &execbuf))
-		return -errno;
-
-	return 0;
+	return __gem_execbuf(fd, &execbuf);
 }
 
 static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsigned flags)
@@ -156,9 +151,7 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign
 	i915_execbuffer2_set_context_id(execbuf, 0);
 	execbuf.rsvd2 = 0;
 
-	ret = drmIoctl(fd,
-		       DRM_IOCTL_I915_GEM_EXECBUFFER2,
-		       &execbuf);
+	ret = __gem_execbuf(fd, &execbuf);
 	if (ret < 0)
 		ret = -errno;
 
diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c
index e1543f22..383a57f7 100644
--- a/tests/gem_pwrite_pread.c
+++ b/tests/gem_pwrite_pread.c
@@ -100,7 +100,7 @@ static void copy(int fd, uint32_t src, uint32_t dst, void *buf, int len, int loo
 
 	while (loops--) {
 		gem_write(fd, src, 0, buf, len);
-		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+		gem_execbuf(fd, &execbuf);
 		gem_read(fd, dst, 0, buf, len);
 	}
 
@@ -120,7 +120,7 @@ static void as_gtt_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len,
 			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 		memcpy(src_ptr, buf, len);
 
-		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+		gem_execbuf(fd, &execbuf);
 		gem_set_domain(fd, dst,
 			       I915_GEM_DOMAIN_GTT, 0);
 		memcpy(buf, dst_ptr, len);
@@ -145,7 +145,7 @@ static void as_cpu_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len,
 			       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
 		memcpy(src_ptr, buf, len);
 
-		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+		gem_execbuf(fd, &execbuf);
 		gem_set_domain(fd, dst,
 			       I915_GEM_DOMAIN_CPU, 0);
 		memcpy(buf, dst_ptr, len);
@@ -167,7 +167,7 @@ static void test_copy(int fd, uint32_t src, uint32_t dst, uint32_t *buf, int len
 	gem_write(fd, src, 0, buf, len);
 	memset(buf, 0, len);
 
-	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+	gem_execbuf(fd, &execbuf);
 	gem_read(fd, dst, 0, buf, len);
 
 	gem_close(fd, exec[2].handle);
@@ -189,7 +189,7 @@ static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len)
 	for (i = 0; i < len/4; i++)
 		src_ptr[i] = i;
 
-	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+	gem_execbuf(fd, &execbuf);
 	gem_close(fd, exec[2].handle);
 
 	gem_set_domain(fd, dst, I915_GEM_DOMAIN_GTT, 0);
@@ -213,7 +213,7 @@ static void test_as_cpu_mmap(int fd, uint32_t src, uint32_t dst, int len)
 	for (i = 0; i < len/4; i++)
 		src_ptr[i] = i;
 
-	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+	gem_execbuf(fd, &execbuf);
 	gem_close(fd, exec[2].handle);
 
 	gem_set_domain(fd, dst, I915_GEM_DOMAIN_CPU, 0);
diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c
index 1159b4eb..147b7b87 100644
--- a/tests/gen3_mixed_blits.c
+++ b/tests/gen3_mixed_blits.c
@@ -310,10 +310,10 @@ render_copy(int fd,
 	i915_execbuffer2_set_context_id(exec, 0);
 	exec.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
-	while (ret && errno == EBUSY) {
+	ret = __gem_execbuf(fd, &exec);
+	while (ret == EBUSY) {
 		drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
-		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+		ret = __gem_execbuf(fd, &exec);
 	}
 	igt_assert_eq(ret, 0);
 
@@ -388,10 +388,10 @@ static void blt_copy(int fd, uint32_t dst, uint32_t src)
 	i915_execbuffer2_set_context_id(exec, 0);
 	exec.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+	ret = __gem_execbuf(fd, &exec);
 	while (ret && errno == EBUSY) {
 		drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
-		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+		ret = __gem_execbuf(fd, &exec);
 	}
 	igt_assert_eq(ret, 0);
 
diff --git a/tests/gen3_render_linear_blits.c b/tests/gen3_render_linear_blits.c
index e56bff93..980a1eed 100644
--- a/tests/gen3_render_linear_blits.c
+++ b/tests/gen3_render_linear_blits.c
@@ -280,10 +280,10 @@ copy(int fd, uint32_t dst, uint32_t src)
 	i915_execbuffer2_set_context_id(exec, 0);
 	exec.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
-	while (ret && errno == EBUSY) {
+	ret = __gem_execbuf(fd, &exec);
+	while (ret == EBUSY) {
 		drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
-		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+		ret = __gem_execbuf(fd, &exec);
 	}
 	igt_assert_eq(ret, 0);
 
diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c
index 6cc8d056..7dab181d 100644
--- a/tests/gen3_render_mixed_blits.c
+++ b/tests/gen3_render_mixed_blits.c
@@ -293,10 +293,10 @@ copy(int fd,
 	i915_execbuffer2_set_context_id(exec, 0);
 	exec.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
-	while (ret && errno == EBUSY) {
+	ret = __gem_execbuf(fd, &exec);
+	while (ret == EBUSY) {
 		drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
-		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+		ret = __gem_execbuf(fd, &exec);
 	}
 	igt_assert_eq(ret, 0);
 
diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c
index 6706d3a3..b7a632fa 100644
--- a/tests/gen3_render_tiledx_blits.c
+++ b/tests/gen3_render_tiledx_blits.c
@@ -280,10 +280,10 @@ copy(int fd, uint32_t dst, uint32_t src)
 	i915_execbuffer2_set_context_id(exec, 0);
 	exec.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+	ret = __gem_execbuf(fd, &exec);
 	while (ret && errno == EBUSY) {
 		drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
-		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+		ret = __gem_execbuf(fd, &exec);
 	}
 	igt_assert_eq(ret, 0);
 
diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c
index 44e88d4d..5a495534 100644
--- a/tests/gen3_render_tiledy_blits.c
+++ b/tests/gen3_render_tiledy_blits.c
@@ -280,10 +280,10 @@ copy(int fd, uint32_t dst, uint32_t src)
 	i915_execbuffer2_set_context_id(exec, 0);
 	exec.rsvd2 = 0;
 
-	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
-	while (ret && errno == EBUSY) {
+	ret = __gem_execbuf(fd, &exec);
+	while (ret == EBUSY) {
 		drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
-		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
+		ret = __gem_execbuf(fd, &exec);
 	}
 	igt_assert_eq(ret, 0);
 
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index d2a6705e..04be8c54 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -1116,7 +1116,7 @@ static void submit_blt_cmd(uint32_t dst_handle, uint16_t x, uint16_t y,
 	execbuf.flags = I915_EXEC_BLT;
 	i915_execbuffer2_set_context_id(execbuf, 0);
 
-	do_ioctl(drm_fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+	gem_execbuf(drm_fd, &execbuf);
 
 	*presumed_dst_offset = relocs[0].presumed_offset;
 
@@ -1257,7 +1257,7 @@ static void gem_execbuf_stress_subtest(int rounds, int wait_flags)
 	i915_execbuffer2_set_context_id(execbuf, 0);
 
 	for (i = 0; i < rounds; i++) {
-		do_ioctl(drm_fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+		gem_execbuf(drm_fd, &execbuf);
 
 		if (wait_flags & WAIT_STATUS)
 			igt_assert(wait_for_suspended());
@@ -1387,7 +1387,7 @@ static void system_suspend_execbuf_subtest(void)
 	igt_assert(wait_for_suspended());
 
 	for (i = 0; i < 20; i++) {
-		do_ioctl(drm_fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+		gem_execbuf(drm_fd, &execbuf);
 		igt_assert(wait_for_suspended());
 	}
 
-- 
2.14.2

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

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

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,01/10] lib/igt_dummyload: add igt_cork
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (8 preceding siblings ...)
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 10/10] igt: Use lib gem_execbuf where possible Antonio Argenziano
@ 2018-02-10  0:08 ` Patchwork
  2018-02-10  1:47 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  2018-02-10  9:26 ` [igt-dev] [PATCH i-g-t v2 01/10] " Chris Wilson
  11 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2018-02-10  0:08 UTC (permalink / raw)
  To: Antonio Argenziano; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v2,01/10] lib/igt_dummyload: add igt_cork
URL   : https://patchwork.freedesktop.org/series/38032/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
8b9f68a13442c9307ef602cb9f0282e0c4ec43e2 igt/pm_rc6_residency: Check debugfs existence before reading

with latest DRM-Tip kernel build CI_DRM_3751
2bea3467efba drm-tip: 2018y-02m-09d-22h-30m-41s UTC integration manifest

No testlist changes.

Test debugfs_test:
        Subgroup read_all_entries:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                incomplete -> SKIP       (fi-elk-e7500)

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:417s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:429s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:375s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:500s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:288s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:487s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:484s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:472s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:465s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:577s
fi-cnl-y3        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:575s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:414s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:287s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:516s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:392s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:414s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:469s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:412s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:462s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:497s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:502s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:600s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:432s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:506s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:527s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:492s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:476s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:415s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:432s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:529s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:408s
Blacklisted hosts:
fi-glk-dsi       total:114  pass:50   dwarn:0   dfail:1   fail:0   skip:62 

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_897/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,v2,01/10] lib/igt_dummyload: add igt_cork
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (9 preceding siblings ...)
  2018-02-10  0:08 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,01/10] lib/igt_dummyload: add igt_cork Patchwork
@ 2018-02-10  1:47 ` Patchwork
  2018-02-10  9:26 ` [igt-dev] [PATCH i-g-t v2 01/10] " Chris Wilson
  11 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2018-02-10  1:47 UTC (permalink / raw)
  To: Antonio Argenziano; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v2,01/10] lib/igt_dummyload: add igt_cork
URL   : https://patchwork.freedesktop.org/series/38032/
State : failure

== Summary ==

Test gem_eio:
        Subgroup in-flight-external:
                pass       -> FAIL       (shard-hsw) fdo#104676
Test drv_suspend:
        Subgroup debugfs-reader-hibernate:
                fail       -> SKIP       (shard-snb) fdo#103375 +1
Test gem_exec_params:
        Subgroup sol-reset-not-gen7:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-apl)
        Subgroup no-vebox:
                pass       -> FAIL       (shard-snb)
        Subgroup dr1-dirt:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup rel-constants-invalid-rel-gen5:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-ring:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup rel-constants-invalid-ring:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup rel-constants-invalid:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-bsd1-flag-on-render:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup rs-invalid-on-blt-ring:
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup rs-invalid-gen:
                pass       -> FAIL       (shard-snb)
        Subgroup rs-invalid-on-vebox-ring:
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-bsd1-flag-on-blt:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-ring2:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-bsd2-flag-on-blt:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup secure-non-master:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-bsd1-flag-on-vebox:
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-fence-in:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup cliprects_ptr-dirt:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-flag:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup sol-reset-invalid:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup cliprects-invalid:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup rs-invalid-on-bsd-ring:
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup dr4-dirt:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-bsd2-flag-on-render:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup secure-non-root:
                pass       -> FAIL       (shard-snb)
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
        Subgroup invalid-bsd2-flag-on-vebox:
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
Test kms_vblank:
        Subgroup pipe-b-accuracy-idle:
                fail       -> PASS       (shard-snb)
        Subgroup pipe-c-ts-continuation-suspend:
                pass       -> INCOMPLETE (shard-hsw) fdo#103540
Test kms_cursor_legacy:
        Subgroup flip-vs-cursor-varying-size:
                fail       -> PASS       (shard-hsw) fdo#102670
Test kms_plane:
        Subgroup plane-panning-bottom-right-suspend-pipe-a-planes:
                skip       -> PASS       (shard-snb) fdo#102365
Test perf_pmu:
        Subgroup rc6:
                skip       -> PASS       (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbc-suspend:
                pass       -> SKIP       (shard-snb) fdo#101623
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-render-a:
                pass       -> SKIP       (shard-snb)

fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-apl        total:3420 pass:1749 dwarn:1   dfail:0   fail:44  skip:1625 time:12131s
shard-hsw        total:3427 pass:1727 dwarn:1   dfail:0   fail:34  skip:1663 time:11497s
shard-snb        total:3444 pass:1328 dwarn:1   dfail:0   fail:30  skip:2085 time:6543s
Blacklisted hosts:
shard-kbl        total:3444 pass:1890 dwarn:1   dfail:0   fail:46  skip:1507 time:9615s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_897/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork
  2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
                   ` (10 preceding siblings ...)
  2018-02-10  1:47 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-02-10  9:26 ` Chris Wilson
  2018-02-12 21:28   ` Antonio Argenziano
  11 siblings, 1 reply; 17+ messages in thread
From: Chris Wilson @ 2018-02-10  9:26 UTC (permalink / raw)
  To: Antonio Argenziano, igt-dev

Quoting Antonio Argenziano (2018-02-09 23:38:56)
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> The "cork" bo (imported bo with attached fence) is used in several
> tests to stall execution. Moving it to a common place makes the codebase
> cleaner.
> 
> Note that the actual test updates is done in follow up patches as it is
> simpler to do in one go after one more common function is added in the
> next patch.
> 
> v2: don't use new/free naming, don't use dynamic alloc (Chris)
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  lib/igt_dummyload.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_dummyload.h |  8 ++++++++
>  2 files changed, 66 insertions(+)
> 
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index 27eb402b..ddaa6f0c 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -29,12 +29,14 @@
>  #include <i915_drm.h>
>  
>  #include "igt_core.h"
> +#include "drmtest.h"
>  #include "igt_dummyload.h"
>  #include "igt_gt.h"
>  #include "intel_chipset.h"
>  #include "intel_reg.h"
>  #include "ioctl_wrappers.h"
>  #include "sw_sync.h"
> +#include "igt_vgem.h"
>  
>  /**
>   * SECTION:igt_dummyload
> @@ -371,3 +373,59 @@ void igt_terminate_spin_batches(void)
>                 igt_spin_batch_end(iter);
>         pthread_mutex_unlock(&list_lock);
>  }
> +
> +/**
> + * igt_cork_plug:
> + * @fd: open drm file descriptor
> + * @cork: structure that will be filled with the state of the cork bo
> + *
> + * Imports a vgem bo with a fence attached to it. This bo can be used as a
> + * dependency during submission to stall execution until the fence is signaled.
> + * The parameters required to unblock the execution and to cleanup are stored in
> + * the provided cork structure.
> + *
> + * Returns:
> + * Handle of the imported BO.
> + */
> +uint32_t igt_cork_plug(int fd, struct igt_cork *cork)
> +{
> +       struct vgem_bo bo;
> +       int dmabuf;
> +       uint32_t handle;
> +
> +       igt_assert(cork);
> +
> +       cork->device = drm_open_driver(DRIVER_VGEM);
> +
> +       igt_require(vgem_has_fences(cork->device));
> +
> +       bo.width = bo.height = 1;
> +       bo.bpp = 4;
> +       vgem_create(cork->device, &bo);
> +       cork->fence = vgem_fence_attach(cork->device, &bo, VGEM_FENCE_WRITE);
> +
> +       dmabuf = prime_handle_to_fd(cork->device, bo.handle);
> +       handle = prime_fd_to_handle(fd, dmabuf);
> +       close(dmabuf);
> +
> +       return handle;
> +}
> +
> +/**
> + * igt_cork_unplug:
> + * @cork: cork state from igt_cork_plug()
> + *
> + * This function unblocks the execution by signaling the fence attached to the
> + * imported bo and does the necessary post-processing.
> + * NOTE: the imported bo handle returned by igt_cork_plug is not closed during
> + * this phase.
> + */
> +void igt_cork_unplug(struct igt_cork *cork)
> +{
> +       if (!cork || !cork->device)
> +               return;

plug does assert, but not unplug?

> +

Should have a comment here explaining that the reason we keep fence and
call vgem_fence_signal (as it would be autosignalled by close()) is so
that we catch when the fence timed-out.

Now, we could set this up with sw_sync (as used in a few other places
for corking) to avoid that timeout. Iirc, I suggested the library
routines provide both, since both are in use.

> +       vgem_fence_signal(cork->device, cork->fence);
> +       close(cork->device);
> +       cork->device = 0;

-1 for an invalid fd.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2 02/10] lib/igt_gt: add intel_measure_ring_size
  2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 02/10] lib/igt_gt: add intel_measure_ring_size Antonio Argenziano
@ 2018-02-10  9:28   ` Chris Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2018-02-10  9:28 UTC (permalink / raw)
  To: Antonio Argenziano, igt-dev

Quoting Antonio Argenziano (2018-02-09 23:38:57)
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> The logic to measure the ring size is replicated almost identically in
> several tests. Adding it as a common function will make the code
> cleaner.
> 
> The tests are updated in follow up patches.
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>

> ---
>  lib/igt_gt.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_gt.h |  2 ++

lib/i915/gem_ring.c
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2 10/10] igt: Use lib gem_execbuf where possible
  2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 10/10] igt: Use lib gem_execbuf where possible Antonio Argenziano
@ 2018-02-10  9:34   ` Chris Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2018-02-10  9:34 UTC (permalink / raw)
  To: Antonio Argenziano, igt-dev

Quoting Antonio Argenziano (2018-02-09 23:39:05)
> Replace custom execbuf ioctl wrapper with the ones in lib.
> 
> v2:
>         - Lib execbuf wrapper is not signal handling friendly. (Chris)
> 
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Petri Latvala <petri.latvala@intel.com>
> ---
> @@ -121,10 +121,7 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo,
>         i915_execbuffer2_set_context_id(exec, 0);
>         exec.rsvd2 = 0;
>  
> -       ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
> -       if (ret)
> -               ret = errno;
> -       igt_assert_eq(ret, error);
> +       igt_assert_eq(__gem_execbuf(fd, &exec), error);

__gem_execbuf returns -errno.

> diff --git a/tests/gem_exec_params.c b/tests/gem_exec_params.c
> index c3dc0ac2..5909bc93 100644
> --- a/tests/gem_exec_params.c
> +++ b/tests/gem_exec_params.c
> @@ -233,10 +233,7 @@ igt_main
>         }
>  
>  #define RUN_FAIL(expected_errno) do { \
> -               igt_assert(drmIoctl(fd, \
> -                                   DRM_IOCTL_I915_GEM_EXECBUFFER2, \
> -                                   &execbuf) == -1); \
> -               igt_assert_eq(errno, expected_errno); \
> +               igt_assert_eq(errno, __gem_execbuf(fd, &execbuf)); \

igt_assert_eq(__gem_execbuf(), -expected_errno)

>  static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsigned flags)
> @@ -156,9 +151,7 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign
>         i915_execbuffer2_set_context_id(execbuf, 0);
>         execbuf.rsvd2 = 0;
>  
> -       ret = drmIoctl(fd,
> -                      DRM_IOCTL_I915_GEM_EXECBUFFER2,
> -                      &execbuf);
> +       ret = __gem_execbuf(fd, &execbuf);
>         if (ret < 0)
>                 ret = -errno;

No need for if() here, ret is already -errno.

> diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c
> index 1159b4eb..147b7b87 100644
> --- a/tests/gen3_mixed_blits.c
> +++ b/tests/gen3_mixed_blits.c
> @@ -310,10 +310,10 @@ render_copy(int fd,
>         i915_execbuffer2_set_context_id(exec, 0);
>         exec.rsvd2 = 0;
>  
> -       ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
> -       while (ret && errno == EBUSY) {
> +       ret = __gem_execbuf(fd, &exec);
> +       while (ret == EBUSY) {

-EBUSY.

This is old, the kernel hasn't returned -EBUSY for close to 10 years.
gem_execbuf().
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork
  2018-02-10  9:26 ` [igt-dev] [PATCH i-g-t v2 01/10] " Chris Wilson
@ 2018-02-12 21:28   ` Antonio Argenziano
  2018-02-12 21:37     ` Chris Wilson
  0 siblings, 1 reply; 17+ messages in thread
From: Antonio Argenziano @ 2018-02-12 21:28 UTC (permalink / raw)
  To: Chris Wilson, igt-dev



On 10/02/18 01:26, Chris Wilson wrote:
> Quoting Antonio Argenziano (2018-02-09 23:38:56)
>> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>>
>> The "cork" bo (imported bo with attached fence) is used in several
>> tests to stall execution. Moving it to a common place makes the codebase
>> cleaner.
>>
>> Note that the actual test updates is done in follow up patches as it is
>> simpler to do in one go after one more common function is added in the
>> next patch.
>>
>> v2: don't use new/free naming, don't use dynamic alloc (Chris)
>>
>> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> ---
>>   lib/igt_dummyload.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   lib/igt_dummyload.h |  8 ++++++++
>>   2 files changed, 66 insertions(+)
>>

...

>> +/**
>> + * igt_cork_unplug:
>> + * @cork: cork state from igt_cork_plug()
>> + *
>> + * This function unblocks the execution by signaling the fence attached to the
>> + * imported bo and does the necessary post-processing.
>> + * NOTE: the imported bo handle returned by igt_cork_plug is not closed during
>> + * this phase.
>> + */
>> +void igt_cork_unplug(struct igt_cork *cork)
>> +{
>> +       if (!cork || !cork->device)
>> +               return;
> 
> plug does assert, but not unplug?

I think the idea was to allow calling this multiple times (say you cork 
from the main thread and unplug from a child thread) but I didn't see 
any evidence of that. Will add an assert.

> 
>> +
> 
> Should have a comment here explaining that the reason we keep fence and
> call vgem_fence_signal (as it would be autosignalled by close()) is so
> that we catch when the fence timed-out.
> 
> Now, we could set this up with sw_sync (as used in a few other places
> for corking) to avoid that timeout. Iirc, I suggested the library
> routines provide both, since both are in use.

Are you suggesting two function, one per method or expose one interface 
and use a parameter to chose between the two methods. Also, do you think 
we should let the user chose which corking method to use when measuring 
ring size?

Thanks,
Antonio

> 
>> +       vgem_fence_signal(cork->device, cork->fence);
>> +       close(cork->device);
>> +       cork->device = 0;
> 
> -1 for an invalid fd.
> -Chris
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork
  2018-02-12 21:28   ` Antonio Argenziano
@ 2018-02-12 21:37     ` Chris Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Chris Wilson @ 2018-02-12 21:37 UTC (permalink / raw)
  To: Antonio Argenziano, igt-dev

Quoting Antonio Argenziano (2018-02-12 21:28:39)
> 
> 
> On 10/02/18 01:26, Chris Wilson wrote:
> > Quoting Antonio Argenziano (2018-02-09 23:38:56)
> >> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> >>
> >> The "cork" bo (imported bo with attached fence) is used in several
> >> tests to stall execution. Moving it to a common place makes the codebase
> >> cleaner.
> >>
> >> Note that the actual test updates is done in follow up patches as it is
> >> simpler to do in one go after one more common function is added in the
> >> next patch.
> >>
> >> v2: don't use new/free naming, don't use dynamic alloc (Chris)
> >>
> >> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> >> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >> ---
> > Should have a comment here explaining that the reason we keep fence and
> > call vgem_fence_signal (as it would be autosignalled by close()) is so
> > that we catch when the fence timed-out.
> > 
> > Now, we could set this up with sw_sync (as used in a few other places
> > for corking) to avoid that timeout. Iirc, I suggested the library
> > routines provide both, since both are in use.
> 
> Are you suggesting two function, one per method or expose one interface 
> and use a parameter to chose between the two methods.

I think it can be a single interface, with different flags passed to the
constructor. The trick is that for vgem it returns a handle the caller
plugs into an execobjf, but for sw_sync it returns an explict fence.
Slightly different paths through the uabi (both for execbuf, IPC and
KMS).

> Also, do you think 
> we should let the user chose which corking method to use when measuring 
> ring size?

No, the choice in plugging doesn't affect the measurement. The only
argument there would be serendipitous bug discover through small
interface changes. But for the intended purpose of the tests it doesn't
matter.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-02-12 21:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 23:38 [igt-dev] [PATCH i-g-t v2 01/10] lib/igt_dummyload: add igt_cork Antonio Argenziano
2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 02/10] lib/igt_gt: add intel_measure_ring_size Antonio Argenziano
2018-02-10  9:28   ` Chris Wilson
2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 03/10] tests/gem_exec_schedule: use new common functions Antonio Argenziano
2018-02-09 23:38 ` [igt-dev] [PATCH i-g-t v2 04/10] tests/gem_exec_fence: " Antonio Argenziano
2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 05/10] tests/gem_exec_latency: " Antonio Argenziano
2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 06/10] tests/gem_wait: use igt_cork Antonio Argenziano
2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 07/10] tests/gem_exec_await: use intel_measure_ring_size Antonio Argenziano
2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 08/10] tests/gem_ringfill: " Antonio Argenziano
2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 09/10] tests/gem_busy: Use intel_measure_ring_size Antonio Argenziano
2018-02-09 23:39 ` [igt-dev] [PATCH i-g-t v2 10/10] igt: Use lib gem_execbuf where possible Antonio Argenziano
2018-02-10  9:34   ` Chris Wilson
2018-02-10  0:08 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,01/10] lib/igt_dummyload: add igt_cork Patchwork
2018-02-10  1:47 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-02-10  9:26 ` [igt-dev] [PATCH i-g-t v2 01/10] " Chris Wilson
2018-02-12 21:28   ` Antonio Argenziano
2018-02-12 21:37     ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.