From patchwork Wed Feb 14 19:18:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Ceraolo Spurio X-Patchwork-Id: 10219751 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 1110C601C2 for ; Wed, 14 Feb 2018 19:18:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0583428FF1 for ; Wed, 14 Feb 2018 19:18:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDC8329052; Wed, 14 Feb 2018 19:18:47 +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=-4.2 required=2.0 tests=BAYES_00, 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 87D2C28FF1 for ; Wed, 14 Feb 2018 19:18:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CDA626E2B3; Wed, 14 Feb 2018 19:18:46 +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 1C63F6E2B3 for ; Wed, 14 Feb 2018 19:18:44 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2018 11:18:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,513,1511856000"; d="scan'208";a="27918876" Received: from relo-linux-1.fm.intel.com ([10.1.27.112]) by orsmga003.jf.intel.com with ESMTP; 14 Feb 2018 11:18:44 -0800 From: Daniele Ceraolo Spurio To: intel-gfx@lists.freedesktop.org Date: Wed, 14 Feb 2018 11:18:26 -0800 Message-Id: <20180214191827.8465-2-daniele.ceraolospurio@intel.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180214191827.8465-1-daniele.ceraolospurio@intel.com> References: <20180214191827.8465-1-daniele.ceraolospurio@intel.com> Subject: [Intel-gfx] [PATCH i-g-t] tests/gem_exec_fence: test that in-fence is not overwritten 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 When an out-fence is returned we expect that the in-fence is not overwritten. Add a test to check for that. Cc: Chris Wilson Signed-off-by: Daniele Ceraolo Spurio --- tests/gem_exec_fence.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c index bd7b1263..f7478c55 100644 --- a/tests/gem_exec_fence.c +++ b/tests/gem_exec_fence.c @@ -586,6 +586,42 @@ static void test_parallel(int fd, unsigned int master) gem_close(fd, handle[0]); } +/* check that a fence in doesn't get clobbered when a fence out is returned */ +static void test_keep_fence_in(int fd, unsigned int engine) +{ + struct drm_i915_gem_execbuffer2 execbuf; + struct drm_i915_gem_exec_object2 obj; + const uint32_t bbe = MI_BATCH_BUFFER_END; + int fence; + + memset(&obj, 0, sizeof(obj)); + memset(&execbuf, 0, sizeof(execbuf)); + + obj.handle = gem_create(fd, 4096); + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe)); + + execbuf.buffers_ptr = to_user_pointer(&obj); + execbuf.buffer_count = 1; + execbuf.flags = engine | LOCAL_EXEC_FENCE_OUT; + + gem_execbuf_wr(fd, &execbuf); + fence = execbuf.rsvd2 >> 32; + + gem_close(fd, obj.handle); + obj.handle = gem_create(fd, 4096); + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe)); + + execbuf.flags |= LOCAL_EXEC_FENCE_IN; + execbuf.rsvd2 = fence; + + gem_execbuf_wr(fd, &execbuf); + igt_assert_eq(fence, execbuf.rsvd2 & 0xFFFFFFFF); + + gem_close(fd, obj.handle); + close(fence); + close(execbuf.rsvd2 >> 32); +} + #define EXPIRED 0x10000 static void test_long_history(int fd, long ring_size, unsigned flags) { @@ -1499,6 +1535,9 @@ igt_main } } + igt_subtest_f("keep-fence-in-%s", e->name) + test_keep_fence_in(i915, e->exec_id | e->flags); + igt_fixture { igt_stop_hang_detector(); }