From patchwork Thu Oct 18 15:28:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10647497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDB7615E2 for ; Thu, 18 Oct 2018 15:28:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF29528C20 for ; Thu, 18 Oct 2018 15:28:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3B0228D0A; Thu, 18 Oct 2018 15:28:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6DA4F28C20 for ; Thu, 18 Oct 2018 15:28:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71D886E028; Thu, 18 Oct 2018 15:28:36 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4BEAD89B46 for ; Thu, 18 Oct 2018 15:28:29 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id a13-v6so34181341wrt.5 for ; Thu, 18 Oct 2018 08:28:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IMOZtAfKHgCLP3UGqfwGDGpyct1Bn+/Fe+cpSQ+behY=; b=i0+AAY4boqN8bdR/+RO8hZx4xfo8LaypFloZ91i6sZJt/gf3wybiCeQRvERd/33AFB NX/i0n+tOeF4lpwqbaZ8u8AM60IUTj3fSiCKPhQ7G7agRL+4f2owST2wHI9d00kZaD/n jtkupulqNa81LsH6snJT/5sQcxdjtk/W0GI2lk0/YVCHnXcoLRRk4W/JiYpNoRbIgFVT /VgNn9pXjd5mczGNaYPH7YHcGxEK2RAMidKFenWKGBBveVI7eie7OQ65SVdTZ6Exw+As e61d4fZm0nZmYia6B9lniH8NjkikIFTrYEwZy745mUjcRodm7ji+L3IbUXZa0ovowPZD ZxRw== X-Gm-Message-State: ABuFfohK1v4aX8XEhCCYC55m5NC/HA6Dzj/JAB4qCABeOKb7/xGZaoSc 9eTL7McyNp6jTPe2pLFYPHwpCw== X-Google-Smtp-Source: ACcGV60FD7e+BxILX+G2VQl4tfCuOdeEHVZHdWpfgQj726AbU0S3EwTdkO6PfDll8c6F2QWA3zbYPQ== X-Received: by 2002:adf:9206:: with SMTP id 6-v6mr29981838wrj.275.1539876507689; Thu, 18 Oct 2018 08:28:27 -0700 (PDT) Received: from localhost.localdomain ([91.110.193.16]) by smtp.gmail.com with ESMTPSA id i6-v6sm19530387wrq.4.2018.10.18.08.28.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 08:28:27 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 18 Oct 2018 16:28:03 +0100 Message-Id: <20181018152815.31816-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181018152815.31816-1-tvrtko.ursulin@linux.intel.com> References: <20181018152815.31816-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 05/17] gem_wsim: Use IGT uapi headers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin 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 --- 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 #include - #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); }