[Intel-gfx] [PATCH] drm/i915: Move flags describing VMA mappings into the VMA

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 24 14:09:08 CEST 2014


On Fri, Oct 24, 2014 at 12:42:33PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> If these flags are on the object level it will be more difficult to allow
> for multiple VMAs per object.
> 
> v2: Simplification and cleanup after code review comments (Chris Wilson).
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 053d99e..80f0c80 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -567,6 +567,7 @@ i915_error_object_create(struct drm_i915_private *dev_priv,
>  			 struct i915_address_space *vm)
>  {
>  	struct drm_i915_error_object *dst;
> +	struct i915_vma *vma = NULL;
>  	int num_pages;
>  	bool use_ggtt;
>  	int i = 0;
> @@ -587,16 +588,17 @@ i915_error_object_create(struct drm_i915_private *dev_priv,
>  		dst->gtt_offset = -1;
>  
>  	reloc_offset = dst->gtt_offset;
> +	if (i915_is_ggtt(vm))
> +		vma = i915_gem_obj_to_ggtt(src);
>  	use_ggtt = (src->cache_level == I915_CACHE_NONE &&
> -		    i915_is_ggtt(vm) &&
> -		    src->has_global_gtt_mapping &&
> -		    reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end);
> +		   vma && (vma->bound & GLOBAL_BIND) &&
> +		   reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end);
>  
>  	/* Cannot access stolen address directly, try to use the aperture */
>  	if (src->stolen) {
>  		use_ggtt = true;
>  
> -		if (!src->has_global_gtt_mapping)
> +		if (!(vma && vma->bound & GLOBAL_BIND))
>  			goto unwind;

This looked odd as I have the vma being passed in:

static struct drm_i915_error_object *
i915_error_object_create(struct drm_i915_private *dev_priv,
                         struct i915_vma *vma);

but I presume the ppgtt error-capture is still outstanding.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list