[Mesa-dev] [PATCH 1/8] i965/bufmgr: Bail early in bo_busy if the BO is flagged idle

Jason Ekstrand jason at jlekstrand.net
Wed Jun 13 20:26:53 UTC 2018


This has the potential to make brw_bo_busy a bit cheaper for internal
BOs if someone has checked it for busy or waited on it before.  We
already do the same thing in brw_bo_wait.
---
 src/mesa/drivers/dri/i965/brw_bufmgr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index 7ac3bcad3da..58bb559fdee 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -448,6 +448,11 @@ int
 brw_bo_busy(struct brw_bo *bo)
 {
    struct brw_bufmgr *bufmgr = bo->bufmgr;
+
+   /* If we know it's idle, don't bother with the kernel round trip */
+   if (bo->idle && !bo->external)
+      return false;
+
    struct drm_i915_gem_busy busy = { .handle = bo->gem_handle };
 
    int ret = drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_BUSY, &busy);
-- 
2.17.1



More information about the mesa-dev mailing list