From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org,
"Daniel Vetter" <daniel@ffwll.ch>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
"Michel Dänzer" <michel@daenzer.net>,
"Tvrtko Ursulin" <tvrtko.ursulin@intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Pekka Paalanen" <ppaalanen@gmail.com>,
"Simon Ser" <contact@emersion.fr>,
"Luben Tuikov" <luben.tuikov@amd.com>,
"Rob Clark" <robdclark@chromium.org>,
"Christian König" <christian.koenig@amd.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
linux-media@vger.kernel.org (open list:DMA BUFFER SHARING
FRAMEWORK),
linaro-mm-sig@lists.linaro.org (moderated list:DMA BUFFER
SHARING FRAMEWORK), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v9 04/15] dma-buf/dma-resv: Add a way to set fence deadline
Date: Thu, 2 Mar 2023 15:53:26 -0800 [thread overview]
Message-ID: <20230302235356.3148279-5-robdclark@gmail.com> (raw)
In-Reply-To: <20230302235356.3148279-1-robdclark@gmail.com>
From: Rob Clark <robdclark@chromium.org>
Add a way to set a deadline on remaining resv fences according to the
requested usage.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
drivers/dma-buf/dma-resv.c | 22 ++++++++++++++++++++++
include/linux/dma-resv.h | 2 ++
2 files changed, 24 insertions(+)
diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
index 1c76aed8e262..2a594b754af1 100644
--- a/drivers/dma-buf/dma-resv.c
+++ b/drivers/dma-buf/dma-resv.c
@@ -684,6 +684,28 @@ long dma_resv_wait_timeout(struct dma_resv *obj, enum dma_resv_usage usage,
}
EXPORT_SYMBOL_GPL(dma_resv_wait_timeout);
+/**
+ * dma_resv_set_deadline - Set a deadline on reservation's objects fences
+ * @obj: the reservation object
+ * @usage: controls which fences to include, see enum dma_resv_usage.
+ * @deadline: the requested deadline (MONOTONIC)
+ *
+ * May be called without holding the dma_resv lock. Sets @deadline on
+ * all fences filtered by @usage.
+ */
+void dma_resv_set_deadline(struct dma_resv *obj, enum dma_resv_usage usage,
+ ktime_t deadline)
+{
+ struct dma_resv_iter cursor;
+ struct dma_fence *fence;
+
+ dma_resv_iter_begin(&cursor, obj, usage);
+ dma_resv_for_each_fence_unlocked(&cursor, fence) {
+ dma_fence_set_deadline(fence, deadline);
+ }
+ dma_resv_iter_end(&cursor);
+}
+EXPORT_SYMBOL_GPL(dma_resv_set_deadline);
/**
* dma_resv_test_signaled - Test if a reservation object's fences have been
diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h
index 0637659a702c..8d0e34dad446 100644
--- a/include/linux/dma-resv.h
+++ b/include/linux/dma-resv.h
@@ -479,6 +479,8 @@ int dma_resv_get_singleton(struct dma_resv *obj, enum dma_resv_usage usage,
int dma_resv_copy_fences(struct dma_resv *dst, struct dma_resv *src);
long dma_resv_wait_timeout(struct dma_resv *obj, enum dma_resv_usage usage,
bool intr, unsigned long timeout);
+void dma_resv_set_deadline(struct dma_resv *obj, enum dma_resv_usage usage,
+ ktime_t deadline);
bool dma_resv_test_signaled(struct dma_resv *obj, enum dma_resv_usage usage);
void dma_resv_describe(struct dma_resv *obj, struct seq_file *seq);
--
2.39.1
next prev parent reply other threads:[~2023-03-02 23:54 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 23:53 [PATCH v9 00/15] dma-fence: Deadline awareness Rob Clark
2023-03-02 23:53 ` [PATCH v9 01/15] dma-buf/dma-fence: Add deadline awareness Rob Clark
2023-03-02 23:53 ` [PATCH v9 02/15] dma-buf/fence-array: Add fence deadline support Rob Clark
2023-03-02 23:53 ` [PATCH v9 03/15] dma-buf/fence-chain: " Rob Clark
2023-03-02 23:53 ` Rob Clark [this message]
2023-03-02 23:53 ` [PATCH v9 05/15] dma-buf/sync_file: Surface sync-file uABI Rob Clark
2023-03-02 23:53 ` [PATCH v9 06/15] dma-buf/sync_file: Add SET_DEADLINE ioctl Rob Clark
2023-03-02 23:53 ` [PATCH v9 07/15] dma-buf/sw_sync: Add fence deadline support Rob Clark
2023-03-02 23:53 ` [PATCH v9 08/15] drm/scheduler: " Rob Clark
2023-03-02 23:53 ` [PATCH v9 09/15] drm/syncobj: Add deadline support for syncobj waits Rob Clark
2023-03-02 23:53 ` [PATCH v9 10/15] drm/vblank: Add helper to get next vblank time Rob Clark
2023-03-02 23:53 ` [PATCH v9 11/15] drm/atomic-helper: Set fence deadline for vblank Rob Clark
2023-03-03 15:12 ` Ville Syrjälä
2023-03-03 15:45 ` Rob Clark
2023-03-03 15:52 ` Ville Syrjälä
2023-03-02 23:53 ` [PATCH v9 12/15] drm/msm: Add deadline based boost support Rob Clark
2023-03-03 10:10 ` Dmitry Baryshkov
2023-03-03 17:03 ` Rob Clark
2023-03-03 23:53 ` Dmitry Baryshkov
2023-03-02 23:53 ` [PATCH v9 13/15] drm/msm: Add wait-boost support Rob Clark
2023-03-03 10:04 ` Dmitry Baryshkov
2023-03-02 23:53 ` [PATCH v9 14/15] drm/msm/atomic: Switch to vblank_start helper Rob Clark
2023-03-03 10:04 ` Dmitry Baryshkov
2023-03-02 23:53 ` [PATCH v9 15/15] drm/i915: Add deadline based boost support Rob Clark
2023-03-03 3:21 ` Rodrigo Vivi
2023-03-03 9:58 ` Tvrtko Ursulin
2023-03-03 11:21 ` [Intel-gfx] " Andi Shyti
2023-03-03 14:48 ` Rob Clark
2023-03-03 15:00 ` Ville Syrjälä
2023-03-03 15:19 ` Ville Syrjälä
2023-03-03 15:43 ` Rob Clark
2023-03-03 15:07 ` Tvrtko Ursulin
2023-03-03 15:41 ` [Freedreno] " Rob Clark
2023-03-03 18:20 ` Matt Turner
2023-03-03 14:56 ` Rob Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230302235356.3148279-5-robdclark@gmail.com \
--to=robdclark@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=contact@emersion.fr \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=luben.tuikov@amd.com \
--cc=michel@daenzer.net \
--cc=ppaalanen@gmail.com \
--cc=robdclark@chromium.org \
--cc=rodrigo.vivi@intel.com \
--cc=sumit.semwal@linaro.org \
--cc=tvrtko.ursulin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox