From patchwork Fri Feb 14 19:40:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11383175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D24571580 for ; Fri, 14 Feb 2020 19:40:52 +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 BB7F4206CC for ; Fri, 14 Feb 2020 19:40:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB7F4206CC 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 CCFE36FBAB; Fri, 14 Feb 2020 19:40:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (unknown [77.68.26.236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 47EF86E867; 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 20230820-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:14 +0000 Message-Id: <20200214194016.4054376-2-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 2/4] i915/gem_ctx_engine: Exercise for_each_context_engine() with custom engine[] 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Set up a custom engine map with no engines, and check that the for_each_context_engine() correctly iterates over nothing. Signed-off-by: Chris Wilson Acked-by: Antonio Argenziano --- tests/i915/gem_ctx_engines.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/i915/gem_ctx_engines.c b/tests/i915/gem_ctx_engines.c index 063140e0f..6a2edd1e0 100644 --- a/tests/i915/gem_ctx_engines.c +++ b/tests/i915/gem_ctx_engines.c @@ -549,6 +549,31 @@ static void independent(int i915) gem_context_destroy(i915, param.ctx_id); } +static void libapi(int i915) +{ + struct i915_context_param_engines engines = {}; + struct drm_i915_gem_context_param p = { + .ctx_id = gem_context_create(i915), + .param = I915_CONTEXT_PARAM_ENGINES, + .value = to_user_pointer(&engines), + .size = sizeof(engines), + }; + const struct intel_execution_engine2 *e; + unsigned int count = 0; + + gem_context_set_param(i915, &p); + + for_each_context_engine(i915, p.ctx_id, e) + count++; + igt_assert_eq(count, 0); + + ____for_each_physical_engine(i915, p.ctx_id, e) + count++; + igt_assert_eq(count, 0); + + gem_context_destroy(i915, p.ctx_id); +} + igt_main { int i915 = -1; @@ -584,6 +609,9 @@ igt_main igt_subtest("independent") independent(i915); + igt_subtest("libapi") + libapi(i915); + igt_fixture igt_stop_hang_detector(); }