[Intel-gfx] [PATCH 1/2] intel: Use I915_EXEC_HANDLE_LUT when available

Chris Wilson chris at chris-wilson.co.uk
Sat Jan 17 01:46:35 PST 2015


On Fri, Jan 16, 2015 at 05:45:59PM -0800, Kristian Høgsberg wrote:
> In userspace we can track which buffer a relocation refers to in
> constant time.  However, the kernel has to look up the per-fd gem
> handle for each relocation.  Using the I915_EXEC_HANDLE_LUT flag lets
> us use the the bos validation list index instead of the gem handle in
> the relocation entries.  This allows the kernel to look up the bo for
> a reloc in constant time.
             ^near

> Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>

Ok, I thought libdrm_intel was doing something questionable with its
cache of reloc trees, but that doesn't actually impact the execlist.

With the minor inline comment,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

> ---
>  intel/intel_bufmgr_gem.c | 33 +++++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> @@ -3569,6 +3594,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
>  		}
>  	}
>  
> +	gp.param = I915_PARAM_HAS_EXEC_HANDLE_LUT;
> +	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
> +	bufmgr_gem->has_handle_lut = ret == 0;

Better to use

val = 0;
gp.value = &val;
(void)drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
bufmgr_gem->has_handle_lut = val > 0;

for future proofing.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list