[Intel-gfx] [RFC 5/7] drm/i915: Use i915_sg_create for dmabuf

Chris Wilson chris at chris-wilson.co.uk
Thu Oct 13 09:15:44 UTC 2016


On Thu, Oct 13, 2016 at 10:04:02AM +0100, Tvrtko Ursulin wrote:
> -	src = obj->pages->sgl;
> -	dst = st->sgl;
> -	for (i = 0; i < obj->pages->nents; i++) {
> -		sg_set_page(dst, sg_page(src), src->length, 0);
> -		dst = sg_next(dst);
> -		src = sg_next(src);
> -	}
> +	for_each_sgt_page(page, sgt_iter, obj->pages)
> +		i915_sg_add_page(state, page);

This (and partial_pages) can just copy the existing compact obj->pages.
The previous code should already be as compact as its input. And that is
not a simpler loop!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list