From patchwork Thu Apr 11 12:28:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10895857 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 AB226922 for ; Thu, 11 Apr 2019 12:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9013628CC0 for ; Thu, 11 Apr 2019 12:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8499528CD3; Thu, 11 Apr 2019 12:28:36 +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 3781A28CC0 for ; Thu, 11 Apr 2019 12:28:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7529189831; Thu, 11 Apr 2019 12:28:35 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6EAC7897FD; Thu, 11 Apr 2019 12:28:34 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2019 05:28:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,337,1549958400"; d="scan'208";a="141897152" Received: from hederi-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.252.15.159]) by fmsmga007.fm.intel.com with ESMTP; 11 Apr 2019 05:28:32 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 11 Apr 2019 13:28:31 +0100 Message-Id: <20190411122831.1787-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190408161533.2421-6-andi.shyti@intel.com> References: <20190408161533.2421-6-andi.shyti@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFT i-g-t 5/6] lib: igt_dummyload: use for_each_context_engine() 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Andi Shyti With the new getparam/setparam api, engines are mapped to context. Use for_each_context_engine() to loop through existing engines. Suggested-by: Tvrtko Ursulin Signed-off-by: Andi Shyti Reviewed-by: Tvrtko Ursulin --- Just some debug to get more data from CI. --- lib/igt_dummyload.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c index 47f6b92b424b..e7f3f480dc26 100644 --- a/lib/igt_dummyload.c +++ b/lib/igt_dummyload.c @@ -39,6 +39,7 @@ #include "ioctl_wrappers.h" #include "sw_sync.h" #include "igt_vgem.h" +#include "i915/gem_engine_topology.h" #include "i915/gem_mman.h" /** @@ -86,7 +87,7 @@ emit_recursive_batch(igt_spin_t *spin, struct drm_i915_gem_relocation_entry relocs[2], *r; struct drm_i915_gem_execbuffer2 *execbuf; struct drm_i915_gem_exec_object2 *obj; - unsigned int engines[16]; + unsigned int flags[GEM_MAX_ENGINES]; unsigned int nengine; int fence_fd = -1; uint32_t *batch, *batch_start; @@ -94,17 +95,33 @@ emit_recursive_batch(igt_spin_t *spin, nengine = 0; if (opts->engine == ALL_ENGINES) { - unsigned int engine; + struct intel_execution_engine2 *engine; - for_each_physical_engine(fd, engine) { + for_each_context_engine(fd, opts->ctx, engine) { if (opts->flags & IGT_SPIN_POLL_RUN && - !gem_can_store_dword(fd, engine)) + !gem_class_can_store_dword(fd, engine->class)) continue; - engines[nengine++] = engine; + igt_debug("%u=%llx (%u:%u)\n", + nengine, + engine->flags, engine->class, engine->instance); + flags[nengine++] = engine->flags; } } else { - engines[nengine++] = opts->engine; + struct intel_execution_engine2 *e; + int class; + + if (!gem_ctx_get_engine(fd, opts->engine, opts->ctx, e)) { + class = e->class; + } else { + gem_require_ring(fd, opts->engine); + class = gem_eb_to_class(opts->engine); + } + + if (opts->flags & IGT_SPIN_POLL_RUN) + igt_require(gem_class_can_store_dword(fd, class)); + + flags[nengine++] = opts->engine; } igt_require(nengine); @@ -234,8 +251,9 @@ emit_recursive_batch(igt_spin_t *spin, for (i = 0; i < nengine; i++) { execbuf->flags &= ~ENGINE_MASK; - execbuf->flags |= engines[i]; + execbuf->flags |= flags[i]; + igt_debug("eb %u = %llx\n", i, flags[i]); gem_execbuf_wr(fd, execbuf); if (opts->flags & IGT_SPIN_FENCE_OUT) { @@ -308,12 +326,6 @@ igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts) igt_require_gem(fd); - if (opts->engine != ALL_ENGINES) { - gem_require_ring(fd, opts->engine); - if (opts->flags & IGT_SPIN_POLL_RUN) - igt_require(gem_can_store_dword(fd, opts->engine)); - } - spin = spin_batch_create(fd, opts); igt_assert(gem_bo_busy(fd, spin->handle));