All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Argenziano <antonio.argenziano@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v4 08/11] tests/gem_exec_await: use intel_measure_ring_size
Date: Wed, 21 Feb 2018 15:19:44 -0800	[thread overview]
Message-ID: <20180221231947.4184-8-antonio.argenziano@intel.com> (raw)
In-Reply-To: <20180221231947.4184-1-antonio.argenziano@intel.com>

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: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_await.c | 91 ++------------------------------------------------
 1 file changed, 2 insertions(+), 89 deletions(-)

diff --git a/tests/gem_exec_await.c b/tests/gem_exec_await.c
index e19363c4..1c1640de 100644
--- a/tests/gem_exec_await.c
+++ b/tests/gem_exec_await.c
@@ -26,6 +26,7 @@
 #include "igt_rand.h"
 #include "igt_sysfs.h"
 #include "igt_vgem.h"
+#include "i915/gem_ring.h"
 
 #include <sys/ioctl.h>
 #include <sys/signal.h>
@@ -237,94 +238,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 +249,7 @@ igt_main
 		igt_require_gem(device);
 		gem_submission_print_method(device);
 
-		ring_size = measure_ring_size(device) - 10;
+		ring_size = gem_measure_ring_inflight(device, 0, 0) - 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

  parent reply	other threads:[~2018-02-21 23:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 23:19 [igt-dev] [PATCH i-g-t v4 01/11] lib/igt_dummyload: add igt_cork Antonio Argenziano
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 02/11] lib/igt_gt: add intel_measure_ring_size Antonio Argenziano
2018-02-23  9:29   ` Chris Wilson
2018-02-23 23:16     ` Antonio Argenziano
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 03/11] tests/gem_exec_schedule: use new common functions Antonio Argenziano
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 04/11] tests/gem_exec_fence: " Antonio Argenziano
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 05/11] tests/gem_exec_latency: " Antonio Argenziano
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 06/11] tests/gem_wait: use igt_cork Antonio Argenziano
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 07/11] tests/gem_eio: " Antonio Argenziano
2018-02-21 23:19 ` Antonio Argenziano [this message]
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 09/11] tests/gem_ringfill: use intel_measure_ring_size Antonio Argenziano
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 10/11] tests/gem_busy: Use intel_measure_ring_size Antonio Argenziano
2018-02-21 23:39   ` Chris Wilson
2018-02-21 23:19 ` [igt-dev] [PATCH i-g-t v4 11/11] igt: Use lib gem_execbuf where possible Antonio Argenziano
2018-02-21 23:42   ` Chris Wilson
2018-02-23  0:54   ` [igt-dev] [PATCH i-g-t v3] " Antonio Argenziano
2018-02-23  9:21     ` Chris Wilson
2018-02-23 10:01       ` Chris Wilson
2018-02-23 16:17         ` Antonio Argenziano
2018-02-21 23:26 ` [igt-dev] [PATCH i-g-t v4 01/11] lib/igt_dummyload: add igt_cork Chris Wilson
2018-02-22  0:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v4,01/11] " Patchwork
2018-02-22  0:31 ` [igt-dev] [PATCH i-g-t v5] " Antonio Argenziano
2018-02-22  0:46   ` Chris Wilson
2018-02-22 17:35   ` [igt-dev] [PATCH i-g-t v6] " Antonio Argenziano
2018-02-22  0:52 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v5] lib/igt_dummyload: add igt_cork (rev2) Patchwork
2018-02-22  4:47 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v4,01/11] lib/igt_dummyload: add igt_cork Patchwork
2018-02-22  5:57 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,v5] lib/igt_dummyload: add igt_cork (rev2) Patchwork
2018-02-22 21:40 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v6] lib/igt_dummyload: add igt_cork (rev3) Patchwork
2018-02-23  1:45 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v6] lib/igt_dummyload: add igt_cork (rev4) Patchwork
2018-02-23  4:47 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v6] lib/igt_dummyload: add igt_cork (rev3) Patchwork
2018-02-23  8:19 ` [igt-dev] ✗ Fi.CI.IGT: warning for series starting with [i-g-t,v6] lib/igt_dummyload: add igt_cork (rev4) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180221231947.4184-8-antonio.argenziano@intel.com \
    --to=antonio.argenziano@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.