From mboxrd@z Thu Jan 1 00:00:00 1970 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 1A792C07E95 for ; Fri, 2 Jul 2021 21:38:45 +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 E062E613FB for ; Fri, 2 Jul 2021 21:38:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E062E613FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 4167F6E207; Fri, 2 Jul 2021 21:38:34 +0000 (UTC) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0743289D99 for ; Fri, 2 Jul 2021 21:38:32 +0000 (UTC) Received: by mail-wr1-x434.google.com with SMTP id t15so10689849wry.11 for ; Fri, 02 Jul 2021 14:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Aq+Ijv7C9daTM0EcdaIv+YFfJaleCeNjPIDM8wzQUzw=; b=bdsHBFt3k8J1Ekh/NG+ZDU3xpSBfmJZMPPhLZfa2j1RfyCTK7Wz5wPh4gOtDUOfz98 uZ5ZzWkC92p58XPqfc0am7gV3wxzePWZKFsXk0JZWyQA9gfKfHwufkmszOYY45oLHl9b MiG710cjuojzM9353TyLcds9KZAFhlG5hhTU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Aq+Ijv7C9daTM0EcdaIv+YFfJaleCeNjPIDM8wzQUzw=; b=svhUxW8BPbhey8huaXFI0PvCJEgUdOKHFrIYGa+WmNR17ibGGd5tWbLfwEmTMoah48 fRU0uZfelVpLH8RtX/9T7L7FB3NMTDxKkuxGoOANB3m5q2lfsJTeGp15ZsTsCpRB29pe MJ5VPGTLZK1MjmnjjRJ8WK5W+iEU0vwnhasokdt0PQMrDkTWAqAy9EkyoFqI/OtUiCgN XHY6ubC2W9pgsWjOB87Hn55klxa56MrKJU02AaiDh3xzCnywmQvEFdLhtQY1Thftx5Fw Gl6+RwXAg6poYofOCJRD2Bua1J4eqkHOuQezNy3Nknm6/q6nEkdNAzl/Yzhv3hwIEdLF a2VQ== X-Gm-Message-State: AOAM531Lpz4uXTc2PuowIeZYASHjucXE9Z8XW90usGPq/TJBZlH78L2z XcLRseiifNMhAFMXr4eTA8M2mM+Mk+VpYg== X-Google-Smtp-Source: ABdhPJxpsnuRlF+5B04GUwH21HSjlFZq4zFTfo2fhrdll6/AtzLsLMtuM4/pYdiKgNq0RDOsrudNgQ== X-Received: by 2002:a5d:668e:: with SMTP id l14mr1790677wru.227.1625261910814; Fri, 02 Jul 2021 14:38:30 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id n19sm4007222wms.4.2021.07.02.14.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 14:38:30 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH v2 10/11] drm/sched: Don't store self-dependencies Date: Fri, 2 Jul 2021 23:38:14 +0200 Message-Id: <20210702213815.2249499-11-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0.rc2 In-Reply-To: <20210702213815.2249499-1-daniel.vetter@ffwll.ch> References: <20210702213815.2249499-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jack Zhang , Daniel Vetter , Luben Tuikov , Alex Deucher , Daniel Vetter , =?UTF-8?q?Christian=20K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This is essentially part of drm_sched_dependency_optimized(), which only amdgpu seems to make use of. Use it a bit more. This would mean that as-is amdgpu can't use the dependency helpers, at least not with the current approach amdgpu has for deciding whether a vm_flush is needed. Since amdgpu also has very special rules around implicit fencing it can't use those helpers either, and adding a drm_sched_job_await_fence_always or similar for amdgpu wouldn't be too onerous. That way the special case handling for amdgpu sticks even more out and we have higher chances that reviewers that go across all drivers wont miss it. Reviewed-by: Lucas Stach Signed-off-by: Daniel Vetter Cc: "Christian König" Cc: Daniel Vetter Cc: Luben Tuikov Cc: Andrey Grodzovsky Cc: Alex Deucher Cc: Jack Zhang --- drivers/gpu/drm/scheduler/sched_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 12d533486518..de76f7e14e0d 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -651,6 +651,13 @@ int drm_sched_job_await_fence(struct drm_sched_job *job, if (!fence) return 0; + /* if it's a fence from us it's guaranteed to be earlier */ + if (fence->context == job->entity->fence_context || + fence->context == job->entity->fence_context + 1) { + dma_fence_put(fence); + return 0; + } + /* Deduplicate if we already depend on a fence from the same context. * This lets the size of the array of deps scale with the number of * engines involved, rather than the number of BOs. -- 2.32.0.rc2