From patchwork Wed Mar 2 18:10:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Morton X-Patchwork-Id: 8484451 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AF7989F2F0 for ; Wed, 2 Mar 2016 18:11:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F9D420386 for ; Wed, 2 Mar 2016 18:11:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 23A2E2037C for ; Wed, 2 Mar 2016 18:11:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D3E746E94D; Wed, 2 Mar 2016 18:11:13 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id CD8AB6E948 for ; Wed, 2 Mar 2016 18:11:10 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 02 Mar 2016 10:11:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,529,1449561600"; d="scan'208";a="58537804" Received: from djmorton-linux2.isw.intel.com ([10.102.226.90]) by fmsmga004.fm.intel.com with ESMTP; 02 Mar 2016 10:11:09 -0800 From: Derek Morton To: intel-gfx@lists.freedesktop.org Date: Wed, 2 Mar 2016 18:10:44 +0000 Message-Id: <1456942245-24749-7-git-send-email-derek.j.morton@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456942245-24749-1-git-send-email-derek.j.morton@intel.com> References: <1456942245-24749-1-git-send-email-derek.j.morton@intel.com> Cc: daniel.vetter@ffwll.ch Subject: [Intel-gfx] [PATCH i-g-t v2 6/7] tests/gem_scheduler: Add subtests to test batch priority behaviour 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, 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 Add subtests to test each ring to check batch buffers of a higher priority will be executed before batch buffers of a lower priority. v2: Addressed review comments from Daniele Ceraolo Spurio Signed-off-by: Derek Morton --- tests/gem_scheduler.c | 53 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/tests/gem_scheduler.c b/tests/gem_scheduler.c index 762b69f..171b0a3 100644 --- a/tests/gem_scheduler.c +++ b/tests/gem_scheduler.c @@ -39,7 +39,8 @@ IGT_TEST_DESCRIPTION("Check scheduler behaviour. Basic tests ensure independant " "batch buffers of the same priority are executed in " - "submission order. Read-read tests ensure " + "submission order. Priority tests ensure higher priority " + "batch buffers are executed first. Read-read tests ensure " "batch buffers with a read dependency to the same buffer " "object do not block each other. Write-write dependency " "tests ensure batch buffers with a write dependency to a " @@ -128,11 +129,23 @@ static void init_context(int *fd, drm_intel_bufmgr **bufmgr, int ringid) intel_batchbuffer_free(noop_bb); } -/* Basic test. Check batch buffers of the same priority and with no dependencies - * are executed in the order they are submitted. +static void set_priority(int fd, int value) +{ + struct local_i915_gem_context_param param; + param.context = 0; /* Default context */ + param.size = 0; + param.param = LOCAL_CONTEXT_PARAM_PRIORITY; + param.value = (uint64_t)value; + gem_context_set_param(fd, ¶m); +} + +/* If 'priority' is 0, check batch buffers of the same priority and with + * no dependencies are executed in the order they are submitted. + * If 'priority' is set !0, check batch buffers of higher priority are + * executed before batch buffers of lower priority. */ #define NBR_BASIC_FDs (3) -static void run_test_basic(int in_flight, int ringid) +static void run_test_basic(int in_flight, int ringid, int priority) { int fd[NBR_BASIC_FDs]; int loop; @@ -152,6 +165,13 @@ static void run_test_basic(int in_flight, int ringid) for(loop=0; loop < NBR_BASIC_FDs; loop++) init_context(&(fd[loop]), &(bufmgr[loop]), ringid); + /* For high priority set priority of second context to overtake first + * For low priority set priority of first context to be overtaxen by second + */ + if(priority > 0) + set_priority(fd[2], priority); + else if(priority < 0) + set_priority(fd[1], priority); /* Create buffer objects */ delay_bo = create_and_check_bo(bufmgr[0], "delay bo"); @@ -201,9 +221,14 @@ static void run_test_basic(int in_flight, int ringid) igt_assert_f(igt_compare_timestamps(delay_buf[2], ts1_buf[0]), "Delay ts (0x%08" PRIx32 ") > TS1 ts (0x%08" PRIx32 ")\n", delay_buf[2], ts1_buf[0]); - igt_assert_f(igt_compare_timestamps(ts1_buf[0], ts2_buf[0]), - "TS1 ts (0x%08" PRIx32 ") > TS2 ts (0x%08" PRIx32 ")\n", - ts1_buf[0], ts2_buf[0]); + if(priority) + igt_assert_f(igt_compare_timestamps(ts2_buf[0], ts1_buf[0]), + "TS2 ts (0x%08" PRIx32 ") > TS1 ts (0x%08" PRIx32 ")\n", + ts2_buf[0], ts1_buf[0]); + else + igt_assert_f(igt_compare_timestamps(ts1_buf[0], ts2_buf[0]), + "TS1 ts (0x%08" PRIx32 ") > TS2 ts (0x%08" PRIx32 ")\n", + ts1_buf[0], ts2_buf[0]); /* Cleanup */ for(loop = 0; loop < in_flight; loop++) @@ -430,7 +455,19 @@ igt_main for (loop=0; loop < NBR_RINGS; loop++) igt_subtest_f("%s-basic", rings[loop].name) { gem_require_ring(fd, rings[loop].id); - run_test_basic(in_flight, rings[loop].id); + run_test_basic(in_flight, rings[loop].id, false); + } + + for (loop=0; loop < NBR_RINGS; loop++) + igt_subtest_f("%s-priority-high", rings[loop].name) { + gem_require_ring(fd, rings[loop].id); + run_test_basic(in_flight, rings[loop].id, 1000); + } + + for (loop=0; loop < NBR_RINGS; loop++) + igt_subtest_f("%s-priority-low", rings[loop].name) { + gem_require_ring(fd, rings[loop].id); + run_test_basic(in_flight, rings[loop].id, -1000); } for (loop=0; loop < NBR_RINGS; loop++)