From patchwork Thu May 17 08:23:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10405841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E96E560247 for ; Thu, 17 May 2018 08:23:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8E34289AA for ; Thu, 17 May 2018 08:23:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD66D289AB; Thu, 17 May 2018 08:23:43 +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 8E327289A7 for ; Thu, 17 May 2018 08:23:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FEF28953E; Thu, 17 May 2018 08:23:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id D0CDC896B5 for ; Thu, 17 May 2018 08:23:39 +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 11732005-1500050 for multiple; Thu, 17 May 2018 09:23:35 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Thu, 17 May 2018 09:23:34 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 17 May 2018 09:23:29 +0100 Message-Id: <20180517082330.32760-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180517082330.32760-1-chris@chris-wilson.co.uk> References: <20180517082330.32760-1-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [PATCH i-g-t 2/3] igt/gem_blits: Check for blitter support before use 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Not all HW supports XY blitter commands, so check before use. Signed-off-by: Chris Wilson Reviewed-by: Antonio Argenziano --- lib/i915/gem_submission.c | 16 ++++++++++++++++ lib/i915/gem_submission.h | 3 +++ tests/gem_linear_blits.c | 1 + tests/gem_tiled_blits.c | 1 + tests/gem_tiled_fence_blits.c | 1 + 5 files changed, 22 insertions(+) diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c index 2fd460d5e..1d1adcf6f 100644 --- a/lib/i915/gem_submission.c +++ b/lib/i915/gem_submission.c @@ -229,3 +229,19 @@ void gem_test_engine(int i915, unsigned int engine) igt_assert(!is_wedged(i915)); close(i915); } + +bool gem_has_blitter(int i915) +{ + unsigned int blt; + + blt = 0; + if (intel_gen(intel_get_drm_devid(i915)) >= 6) + blt = I915_EXEC_BLT; + + return gem_has_ring(i915, blt); +} + +void gem_require_blitter(int i915) +{ + igt_require(gem_has_blitter(i915)); +} diff --git a/lib/i915/gem_submission.h b/lib/i915/gem_submission.h index f94eabb20..f2b18d9dc 100644 --- a/lib/i915/gem_submission.h +++ b/lib/i915/gem_submission.h @@ -33,6 +33,9 @@ bool gem_has_semaphores(int fd); bool gem_has_execlists(int fd); bool gem_has_guc_submission(int fd); +bool gem_has_blitter(int i915); +void gem_require_blitter(int i915); + void gem_test_engine(int fd, unsigned int engine); int gem_reopen_driver(int fd); diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c index 8297416c0..7d05fa865 100644 --- a/tests/gem_linear_blits.c +++ b/tests/gem_linear_blits.c @@ -226,6 +226,7 @@ int main(int argc, char **argv) igt_fixture { fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); + gem_require_blitter(fd); } igt_subtest("basic") diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c index a81226a15..0d472e3a1 100644 --- a/tests/gem_tiled_blits.c +++ b/tests/gem_tiled_blits.c @@ -203,6 +203,7 @@ int main(int argc, char **argv) igt_fixture { fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); + gem_require_blitter(fd); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); drm_intel_bufmgr_gem_enable_reuse(bufmgr); diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c index 693e96cec..9ab58b5d6 100644 --- a/tests/gem_tiled_fence_blits.c +++ b/tests/gem_tiled_fence_blits.c @@ -176,6 +176,7 @@ igt_main igt_fixture { fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); + gem_require_blitter(fd); } igt_subtest("basic") {