[Intel-gfx] [PATCH 5/8] drm/i915: Convert active API to VMA

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 12 00:14:30 CEST 2013


On Wed, Sep 11, 2013 at 02:57:52PM -0700, Ben Widawsky wrote:
>  	if (from != NULL) {
> -		struct drm_i915_private *dev_priv = from->obj->base.dev->dev_private;
> -		struct i915_address_space *ggtt = &dev_priv->gtt.base;
> +		struct drm_i915_private *dev_priv = ring->dev->dev_private;
> +		struct i915_vma *vma =
> +			i915_gem_obj_to_vma(from->obj, &dev_priv->gtt.base);
>  		from->obj->base.read_domains = I915_GEM_DOMAIN_INSTRUCTION;
> -		list_move_tail(&i915_gem_obj_to_vma(from->obj, ggtt)->mm_list, &ggtt->active_list);
> -		i915_gem_object_move_to_active(from->obj, ring);
> +		i915_vma_move_to_active(vma, ring);

We do fairly often lookup the ggtt vma for an obj. Is this worth a
speciallised function call?

i915_vma_move_to_active(i915_gem_obj_to_ggtt(from->obj), ring);

	struct i915_vma *i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj)
	{
		struct i915_vma *vma;

		if (WARN_ON(list_empty(&obj->vma_list))
			return NULL;

		vma = list_first_entry(&obj->vma_list, typeof(*vma), vma_link);
		if (WARN_ON(vma != &to_i915(obj->base.dev)->gtt.base))
			return NULL;

		return vma;
	}
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list