[PATCH] drm/nouveau: Skip fence context seqno check if notifies are enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the fence context has notifies enabled, each of the fences'
FENCE_FLAG_SIGNALED_BIT will be updated from the interrupt. We can rely
on this status for reporting the current fence_is_signaled() and so
avoid an expensive uncached read.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Ben Skeggs <bskeggs@xxxxxxxxxx>
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Cc: nouveau@xxxxxxxxxxxxxxxxxxxxx
---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 4bb9ab892ae1..7daed5c33043 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -510,6 +510,16 @@ static bool nouveau_fence_is_signaled(struct fence *f)
 	struct nouveau_channel *chan;
 	bool ret = false;
 
+	/* If the notify is already active, we can rely on
+	 * FENCE_FLAG_SIGNALED_BIT being accurate and skip checking the
+	 * current seqno as fctx->read() requires an expensive uncached read.
+	 */
+	if (test_bit(FENCE_FLAG_USER_BITS, &fence->base.flags))
+		return false;
+
+	if (READ_ONCE(fctx->notify_ref))
+		return false;
+
 	rcu_read_lock();
 	chan = rcu_dereference(fence->channel);
 	if (chan)
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux