From patchwork Thu Aug 5 10:46:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12420937 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 55D15C4338F for ; Thu, 5 Aug 2021 10:48:12 +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 2823E6105A for ; Thu, 5 Aug 2021 10:48:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2823E6105A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 B4C1689CAA; Thu, 5 Aug 2021 10:47:35 +0000 (UTC) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABF9D6E9AE for ; Thu, 5 Aug 2021 10:47:25 +0000 (UTC) Received: by mail-ed1-x530.google.com with SMTP id i6so7745388edu.1 for ; Thu, 05 Aug 2021 03:47:25 -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=SrBx4CBwHL4LCxd/L17wD9kVL8jLKB/ia22GTxIDDNY=; b=Hy0KTKLZNoa/0p5YbWam97oduG3xEHgFvf3KJ7OW6urEcjBQEmnW47jE26EYT9tONi AOjmbGVjns3OczDXzOYeQAUtqcx6LrSb7skgBK/gRmxAsI+YfQ82w9eojV/S6zR13zhT d5sUZXwRYVbAA0ax9g/Pl0ocECKvmfP++9Eis= 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=SrBx4CBwHL4LCxd/L17wD9kVL8jLKB/ia22GTxIDDNY=; b=LtxGdd/ViJPdzhFP1m8nSn/Y+CwmSfPkCiIX3aL933BRMv6XqEaP89ZH/HZe7i4IoB gBfOrlcjVzWsMc74QCRVsAypaW9hW1QVZjDKtJ9+PNH5bW0hjEGGrRceTNMMLgUprFPA 0lb86SgiPbI9XMpXlpSr+CdNTlGrnBX0hwhcgiQ2HzqYUbPCOQvrLTSMttWfMnoKza7S 4s+qQCzdu4iQ2lTsG+MZ03IHwMqijmhnqIy7DP3DDGfDMxGZHRTB0F9UE3jsvbEXagQL SXqBzyeit26eaEXTAUkPO4D2DGxZo2ItLjqVc+sLe1Wm7zO4nUIxbvj8E1j5ByNW6/DH 9BTQ== X-Gm-Message-State: AOAM533v/rQ5Ob5GCVDQSbCUey7Gz1JdSar5LegVUi/l6/ri3/Uk08BH sKSCDZgROZ6jydEZJnEqHlqMwTO5iDOxTA== X-Google-Smtp-Source: ABdhPJxcatNB3uMDIlS/IvkYf0eyNei/2iL2TzILdhJkT0UazEGiJemXJK1mqin9u7Tajl5QAxeK/Q== X-Received: by 2002:a05:6402:124e:: with SMTP id l14mr5899834edw.356.1628160444153; Thu, 05 Aug 2021 03:47:24 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id p5sm1578809ejl.73.2021.08.05.03.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 03:47:23 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , Daniel Vetter , Lucas Stach , Melissa Wen , Daniel Vetter , =?utf-8?q?Christian_K=C3=B6nig?= , Luben Tuikov , Andrey Grodzovsky , Alex Deucher Subject: [PATCH v5 14/20] drm/sched: Don't store self-dependencies Date: Thu, 5 Aug 2021 12:46:59 +0200 Message-Id: <20210805104705.862416-15-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210805104705.862416-1-daniel.vetter@ffwll.ch> References: <20210805104705.862416-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , 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 Acked-by: Melissa Wen Signed-off-by: Daniel Vetter Cc: "Christian König" Cc: Daniel Vetter Cc: Luben Tuikov Cc: Andrey Grodzovsky Cc: Alex Deucher --- 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 f77456929139..49e507f91ec0 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -660,6 +660,13 @@ int drm_sched_job_add_dependency(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.