From patchwork Wed Sep 22 09:10:35 2021 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: 12510481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4FD8C433EF for ; Wed, 22 Sep 2021 12:45:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AC046115A for ; Wed, 22 Sep 2021 12:45:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9AC046115A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 694536EB89; Wed, 22 Sep 2021 12:44:58 +0000 (UTC) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by gabe.freedesktop.org (Postfix) with ESMTPS id 30E1F6EB27; Wed, 22 Sep 2021 09:11:05 +0000 (UTC) Received: by mail-wr1-x430.google.com with SMTP id w29so4624450wra.8; Wed, 22 Sep 2021 02:11:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sR69q70gSeg6sG3/QgjbBFqvIqYfytfoA0SgvZr7HAU=; b=UEJYZHOyM5FWBh9nFOlDTSRbwlHNw/8R8L9nK56tUJVXe7V/Ima+jW2VZw79JO7ka5 cwoWdjIm9cs5G6xD0D6y8VuS/watKoxa8d/UNOMfg8GszX4sOsfkzjzV0XYC9fIWclKK /P4nvvEmmNMAqQnYiexWsKOfznTEAwGPGPyhPkzbsoyqxZOp99fDoYBBQIiTwOC4MF0O /IgJEPAeTiCKfmLDL7RT4EPLT0Z4AgjvVCNNGf5R2ubbC8ncoiGYIa/OB2vc/GGgJNzM BohW0I5Vi6ffGgY6Lx4WV6D9P/vqlF1qFv5p+BkHL/TXYoSUowrshpIl9weAL3duuDBo wjkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sR69q70gSeg6sG3/QgjbBFqvIqYfytfoA0SgvZr7HAU=; b=y7ryBBJx6SjTZOje0ps8nbRgd0FuXAPwZnNRwuIxg0jHyBD1iHub3tqqNtT/AOgwkO yipmeQHSS7ZsDQNi1FbCVFQtBO7gDFrE1gCxa0X9f9PKTFDLe4W3oLxswDUp4NW8McbL WLwWwBXrwoInZEGhAt7GV8CHXPDNxgmi35s06sEBXSC7o3JPCjC8orn8KqFpleZnA0Ml b5QDpzX2rx33M328hJjpMukPMJkL7xqbAYSgBsCy9WjVIUn6vddBjdKDkybNUMD01tc3 7sFFN24Cp0EEe80WcEj5gZBeph+WsvuQW4ECRNCckUfPnPzz4aZPbRP77SV8G3HbB4sh SZSw== X-Gm-Message-State: AOAM531v/FdwuRt02wtggHF4wAYKpQgw1ehnuLCWVCDtrUeOVmSOJ8oN R/Zf/zAPyz+6Yg281NQc2jw= X-Google-Smtp-Source: ABdhPJz1tDCj/P5Xzak0LokdOWDqixMC4Hm+RqE58sLy9CPecXzeoWkCE/IuZQKIb8Y1zBAL+6TWYg== X-Received: by 2002:a05:6000:18a4:: with SMTP id b4mr33406906wri.96.1632301863666; Wed, 22 Sep 2021 02:11:03 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id r25sm1535515wra.76.2021.09.22.02.11.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 02:11:03 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org Cc: daniel@ffwll.ch, tvrtko.ursulin@linux.intel.com Date: Wed, 22 Sep 2021 11:10:35 +0200 Message-Id: <20210922091044.2612-18-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210922091044.2612-1-christian.koenig@amd.com> References: <20210922091044.2612-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 22 Sep 2021 12:44:58 +0000 Subject: [Intel-gfx] [PATCH 17/26] drm/i915: use new iterator in i915_gem_object_wait_priority X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Simplifying the code a bit. Signed-off-by: Christian König --- drivers/gpu/drm/i915/gem/i915_gem_wait.c | 31 +++++------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_wait.c b/drivers/gpu/drm/i915/gem/i915_gem_wait.c index a13193db1dba..569658c7859c 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_wait.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_wait.c @@ -118,32 +118,13 @@ i915_gem_object_wait_priority(struct drm_i915_gem_object *obj, unsigned int flags, const struct i915_sched_attr *attr) { - struct dma_fence *excl; - - if (flags & I915_WAIT_ALL) { - struct dma_fence **shared; - unsigned int count, i; - int ret; - - ret = dma_resv_get_fences(obj->base.resv, &excl, &count, - &shared); - if (ret) - return ret; - - for (i = 0; i < count; i++) { - i915_gem_fence_wait_priority(shared[i], attr); - dma_fence_put(shared[i]); - } - - kfree(shared); - } else { - excl = dma_resv_get_excl_unlocked(obj->base.resv); - } + struct dma_resv_iter cursor; + struct dma_fence *fence; - if (excl) { - i915_gem_fence_wait_priority(excl, attr); - dma_fence_put(excl); - } + dma_resv_iter_begin(&cursor, obj->base.resv, flags & I915_WAIT_ALL); + dma_resv_for_each_fence_unlocked(&cursor, fence) + i915_gem_fence_wait_priority(fence, attr); + dma_resv_iter_end(&cursor); return 0; }