From patchwork Mon Aug 7 17:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 132333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1667454vqr; Mon, 7 Aug 2023 12:32:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDiAkjMYcrGbyfOR+j/HO4Wu2jg32S+OR5ahQtnBi0MjLZMfqdm/rfvJwj6/O0WSelpIvj X-Received: by 2002:a05:6a20:12c9:b0:140:94b8:3b70 with SMTP id v9-20020a056a2012c900b0014094b83b70mr6749112pzg.17.1691436755098; Mon, 07 Aug 2023 12:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691436755; cv=none; d=google.com; s=arc-20160816; b=frsaBvj2N2EZ7mx/9mtC9xUgpXjmtSOmV0s19VrInbplmj+LUa2b60HFCGtGK/w2ev liWf3w3/TAUfWcNzDeRx3cdQMSZcBcao0WIhvSypp1biWOAayF415DpfF1jgJ2QY/fvL WtQE9D3E9RAt0uulyG+qt0cR19Xb80LhyqfaHxohvasLyYP+ri1VLTYfeK4NfXQd/OkB TVQ7bAnkCcStQABKc8S0PWOWyoL1/JF7+LvhqLH0VwF8CmENsAHrpTw6s9Y8L3IkWzI5 X2CvFXL5YWRRj4gfbp4CMaSGDaXe+IvWi7h20v8A/r8FRJoFEcx038dMW3lX0R9drq4D mFAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pMDPDTveGL0XcUxjW8MDNhSNAkJwzlTE+WboD+rmGEU=; fh=J43PHih+9WGB3yh8L/dcNPaiZbCd7QC1Y4yFtZtTd+c=; b=PrLBysTYJJU0PWmOAhJWEicXzekNxvICfSOFSZoK/ZaIK1wuXE62q6YkPrZpG5KmPk X/jjwbpg6723Ysrd+o1d8+ZdwOhr1jDU8G0psoDI7J2e5/NBwAW8ph1W/gFvp/8HVzNe Bkm5JeQH6618QnTJJNdTmCfpEMv4ckNLag5VqzvhB5f4KZwYu7aCuQtLQNJxHEgklqLb ufmlI9hqt4so3+5dlBJS9OpAzYutotVDY5eJFpMrnZ57kfrIHm88q/vv/IEJvPJ0qUB+ 1aur3rRdMi0FCOHCaA+481Tx9UGm5T8QgRXV0TuiuMwJSMwS4mDjhJcYTEYzc0ibX5Hb Wsng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=svVt1sgU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a63e00e000000b00563fe7f89e9si5860366pgh.186.2023.08.07.12.32.21; Mon, 07 Aug 2023 12:32:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=svVt1sgU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232125AbjHGRNJ (ORCPT + 99 others); Mon, 7 Aug 2023 13:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbjHGRMr (ORCPT ); Mon, 7 Aug 2023 13:12:47 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9199B1986; Mon, 7 Aug 2023 10:12:15 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-686d8c8fc65so3208615b3a.0; Mon, 07 Aug 2023 10:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691428334; x=1692033134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pMDPDTveGL0XcUxjW8MDNhSNAkJwzlTE+WboD+rmGEU=; b=svVt1sgUF7x1YbOXMTb/LXp7QjBOTHtNb8DiQLjmMtrEWj4ty/S5vDIeMV8H12mp3a XQr2nX5ioj/beq3rDTI6+ojt44Z4DxeRpai4d7e+k7pANjjydatG2mTgT37mQT7Ff539 uDj8V1vybkcUUTID5vu6jrgx0kyh1twMlgxmd2T/N6fPrh46TsL7aYuJY5RR87Vh4zEy jzL2d4hMqzqLQTjbIpnQ32lBmU9dxWSG1jGXSTvCDgrEhTokei0gJ4+/L2SorlPl8z5J 5/grMIa9/ueGhGhxfCtjYWIE6SmxmZ1/GJCCw6ZpV3idMpjTjdntWXwxcaffTQrSCBX8 jP6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691428334; x=1692033134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pMDPDTveGL0XcUxjW8MDNhSNAkJwzlTE+WboD+rmGEU=; b=TuozLMa5u7CvrGQu7MOtApJlVf4UqpgoVrov2cx4Vdf/bGteLg4VXd0MlDaROj14qP Mo2lOSQL8AmmoRIfB2sQpW3WJkz70N3piy9jLXV5zLMFD3vRmMKZJXHwoSLyAA/PKhpg lznL4LaAdRP8l3ju8QVIP+wSJ6HDoYC5aqEaRtpe66UFiKBLx/M47uRUv05eIBehtUFV mER+VzUlCRui/PAngeWMAh2UzhahCQtxDfB17LV4jszb4qmn6dmwJwgOjE5fQ5PPD3S8 aoWbU4d3+t+WkBcJD8OOxO1Ufqo8S27IN/ZZWMpazyUPddRwnJ0tQd5Ejmb415NHxh38 W/Mg== X-Gm-Message-State: AOJu0YzrfYWTMGl8Qavk/rcosl/FWe/0bk3jYmsnLPwcVZA8nyqwArSZ A7QMGFB0xB+2DBTB4uKoIvNZUxgTvHA= X-Received: by 2002:a05:6a20:9389:b0:135:110c:c6dd with SMTP id x9-20020a056a20938900b00135110cc6ddmr10076469pzh.53.1691428334171; Mon, 07 Aug 2023 10:12:14 -0700 (PDT) Received: from localhost ([2a00:79e1:abd:4a00:6c80:7c10:75a0:44f4]) by smtp.gmail.com with ESMTPSA id n14-20020a62e50e000000b0065438394fa4sm6564282pff.90.2023.08.07.10.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 10:12:13 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Luben Tuikov , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 8/9] drm/sched: Add (optional) fence signaling annotation Date: Mon, 7 Aug 2023 10:11:42 -0700 Message-ID: <20230807171148.210181-9-robdclark@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230807171148.210181-1-robdclark@gmail.com> References: <20230807171148.210181-1-robdclark@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773599987018989218 X-GMAIL-MSGID: 1773599987018989218 From: Rob Clark Based on https://lore.kernel.org/dri-devel/20200604081224.863494-10-daniel.vetter@ffwll.ch/ but made to be optional. Signed-off-by: Rob Clark Reviewed-by: Luben Tuikov --- drivers/gpu/drm/scheduler/sched_main.c | 9 +++++++++ include/drm/gpu_scheduler.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 7b2bfc10c1a5..b0368b815ff5 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -1005,10 +1005,15 @@ static bool drm_sched_blocked(struct drm_gpu_scheduler *sched) static int drm_sched_main(void *param) { struct drm_gpu_scheduler *sched = (struct drm_gpu_scheduler *)param; + const bool fence_signalling = sched->fence_signalling; + bool fence_cookie; int r; sched_set_fifo_low(current); + if (fence_signalling) + fence_cookie = dma_fence_begin_signalling(); + while (!kthread_should_stop()) { struct drm_sched_entity *entity = NULL; struct drm_sched_fence *s_fence; @@ -1064,6 +1069,10 @@ static int drm_sched_main(void *param) wake_up(&sched->job_scheduled); } + + if (fence_signalling) + dma_fence_end_signalling(fence_cookie); + return 0; } diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index e95b4837e5a3..58d958ad31a1 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -493,6 +493,7 @@ struct drm_sched_backend_ops { * @ready: marks if the underlying HW is ready to work * @free_guilty: A hit to time out handler to free the guilty job. * @dev: system &struct device + * @fence_signalling: Opt in to fence signalling annotations * * One scheduler is implemented for each hardware ring. */ @@ -517,6 +518,7 @@ struct drm_gpu_scheduler { bool ready; bool free_guilty; struct device *dev; + bool fence_signalling; }; int drm_sched_init(struct drm_gpu_scheduler *sched,