public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t 05/17] gem_wsim: Use IGT uapi headers
Date: Thu, 18 Oct 2018 16:28:03 +0100	[thread overview]
Message-ID: <20181018152815.31816-6-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20181018152815.31816-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

We are moving towards bumping the uAPI headers more often instead of using
too much local struct/ioctl/param definitions since the latter are more
challenging for rebase and maintenance.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 benchmarks/gem_wsim.c | 68 +++++++++++--------------------------------
 1 file changed, 17 insertions(+), 51 deletions(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index e1c73855150b..adfc2b1bc819 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -41,7 +41,6 @@
 #include <limits.h>
 #include <pthread.h>
 
-
 #include "intel_chipset.h"
 #include "intel_reg.h"
 #include "drm.h"
@@ -56,23 +55,6 @@
 
 #include "ewma.h"
 
-#define LOCAL_I915_EXEC_FENCE_IN              (1<<16)
-#define LOCAL_I915_EXEC_FENCE_OUT             (1<<17)
-
-struct local_drm_i915_gem_context_create_v2 {
-	/*  output: id of new context*/
-	__u32 ctx_id;
-	__u32 flags;
-#define LOCAL_I915_GEM_CONTEXT_SHARE_GTT	0x1
-#define LOCAL_I915_GEM_CONTEXT_SINGLE_TIMELINE	0x2
-	__u32 share_ctx;
-	__u32 pad;
-};
-
-#define LOCAL_DRM_IOCTL_I915_GEM_CONTEXT_CREATE	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct local_drm_i915_gem_context_create_v2)
-
-#define LOCAL_I915_CONTEXT_PARAM_ENGINES	0x7
-
 enum intel_engine_id {
 	RCS,
 	BCS,
@@ -873,7 +855,7 @@ eb_update_flags(struct w_step *w, enum intel_engine_id engine,
 
 	igt_assert(w->emit_fence <= 0);
 	if (w->emit_fence)
-		w->eb.flags |= LOCAL_I915_EXEC_FENCE_OUT;
+		w->eb.flags |= I915_EXEC_FENCE_OUT;
 }
 
 static struct drm_i915_gem_exec_object2 *
@@ -1079,24 +1061,23 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags)
 			continue;
 
 		if (flags & I915) {
-			struct local_drm_i915_gem_context_create_v2 args = { };
+			struct drm_i915_gem_context_create_v2 args = { };
 
 			/* Find existing context to share ppgtt with. */
 			for (j = 0; j < wrk->nr_ctxs; j++) {
 				if (!wrk->ctx_list[j].id)
 					continue;
 
-				args.flags |= LOCAL_I915_GEM_CONTEXT_SHARE_GTT;
+				args.flags |= I915_GEM_CONTEXT_SHARE_GTT;
 				args.share_ctx = share_ctx =
 					wrk->ctx_list[j].id;
 				break;
 			}
 
 			if (!ctx->targets_instance)
-				args.flags |= LOCAL_I915_GEM_CONTEXT_SINGLE_TIMELINE;
+				args.flags |= I915_GEM_CONTEXT_SINGLE_TIMELINE;
 
-			drmIoctl(fd, LOCAL_DRM_IOCTL_I915_GEM_CONTEXT_CREATE,
-				 &args);
+			drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &args);
 
 			ctx_id = args.ctx_id;
 		} else {
@@ -1125,16 +1106,15 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags)
 		 */
 		if ((flags & I915) && ctx->wants_balance &&
 		    ctx->targets_instance) {
-			struct local_drm_i915_gem_context_create_v2 args = {};
+			struct drm_i915_gem_context_create_v2 args = {};
 
 			igt_assert(share_ctx);
 
-			args.flags = LOCAL_I915_GEM_CONTEXT_SINGLE_TIMELINE |
-				     LOCAL_I915_GEM_CONTEXT_SHARE_GTT;
+			args.flags = I915_GEM_CONTEXT_SINGLE_TIMELINE |
+				     I915_GEM_CONTEXT_SHARE_GTT;
 			args.share_ctx = share_ctx;
 
-			drmIoctl(fd, LOCAL_DRM_IOCTL_I915_GEM_CONTEXT_CREATE,
-				 &args);
+			drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &args);
 
 			igt_assert(args.ctx_id);
 			ctx_id = args.ctx_id;
