[Mesa-dev] [PATCH 3/7] i965/bufmgr: Allocate BO pages outside of the kernel's locking.

Chris Wilson chris at chris-wilson.co.uk
Sat Jul 22 09:09:43 UTC 2017


Quoting Kenneth Graunke (2017-07-22 00:17:43)
> Suggested by Chris Wilson.
> ---
>  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 1669d26e990..78a4626d430 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 = I915_GEM_DOMAIN_CPU,

We can pass .write_domain = 0 here. Should be no different as the bo is
created in the CPU write domain and already marked as dirty. I think it
is a better reflection of intent that we are just pulling in the pages.
-Chris


More information about the mesa-dev mailing list