All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/syncobj: Use dma_fence_wait for the simple wait case
@ 2018-05-05 10:55 Chris Wilson
  2018-05-05 11:17 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chris Wilson @ 2018-05-05 10:55 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

When waiting for a single fence beneath a syncobj, forgo our open coding
for waiting over multiple fences and call the driver specific
dma_fence_wait_timeout(). This gives the opportunity for the driver to
handle it more efficiently then the lcd of signal callbacks, and avoids
the temporary allocations and array iterations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_syncobj.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index d4f4ce484529..c0f787f7a298 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -695,6 +695,14 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
 	signed long ret;
 	uint32_t signaled_count, i;
 
+	/* KISS for the common case of waiting for a single submitted fence. */
+	if (count == 1 && (fence = drm_syncobj_fence_get(syncobjs[0]))) {
+		ret = dma_fence_wait_timeout(fence, true, timeout);
+		dma_fence_put(fence);
+		*idx = 0;
+		return ret;
+	}
+
 	entries = kcalloc(count, sizeof(*entries), GFP_KERNEL);
 	if (!entries)
 		return -ENOMEM;
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-08  5:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-05 10:55 [PATCH] drm/syncobj: Use dma_fence_wait for the simple wait case Chris Wilson
2018-05-05 11:17 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-05-05 11:33 ` ✓ Fi.CI.BAT: success " Patchwork
2018-05-05 12:25 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-05-08  5:51 ` [PATCH] " Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.