[Intel-gfx] [RFC 1/7] drm/i915: Extract sg creation into a helper
Chris Wilson
chris at chris-wilson.co.uk
Thu Oct 13 09:20:17 UTC 2016
On Thu, Oct 13, 2016 at 10:03:58AM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> In order to reuse the same logic in several places in the driver,
> extract the logic which adds pages to the sg list and does the
> potential coalescing, into separate functions.
>
> Code wanting to build the sg table needs to do the following:
>
> 1. Call i915_sg_create to create the state object for a given
> maximum number of pages.
> 2. Iterate using i915_sg_for_each_page
> 3. Call i915_sg_add_page to add all the pages in order
> 4. On success call i915_sg_complete, or on failure i915_sg_abort
>
> In this patch only i915_gem_object_get_pages_gtt gets converted
> to use the new functions.
Yup, much happier. Though can we just allocate the state on the stack,
it is the same as what we are previously using anyway. 40 bytes.
I've also thought about doing the sg_trim, just never actually tried...
Just not convinced that recreating the compact sg is better than copying
the already compact sg (for dmabuf, partial).
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list