Re: [Intel-gfx] [RFC 5/7] drm/i915: Use i915_sg_create for dmabuf
On 13/10/2016 10:15, Chris Wilson wrote: 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! Ah yes, you are right. A bit too mindless "search and replace" on my part. Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC 5/7] drm/i915: Use i915_sg_create for dmabuf
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 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx