From patchwork Tue Apr 14 15:42:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Thierry X-Patchwork-Id: 6216971 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C91ACBF4A6 for ; Tue, 14 Apr 2015 15:43:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE0332026F for ; Tue, 14 Apr 2015 15:43:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E63C6202B4 for ; Tue, 14 Apr 2015 15:43:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 438976E6F3; Tue, 14 Apr 2015 08:43:00 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id D4B636E6F3 for ; Tue, 14 Apr 2015 08:42:59 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 14 Apr 2015 08:42:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,576,1422950400"; d="scan'208";a="708846406" Received: from michelth-linux.isw.intel.com ([10.102.226.66]) by fmsmga002.fm.intel.com with ESMTP; 14 Apr 2015 08:42:59 -0700 From: Michel Thierry To: intel-gfx@lists.freedesktop.org Date: Tue, 14 Apr 2015 16:42:58 +0100 Message-Id: <1429026178-26960-1-git-send-email-michel.thierry@intel.com> X-Mailer: git-send-email 2.1.1 Subject: [Intel-gfx] [PATCH] igt/gem_ctx_exec: Add lrc lite restore subtest X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Exercise lite-restore (re-submit a context that is currently running), by queueing several small batchbuffers. This test helps to validate WaIdleLiteRestore. Signed-off-by: Michel Thierry --- tests/gem_ctx_exec.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c index 43b38a2..3df939c 100644 --- a/tests/gem_ctx_exec.c +++ b/tests/gem_ctx_exec.c @@ -155,7 +155,7 @@ static void big_exec(int fd, uint32_t handle, int ring) uint32_t handle; uint32_t batch[2] = {0, MI_BATCH_BUFFER_END}; -uint32_t ctx_id; +uint32_t ctx_id, ctx_id2; int fd; igt_main @@ -215,4 +215,32 @@ igt_main gem_context_destroy(fd, ctx_id); } + + igt_subtest("lrc-lite-restore") { + int i, j; + + /* + * Need 2 contexts to be able to replicate a lite restore, + * i.e. a running context is resubmitted. + */ + ctx_id = gem_context_create(fd); + ctx_id2 = gem_context_create(fd); + + /* + * Queue several small batchbuffers to be sure we'll send execlists + * with 2 valid context, and likely cause a lite restore when ctxB + * is resubmitted at the top of the new execlist. + */ + for (i = 0; i < 20; i++) { + for (j = 0; j < 200; j++) { + igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0); + igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id2) == 0); + } + + gem_sync(fd, handle); + } + + gem_context_destroy(fd, ctx_id); + gem_context_destroy(fd, ctx_id2); + } }