[Mesa-dev] [PATCH 2/2] i965/bufmgr: Skip wait ioctl when busy.
Kenneth Graunke
kenneth at whitecape.org
Tue Jul 18 05:14:53 UTC 2017
If the buffer is idle, we I915_GEM_WAIT will return immediately,
so we may as well skip the ioctl altogether. We can't trust the
"idle" flag for external buffers, but for most, it should be fine.
---
src/mesa/drivers/dri/i965/brw_bufmgr.c | 4 ++++
1 file changed, 4 insertions(+)
This patch should be legitimate regardless of how bogus the previous
one ends up being, and could land immediately.
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index e1b98755e39..1669d26e990 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -911,6 +911,10 @@ brw_bo_wait(struct brw_bo *bo, int64_t timeout_ns)
struct drm_i915_gem_wait wait;
int ret;
+ /* If we know it's idle, don't bother with the kernel round trip */
+ if (bo->idle && !bo->external)
+ return 0;
+
memclear(wait);
wait.bo_handle = bo->gem_handle;
wait.timeout_ns = timeout_ns;
--
2.13.3
More information about the mesa-dev
mailing list