Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3945293pxv; Mon, 26 Jul 2021 16:37:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA9/bYKpcAU1zte+ZftLtGVbf24468TiaFWdD/cb+k0KbcDPMDZGj2yvHPjcaDg/ryc+2B X-Received: by 2002:aa7:cd73:: with SMTP id ca19mr3340812edb.113.1627342653535; Mon, 26 Jul 2021 16:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627342653; cv=none; d=google.com; s=arc-20160816; b=mZd+F+cfNUJ1FXL5j2h4W50A2bhV+TJCDUj3ehLFTDTOsaGADvk8Bl5mJ8gPMvCfm9 qimOgLqR9+DhNMeZdezLdWbZxJbv0WvG6JoeaFnDcZRwCCK9a1rZGMl5MoClgJltNnGh FR8GbL+hcAZB6Xg3kQLSURWfUvaXCMpwWQ7/3xnbU+8RETywKTaB4JYZ/TlSYDmAKV95 ZANz3OqnD3zQBn4oSA/DJTzMool0p3di/qLr4yw3S9ZMAcMDfhl6MHRgyJAvV1r7fvSv ghpaNmFTTbCIeWtExBTPd3so8Ua5OHueeRaJTvoHhlN8Hy0IJzWt11+uaKb8NzvQgGdY S09Q== 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=oOCwRi9hxpNHgxPfLImA8XjRn0qGzkVI05nd0NTq6uk=; b=CNAQnCu0NdUivAQRiWNj0nlWp2wvzlknLYK3d3NN8RMJiWotgHSAVvNZFvc9lJj3t+ wZmx3bK9pDd6gkJacGH6540G486z5BfOettj/5ydmLrSh3bWmklmYesyWdDytgUfqjCM VOayhI3INZ+fh9hOyLOfefprj8n2VHCLP+uEYnnuvXhW5UYur1aExXQTcDsoCM4J6QNN hze9QUYAoysDT6Kpqs2FboQDT0qkeQe+um+hGyshmQ5oNykiN3PUkDXYOjd/x6N1uVAd Vw7vJihK5AtRPcTaCL9Bhem0VJ33l/+K8YLCSzEZhvQ0LeJ0vfIGeu0t9hfRUcQbo1K5 zsoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UMdDGkO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne39si1127790ejc.123.2021.07.26.16.37.10; Mon, 26 Jul 2021 16:37:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UMdDGkO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234162AbhGZWya (ORCPT + 99 others); Mon, 26 Jul 2021 18:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234038AbhGZWy3 (ORCPT ); Mon, 26 Jul 2021 18:54:29 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5C4C061764; Mon, 26 Jul 2021 16:34:56 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id g23-20020a17090a5797b02901765d605e14so2297406pji.5; Mon, 26 Jul 2021 16:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oOCwRi9hxpNHgxPfLImA8XjRn0qGzkVI05nd0NTq6uk=; b=UMdDGkO5sH4beFwSPlOOtv6JRzN+gpzELhacSFi7vvaQQ1PwmNbkfYf44YSJQaBLpr vVV0beEQqJV0NuTrh3WVluml5kosYKXPr9U5iyNbGEHEnWPREtu7FUB2q7w+oJTefR1N nxhrxUsL/yhwl8fKcflbrIpY5obQR2TALxuMCayo8c8wDQO0eaI6GFbUCJf3pr8RanC3 lpKxIhzu44oKfzHbedvRslZeVPkbiBMj0MBXvllJzc/2Ok4djmZsXBK3c9DbPUgVz+GT Ad5XrI/AMY80dotYjiTUCM0Zb4DP3NOJpJAs9lA+0Yu8rBP+Sisqs25ugYEbBPneZq4S A5ng== 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=oOCwRi9hxpNHgxPfLImA8XjRn0qGzkVI05nd0NTq6uk=; b=tl3mk+FL7DWE+MK4T0S/V/V9+tJMh9XZCggGxAALBFHnaNQI1VG9Wg9CtTvHohnr0y eAhP/9F+zTaHXOOPB9lFCXZ1orMrzjN/O2BpHVj7oTZ5ViG9SWbPS2BJPMFhUCA6g6a+ oNUCei1LAI34TgzP1o2nfBACdYTK2VeFpl4f5tV1sgTF9pxZytJrZV9a5DV2iSeqn7aF kqlj4mmmLdYmtdEv1eeZeqp2o9T0KpO5yYW6GLf+93TLIVVKO0j0hzkxZjlBTw527yOH J7n8SDulBgyRBJVXI9W3VU8UKsmAda48Z6KK4TOfD6kXT/Y6X3pjOvAvNyOjTArGoirZ 0kBw== X-Gm-Message-State: AOAM533/+5wmoh1jZXTaKB6BM5Si8icp+1ncEbUrgZFk5MVqnjAOorVN XkUwqffkHv1TE5a19JxqYkE= X-Received: by 2002:a63:3445:: with SMTP id b66mr20626420pga.141.1627342496218; Mon, 26 Jul 2021 16:34:56 -0700 (PDT) Received: from localhost ([2601:1c0:5200:a6:307:a401:7b76:c6e5]) by smtp.gmail.com with ESMTPSA id t205sm1171971pfc.32.2021.07.26.16.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 16:34:55 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: Daniel Vetter , Matthew Brost , =?UTF-8?q?Christian=20K=C3=B6nig?= , Rob Clark , David Airlie , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Tian Tao , Luben Tuikov , Andrey Grodzovsky , Alyssa Rosenzweig , Maarten Lankhorst , Jack Zhang , linux-kernel@vger.kernel.org (open list), linux-media@vger.kernel.org (open list:DMA BUFFER SHARING FRAMEWORK), linaro-mm-sig@lists.linaro.org (moderated list:DMA BUFFER SHARING FRAMEWORK) Subject: [RFC 4/4] drm/scheduler: Add fence deadline support Date: Mon, 26 Jul 2021 16:38:51 -0700 Message-Id: <20210726233854.2453899-5-robdclark@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210726233854.2453899-1-robdclark@gmail.com> References: <20210726233854.2453899-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark As the finished fence is the one that is exposed to userspace, and therefore the one that other operations, like atomic update, would block on, we need to propagate the deadline from from the finished fence to the actual hw fence. Signed-off-by: Rob Clark --- drivers/gpu/drm/scheduler/sched_fence.c | 10 ++++++++++ drivers/gpu/drm/scheduler/sched_main.c | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_fence.c b/drivers/gpu/drm/scheduler/sched_fence.c index 69de2c76731f..3aa6351d2101 100644 --- a/drivers/gpu/drm/scheduler/sched_fence.c +++ b/drivers/gpu/drm/scheduler/sched_fence.c @@ -128,6 +128,15 @@ static void drm_sched_fence_release_finished(struct dma_fence *f) dma_fence_put(&fence->scheduled); } +static void drm_sched_fence_set_deadline_finished(struct dma_fence *f, + ktime_t deadline) +{ + struct drm_sched_fence *fence = to_drm_sched_fence(f); + + if (fence->parent) + dma_fence_set_deadline(fence->parent, deadline); +} + static const struct dma_fence_ops drm_sched_fence_ops_scheduled = { .get_driver_name = drm_sched_fence_get_driver_name, .get_timeline_name = drm_sched_fence_get_timeline_name, @@ -138,6 +147,7 @@ static const struct dma_fence_ops drm_sched_fence_ops_finished = { .get_driver_name = drm_sched_fence_get_driver_name, .get_timeline_name = drm_sched_fence_get_timeline_name, .release = drm_sched_fence_release_finished, + .set_deadline = drm_sched_fence_set_deadline_finished, }; struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index a2a953693b45..fcc601962e92 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -818,6 +818,9 @@ static int drm_sched_main(void *param) if (!IS_ERR_OR_NULL(fence)) { s_fence->parent = dma_fence_get(fence); + if (test_bit(DMA_FENCE_FLAG_HAS_DEADLINE_BIT, + &s_fence->finished.flags)) + dma_fence_set_deadline(fence, s_fence->finished.deadline); r = dma_fence_add_callback(fence, &sched_job->cb, drm_sched_job_done_cb); if (r == -ENOENT) -- 2.31.1