From patchwork Mon Apr 9 11:28:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abdiel Janulgue X-Patchwork-Id: 10331125 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 0C9816037F for ; Mon, 9 Apr 2018 11:28:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F37C7289B3 for ; Mon, 9 Apr 2018 11:28:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7FCE289B7; Mon, 9 Apr 2018 11:28:26 +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 755D2289B3 for ; Mon, 9 Apr 2018 11:28:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3967B6E1A5; Mon, 9 Apr 2018 11:28:25 +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 ESMTPS id 6A9706E0BA for ; Mon, 9 Apr 2018 11:28:24 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2018 04:28:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,427,1517904000"; d="scan'208";a="31268600" Received: from abdiel-macbookpro.fi.intel.com ([10.237.66.48]) by fmsmga008.fm.intel.com with ESMTP; 09 Apr 2018 04:28:22 -0700 From: Abdiel Janulgue To: intel-gfx@lists.freedesktop.org Date: Mon, 9 Apr 2018 14:28:03 +0300 Message-Id: <20180409112804.7166-1-abdiel.janulgue@linux.intel.com> X-Mailer: git-send-email 2.9.3 Subject: [Intel-gfx] [PATCH 1/2] drm/i915/selftests: Extend partial vma coverage to check parallel creation 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 From: Chris Wilson One important use of partial vma is to provide mappable access to the object while it is being used elsewhere (pinned entirely into the unmappable portion of the Global GTT, i.e. for use as a display scanout). Signed-off-by: Chris Wilson Cc: Joonas Lahtinen --- drivers/gpu/drm/i915/selftests/i915_vma.c | 59 +++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c index eb89e30..ea48bac 100644 --- a/drivers/gpu/drm/i915/selftests/i915_vma.c +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c @@ -606,11 +606,17 @@ static int igt_vma_partial(void *arg) struct drm_i915_private *i915 = arg; struct i915_address_space *vm = &i915->ggtt.base; const unsigned int npages = 1021; /* prime! */ - struct drm_i915_gem_object *obj; + struct drm_i915_gem_object *obj = NULL; const struct phase { const char *name; + unsigned int flags; +#define CREATE BIT(0) +#define WHOLE BIT(1) } phases[] = { - { "create" }, + { "create", CREATE }, + { "lookup" }, + { "whole", WHOLE }, + { "recreate", CREATE | WHOLE }, { "lookup" }, { }, }, *p; @@ -618,17 +624,44 @@ static int igt_vma_partial(void *arg) struct i915_vma *vma; int err = -ENOMEM; - /* Create lots of different VMA for the object and check that + /* + * Create lots of different VMA for the object and check that * we are returned the same VMA when we later request the same range. */ - obj = i915_gem_object_create_internal(i915, npages*PAGE_SIZE); - if (IS_ERR(obj)) - goto out; - for (p = phases; p->name; p++) { /* exercise both create/lookup */ unsigned int count, nvma; + if (p->flags & CREATE) { + if (obj) + i915_gem_object_put(obj); + + obj = i915_gem_object_create_internal(i915, + npages*PAGE_SIZE); + if (IS_ERR(obj)) + goto out; + } + + if (p->flags & WHOLE) { + /* + * Make sure we can create mappable partial vma + * while the whole object is in use elsewhere. + */ + vma = i915_vma_instance(obj, vm, NULL); + if (IS_ERR(vma)) { + err = PTR_ERR(vma); + goto out_object; + } + + err = i915_vma_unbind(vma); + if (err) + goto out_object; + + err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL | PIN_HIGH); + if (err) + goto out_object; + } + nvma = 0; for_each_prime_number_from(sz, 1, npages) { for_each_prime_number_from(offset, 0, npages - sz) { @@ -707,12 +740,24 @@ static int igt_vma_partial(void *arg) err = -EINVAL; goto out_object; } + + if (p->flags & WHOLE) { + vma = i915_vma_instance(obj, vm, NULL); + if (IS_ERR(vma)) { + err = PTR_ERR(vma); + goto out_object; + } + + i915_vma_unpin(vma); + } } out_object: i915_gem_object_put(obj); out: return err; +#undef CREATE +#undef WHOLE } int i915_vma_mock_selftests(void)