[Intel-gfx] [PATCH 03/10] drm/i915: Use insert_page for pwrite_fast

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 26 02:57:22 PST 2016


On Tue, Jan 26, 2016 at 01:13:29AM +0530, ankitprasad.r.sharma at intel.com wrote:
>  static int
> -i915_gem_gtt_pwrite_fast(struct drm_device *dev,
> +i915_gem_gtt_pwrite_fast(struct drm_i915_private *i915,
>  			 struct drm_i915_gem_object *obj,
>  			 struct drm_i915_gem_pwrite *args,
>  			 struct drm_file *file)
>  {
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	ssize_t remain;
> -	loff_t offset, page_base;
> +	struct drm_mm_node node;
> +	uint64_t remain, offset;
>  	char __user *user_data;
> -	int page_offset, page_length, ret;
> +	int ret;
>  
>  	ret = i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE | PIN_NONBLOCK);
> -	if (ret)
> -		goto out;
> +	if (ret) {
> +		ret = insert_mappable_node(i915, &node, PAGE_SIZE);
> +		if (ret)
> +			goto out;
> +
> +		ret = i915_gem_object_get_pages(obj);
> +		if (ret) {
> +			remove_mappable_node(&node);
> +			goto out;
> +		}
> +
> +		i915_gem_object_pin_pages(obj);
> +	} else {
> +		node.start = i915_gem_obj_ggtt_offset(obj);
> +		node.allocated = false;

So techinically we only need the put_fence here. Don't worry, there is
no ordering constraint between put_fence and set-to-gtt-domain.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list