Mesa (master): i965/bufmgr: Allocate BO pages outside of the kernel' s locking.

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


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jul 21 12:29:30 2017 -0700

i965/bufmgr: Allocate BO pages outside of the kernel's locking.

Suggested by Chris Wilson.

v2: Set the write domain to 0 (suggested by Chris).

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

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index 46da53d353..cd85874ea5 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -382,6 +382,19 @@ retry:
 
       if (bo_set_tiling_internal(bo, tiling_mode, stride))
          goto err_free;
+
+      /* Calling set_domain() will allocate pages for the BO outside of the
+       * struct mutex lock in the kernel, which is more efficient than waiting
+       * to create them during the first execbuf that uses the BO.
+       */
+      struct drm_i915_gem_set_domain sd = {
+         .handle = bo->gem_handle,
+         .read_domains = I915_GEM_DOMAIN_CPU,
+         .write_domain = 0,
+      };
+
+      if (drmIoctl(bo->bufmgr->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &sd) != 0)
+         goto err_free;
    }
 
    bo->name = name;




More information about the mesa-commit mailing list