Mesa (master): i965/bufmgr: Skip wait ioctl when not busy.

Kenneth Graunke kwg at kemper.freedesktop.org
Sun Jul 23 02:35:23 UTC 2017


Module: Mesa
Branch: master
Commit: bdae2ddff89004c199b71cb6a4a306dee616f7f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdae2ddff89004c199b71cb6a4a306dee616f7f9

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Jul 17 12:57:20 2017 -0700

i965/bufmgr: Skip wait ioctl when not busy.

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.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_bufmgr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index fc2a227623..5edf4626b4 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -924,6 +924,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;




More information about the mesa-commit mailing list