@@ -1144,24 +1124,10 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags)
 		}
 
 		if (ctx->wants_balance) {
-			#define LOCAL_I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0
-
-			struct local_i915_user_extension {
-				__u64 next_extension;
-				__u64 name;
-			};
-
-			struct local_i915_context_engines_load_balance {
-				struct local_i915_user_extension base;
-
-				__u64 flags; /* all undefined flags must be zero */
-				__u64 engines_mask;
-
-				__u64 mbz[4]; /* reserved for future use; must be zero */
-			} load_balance = {
-				.base.name = LOCAL_I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE,
-				.engines_mask = -1,
-			};
+			struct i915_context_engines_load_balance load_balance =
+				{ .base.name = I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE,
+				  .engines_mask = -1,
+				};
 
 			struct local_i915_context_param_engines {
 				__u64 extensions;
@@ -1182,7 +1148,7 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags)
 
 			struct drm_i915_gem_context_param param = {
 				.ctx_id = ctx_id,
-				.param = LOCAL_I915_CONTEXT_PARAM_ENGINES,
+				.param = I915_CONTEXT_PARAM_ENGINES,
 				.size = sizeof(set_engines),
 				.value = to_user_pointer(&set_engines),
 			};
@@ -1994,16 +1960,16 @@ do_eb(struct workload *wrk, struct w_step *w, enum intel_engine_id engine,
 		igt_assert(tgt >= 0 && tgt < w->idx);
 		igt_assert(wrk->steps[tgt].emit_fence > 0);
 
-		w->eb.flags |= LOCAL_I915_EXEC_FENCE_IN;
+		w->eb.flags |= I915_EXEC_FENCE_IN;
 		w->eb.rsvd2 = wrk->steps[tgt].emit_fence;
 	}
 
-	if (w->eb.flags & LOCAL_I915_EXEC_FENCE_OUT)
+	if (w->eb.flags & I915_EXEC_FENCE_OUT)
 		gem_execbuf_wr(fd, &w->eb);
 	else
 		gem_execbuf(fd, &w->eb);
 
-	if (w->eb.flags & LOCAL_I915_EXEC_FENCE_OUT) {
+	if (w->eb.flags & I915_EXEC_FENCE_OUT) {
 		w->emit_fence = w->eb.rsvd2 >> 32;
 		igt_assert(w->emit_fence > 0);
 	}
-- 
2.17.1

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

  parent reply	other threads:[~2018-10-18 15:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 15:27 [igt-dev] [PATCH i-g-t 00/17] Media scalability tooling Tvrtko Ursulin
2018-10-18 15:27 ` [Intel-gfx] [PATCH i-g-t 01/17] lib: Update uapi headers Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 02/17] trace.pl: Virtual engine support Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 03/17] trace.pl: Virtual engine preemption support Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 04/17] wsim/media-bench: i915 balancing Tvrtko Ursulin
2018-10-18 15:28 ` Tvrtko Ursulin [this message]
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 06/17] gem_wsim: Fix shadowed local Tvrtko Ursulin
2018-10-18 15:28 ` [Intel-gfx] [PATCH i-g-t 07/17] gem_wsim: Factor out common error handling Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 08/17] gem_wsim: More wsim_err Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 09/17] gem_wsim: Submit fence support Tvrtko Ursulin
2018-10-18 15:28 ` [Intel-gfx] [PATCH i-g-t 10/17] gem_wsim: Extract str to engine lookup Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 11/17] gem_wsim: Engine map support Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 12/17] gem_wsim: Save some lines by changing to implicit NULL checking Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 13/17] gem_wsim: Compact int command parsing with a macro Tvrtko Ursulin
2018-10-18 15:28 ` [Intel-gfx] [PATCH i-g-t 14/17] gem_wsim: Engine map load balance command Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 15/17] gem_wsim: Engine bond command Tvrtko Ursulin
2018-10-18 21:48   ` Chris Wilson
2018-10-26 11:11     ` Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 16/17] gem_wsim: Some more example workloads Tvrtko Ursulin
2018-10-18 15:28 ` [igt-dev] [PATCH i-g-t 17/17] gem_wsim: Infinite batch support Tvrtko Ursulin
2018-10-18 15:37 ` [igt-dev] ✗ Fi.CI.BAT: failure for Media scalability tooling 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=20181018152815.31816-6-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tvrtko.ursulin@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox