From patchwork Mon Aug 26 14:57:23 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: 11114799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ADA6814DB for ; Mon, 26 Aug 2019 14:57:41 +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 95EC420679 for ; Mon, 26 Aug 2019 14:57:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95EC420679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BB6589F5B; Mon, 26 Aug 2019 14:57:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id D4D6B89F4F for ; Mon, 26 Aug 2019 14:57:35 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id k1so15812029wmi.1 for ; Mon, 26 Aug 2019 07:57:35 -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=QMED2fB1j8XW403akPNL5uWUyUywT4Cr7sKX6D8d33c=; b=ecR2aQfHOEmA0rJ11SVB+y/QdQA2qde9GHkUbEyZUhdTrsj8x44pOtutus07wV7fn6 /QhZq3qZ/a/zamaWLdDKVnNt+tGZ+V4QgH1BgPEkjxAXViWKsWShYQbLeP2DRHrGtJiJ vLJHBL/PyG7CE1NMSWZ861N3N6ovqxhaFw7GW91YqkMKohRnX1FFSPLpp7nOM+ZQ0JPl kiefXt70Ktv2Cs6LDFPEpcu+bjKIgR7k1MDlZQvZ3/BvA6uLivX6l9UIpNzHqpRTJPkI k331sA6eGun+3xOT1CQ+cn0nkB1SGKOV5zDzoSbaRHuztQUTKZokMZxCudcFqf/s7ge/ LrCQ== X-Gm-Message-State: APjAAAVvB4jI2vIAdjT3kishu6al87WTB7zi/rl1ye5cm7RhutnCam8C rIjgzgQ/WAmDJEtJQMkoO1AE6ht3 X-Google-Smtp-Source: APXvYqxWrDCpwp2XKLAqn17OsS4W4bwVW/axSxwYhqkhNORm2BfihpaM3ixcXbRJ4TtMdoZcfN+eGQ== X-Received: by 2002:a05:600c:da:: with SMTP id u26mr15028676wmm.70.1566831454269; Mon, 26 Aug 2019 07:57:34 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:b0e3:7a12:98e5:ca6]) by smtp.gmail.com with ESMTPSA id z8sm9865624wmi.7.2019.08.26.07.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 07:57:33 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk, daniel.vetter@ffwll.ch, sumit.semwal@linaro.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH 1/9] dma-buf: fix dma_fence_array_signaled Date: Mon, 26 Aug 2019 16:57:23 +0200 Message-Id: <20190826145731.1725-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190826145731.1725-1-christian.koenig@amd.com> References: <20190826145731.1725-1-christian.koenig@amd.com> MIME-Version: 1.0 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=QMED2fB1j8XW403akPNL5uWUyUywT4Cr7sKX6D8d33c=; b=vKMW8MnMsmIfZ3q9RKQsUCPDIpRVlAZxXdCi/c2/qL3oi4csrqjL8ztMO84wk7DCe2 +K7m/jziO3Tihu4FxebbMkvnRsFCJZ1PKm0j36Pr9q9ILzVk/1bfl3mJqSZb0Lf1bwBB 0ktVKalLn8qe2gfVWiT8kQHVoT21InWLu6Fr+a7pNoMRx77kUSpc+5zQzY73THiwhulH X3xHSGEiYXXTOY8RAMfoJgvfG57HmWqUzjPu8ob1xlAMDMSe2xwgjcnzzURDgBL3Ow4Y ovOaieDn9S6JqWBKjvky77NDLPhURbe2s9tIG9V3nlQkCPUsoVK5NyNJtRMudP464IGL y/vA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The function is supposed to give a hint even if signaling is not enabled. Signed-off-by: Christian König --- drivers/dma-buf/dma-fence-array.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c index d3fbd950be94..52068ee5eb35 100644 --- a/drivers/dma-buf/dma-fence-array.c +++ b/drivers/dma-buf/dma-fence-array.c @@ -103,8 +103,18 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence) static bool dma_fence_array_signaled(struct dma_fence *fence) { struct dma_fence_array *array = to_dma_fence_array(fence); + int i, num_pending; - return atomic_read(&array->num_pending) <= 0; + num_pending = atomic_read(&array->num_pending); + if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) + return num_pending <= 0; + + for (i = 0; i < array->num_fences; ++i) + if (dma_fence_is_signaled(array->fences[i]) && + --num_pending == 0) + return true; + + return false; } static void dma_fence_array_release(struct dma_fence *fence)