From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C53FDC35242 for ; Fri, 14 Feb 2020 19:40:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94C9B206CC for ; Fri, 14 Feb 2020 19:40:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94C9B206CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A8A86FBA6; Fri, 14 Feb 2020 19:40:48 +0000 (UTC) Received: from fireflyinternet.com (unknown [77.68.26.236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AC866E869; Fri, 14 Feb 2020 19:40:46 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 20230821-1500050 for multiple; Fri, 14 Feb 2020 19:40:19 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 14 Feb 2020 19:40:15 +0000 Message-Id: <20200214194016.4054376-3-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200214194016.4054376-1-chris@chris-wilson.co.uk> References: <20200214194016.4054376-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 3/4] lib/i915: Don't confuse param.size X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If the context has no engines, it has no engines -- do not override the user's setup. Signed-off-by: Chris Wilson --- lib/i915/gem_engine_topology.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c index 9daa03df4..ca1c1fdb9 100644 --- a/lib/i915/gem_engine_topology.c +++ b/lib/i915/gem_engine_topology.c @@ -195,17 +195,6 @@ static int gem_topology_get_param(int fd, if (__gem_context_get_param(fd, p)) return -1; /* using default engine map */ - if (!p->size) - return 0; - - /* size will store the engine count */ - p->size = (p->size - sizeof(struct i915_context_param_engines)) / - (offsetof(struct i915_context_param_engines, - engines[1]) - - sizeof(struct i915_context_param_engines)); - - igt_assert_f(p->size <= GEM_MAX_ENGINES, "unsupported engine count\n"); - return 0; } @@ -242,7 +231,13 @@ struct intel_engine_data intel_init_engine_list(int fd, uint32_t ctx_id) query_engine_list(fd, &engine_data); ctx_map_engines(fd, &engine_data, ¶m); } else { - /* param.size contains the engine count */ + /* engine count can be inferred from size */ + param.size -= sizeof(struct i915_context_param_engines); + param.size /= sizeof(struct i915_engine_class_instance); + + igt_assert_f(param.size <= GEM_MAX_ENGINES, + "unsupported engine count\n"); + for (i = 0; i < param.size; i++) init_engine(&engine_data.engines[i], engines.engines[i].engine_class, -- 2.25.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx