[Intel-gfx] [PATCH 10/22] drm/i915: Record allocated vma size

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Fri Jul 29 06:53:11 UTC 2016


On ke, 2016-07-27 at 12:14 +0100, Chris Wilson wrote:
> -uint32_t
> -i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode);
> -uint32_t
> -i915_gem_get_gtt_alignment(struct drm_device *dev, uint32_t size,
> -			    int tiling_mode, bool fenced);
> +uint64_t

u64 for consistency with code elsewhere. Applies to all the type
changes.

>  	start = flags & PIN_OFFSET_BIAS ? flags & PIN_OFFSET_MASK : 0;
> -	end = vm->total;
> +
> +	end = vma->vm->total;

While touching, I might change the end to vm_end or so...

>  	if (flags & PIN_MAPPABLE)
>  		end = min_t(u64, end, dev_priv->ggtt.mappable_end);
>  	if (flags & PIN_ZONE_4G)
> @@ -3030,8 +3018,7 @@ i915_gem_object_insert_into_vm(struct drm_i915_gem_object *obj,
>  	 * attempt to find space.
>  	 */
>  	if (size > end) {
> -		DRM_DEBUG("Attempting to bind an object (view type=%u) larger than the aperture: request=%llu [object=%zd] > %s aperture=%llu\n",
> -			  ggtt_view ? ggtt_view->type : 0,
> +		DRM_DEBUG("Attempting to bind an object larger than the aperture: request=%llu [object=%zd] > %s aperture=%llu\n",

No view type no more?

>  		vma->node.start = offset;
>  		vma->node.size = size;
>  		vma->node.color = obj->cache_level;
> -		ret = drm_mm_reserve_node(&vm->mm, &vma->node);
> +		ret = drm_mm_reserve_node(&vma->vm->mm, &vma->node);

Not sure if dropping the vm alias makes things look any better, unless
you intend to create i915_vma_reserve_mem() or so?

> @@ -3077,37 +3060,39 @@ i915_gem_object_insert_into_vm(struct drm_i915_gem_object *obj,
>  			alloc_flag = DRM_MM_CREATE_DEFAULT;
>  		}
>  
> +		if (alignment <= 4096)
> +			alignment = 0; /* for efficient drm_mm searching */
> +

This is obviously not related and should be mentioned in the commit message or split.

>  void __iomem *i915_vma_pin_iomap(struct i915_vma *vma)
>  {
>  	void __iomem *ptr;
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index a79015bf7261..5c3a093b83c1 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -180,6 +180,7 @@ struct i915_vma {
>  	struct drm_i915_gem_object *obj;
>  	struct i915_address_space *vm;
>  	void __iomem *iomap;
> +	u64 size;

I'm certain I had addition of this member in the list time ago. Good
that we're moving in the right direction with the vma stuff.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list