From patchwork Tue Apr 16 14:23:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 10903219 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 691C713B5 for ; Tue, 16 Apr 2019 14:23:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FF372861E for ; Tue, 16 Apr 2019 14:23:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0407A28746; Tue, 16 Apr 2019 14:23:48 +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 AD1AE28733 for ; Tue, 16 Apr 2019 14:23:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 11D0F89D39; Tue, 16 Apr 2019 14:23:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id CD17E89D3E for ; Tue, 16 Apr 2019 14:23:45 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2019 07:23:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,358,1549958400"; d="scan'208";a="149889105" Received: from rosetta.fi.intel.com ([10.237.72.186]) by FMSMGA003.fm.intel.com with ESMTP; 16 Apr 2019 07:23:44 -0700 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id 2C5DC8400FF; Tue, 16 Apr 2019 17:23:36 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Tue, 16 Apr 2019 17:23:15 +0300 Message-Id: <20190416142315.21254-1-mika.kuoppala@linux.intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_spin_batch: Add test to resend spinner 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 Add subtests to resend the same spinner to same context and to other context. Cc: Chris Wilson Signed-off-by: Mika Kuoppala Reviewed-by: Chris Wilson --- tests/i915/gem_spin_batch.c | 47 ++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c index 52410010..e18b85c9 100644 --- a/tests/i915/gem_spin_batch.c +++ b/tests/i915/gem_spin_batch.c @@ -66,6 +66,36 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec) assert_within_epsilon(timeout_100ms * loops, elapsed, MAX_ERROR); } +#define RESUBMIT_OTHER_CTX (1 << 0) + +static void spin_resubmit(int fd, unsigned int engine, unsigned int flags) +{ + const uint32_t ctx0 = gem_context_create(fd); + const uint32_t ctx1 = (flags & RESUBMIT_OTHER_CTX) ? + gem_context_create(fd) : ctx0; + igt_spin_t *spin = __igt_spin_batch_new(fd, .ctx = ctx0, .engine = engine); + + struct drm_i915_gem_execbuffer2 eb = { + .buffer_count = 1, + .buffers_ptr = to_user_pointer(&spin->obj[1]), + .rsvd1 = ctx1, + .flags = engine, + }; + + gem_execbuf(fd, &eb); + + igt_spin_batch_end(spin); + + gem_sync(fd, spin->obj[1].handle); + + igt_spin_batch_free(fd, spin); + + if (ctx1 != ctx0) + gem_context_destroy(fd, ctx1); + + gem_context_destroy(fd, ctx0); +} + static void spin_exit_handler(int sig) { igt_terminate_spin_batches(); @@ -96,22 +126,21 @@ igt_main fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); igt_fork_hang_detector(fd); - intel_detect_and_clear_missed_interrupts(fd); } for (e = intel_execution_engines; e->name; e++) { - igt_subtest_f("basic-%s", e->name) { - intel_detect_and_clear_missed_interrupts(fd); + igt_subtest_f("basic-%s", e->name) spin(fd, e->exec_id, 3); - igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); - } + + igt_subtest_f("resubmit-%s", e->name) + spin_resubmit(fd, e->exec_id, 0); + + igt_subtest_f("resubmit-other-%s", e->name) + spin_resubmit(fd, e->exec_id, RESUBMIT_OTHER_CTX); } - igt_subtest("spin-each") { - intel_detect_and_clear_missed_interrupts(fd); + igt_subtest("spin-each") spin_on_all_engines(fd, 3); - igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); - } igt_fixture { igt_stop_hang_detector();