From patchwork Tue Aug 6 15:01:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11085735 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 8106E14F7 for ; Fri, 9 Aug 2019 09:16:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7288B28B38 for ; Fri, 9 Aug 2019 09:16:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 673E028C54; Fri, 9 Aug 2019 09:16:18 +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,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable 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 3056728B38 for ; Fri, 9 Aug 2019 09:16:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D487D6EDA1; Fri, 9 Aug 2019 09:15:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CE1D6E3C1; Tue, 6 Aug 2019 15:01:40 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id z1so88237780wru.13; Tue, 06 Aug 2019 08:01:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y/VgpN9KQ1OYN1RgMfMvxyKwysupVNNwVRv17BQOI18=; b=kS1HuSpgAR02f1tEubztaop9eAuUYUSRBTV/rDlRoOEocYapmzlgdXcjkEbVugldU5 WxU4kjRqf6a/J40iqURJXVk5Vc0dAC9WK0DBsRgVag3n/NYg9xgBYCjIh+iu2RGCHYvR F4CsUu0xG2iyCoGdeKVltDD90W8tG2pKWK0mBS9vqFUG78lHt7odW82w+F5JwZHaAVkh Gb+3OTPdx7CG9ebcxTAQa86dg6eIgFFYeFqqv57Evn+GJlZFQSiDEuUM6wNTufxVHKiN Uho+hnivgaREVprv92ghSTnoogaQQPh1krLXWTlZ1CBGko0FOt0rf32++EI9lXOURTTf 4vmw== X-Gm-Message-State: APjAAAXSRkGGuyHMtriy0Xje6Y5atKEJP/zBMFJlIffbR9Sj544REyuu TSN2sJ8m3ZS+UBQRbMlWu0C8LFgN X-Google-Smtp-Source: APXvYqySrehuax4d3UPx8f93fBn9dGfOVrfTSM3PKhCJVqFgq0+DDODLByQU0CF6Xj/N/Z0oG3Jptw== X-Received: by 2002:a5d:4041:: with SMTP id w1mr5377756wrp.199.1565103699074; Tue, 06 Aug 2019 08:01:39 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:d1e0:fffc:b0e3:c66d]) by smtp.gmail.com with ESMTPSA id g2sm78766828wmh.0.2019.08.06.08.01.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 08:01:38 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk Date: Tue, 6 Aug 2019 17:01:30 +0200 Message-Id: <20190806150134.104222-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806150134.104222-1-christian.koenig@amd.com> References: <20190806150134.104222-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 09 Aug 2019 09:15:44 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Y/VgpN9KQ1OYN1RgMfMvxyKwysupVNNwVRv17BQOI18=; b=K5gHGuknqyvj012sUTfbv23M2dYCJGSg6gEE1ySc73LWtbguGo/uqRGNzeaFwz1A8W t7pQhYrOc/VQVq8Bp/OXGF92PlrRSYHBU3LHMRuy80gFO+30QEjqllxALk+D7hT7JFpu G5IcKGbuAn28uPBL8JZGIhEadAn5HjCAJkyNGXaDBYZ3E6+cUDl2BpI/beC/Yc8NaG24 YYW96Xhy9lvZIAgMCA5AYwGmBLOsFj54RvfkayH35NiBtBWt6uz8lzWsJ+41WNxjqh/V VoiBHqHogvlOvrEF+64DzbmkVvLXqnNLWeWgIiF9XolMmHNHI9UDhZNNBDnfk8b+Ibjk HEEg== Subject: [Intel-gfx] [PATCH 4/8] drm/i915: use new reservation_object_fences helper 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Instead of open coding the sequence loop use the new helper. Signed-off-by: Christian König --- drivers/gpu/drm/i915/gem/i915_gem_busy.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_busy.c b/drivers/gpu/drm/i915/gem/i915_gem_busy.c index 6ad93a09968c..8da0594eda88 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_busy.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_busy.c @@ -83,7 +83,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, struct drm_i915_gem_busy *args = data; struct drm_i915_gem_object *obj; struct reservation_object_list *list; - unsigned int seq; + struct dma_fence *excl; int err; err = -ENOENT; @@ -109,15 +109,12 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, * to report the overall busyness. This is what the wait-ioctl does. * */ -retry: - seq = raw_read_seqcount(&obj->base.resv->seq); + reservation_object_fences(obj->base.resv, &excl, &list); /* Translate the exclusive fence to the READ *and* WRITE engine */ - args->busy = - busy_check_writer(rcu_dereference(obj->base.resv->fence_excl)); + args->busy = busy_check_writer(excl); /* Translate shared fences to READ set of engines */ - list = rcu_dereference(obj->base.resv->fence); if (list) { unsigned int shared_count = list->shared_count, i; @@ -129,9 +126,6 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, } } - if (args->busy && read_seqcount_retry(&obj->base.resv->seq, seq)) - goto retry; - err = 0; out: rcu_read_unlock();