[Intel-gfx] [PATCH v2 05/15] drm/i915/ttm Initialize the ttm device and memory managers

Matthew Auld matthew.william.auld at gmail.com
Tue May 18 09:09:50 UTC 2021


On Tue, 18 May 2021 at 09:27, Thomas Hellström
<thomas.hellstrom at linux.intel.com> wrote:
>
> Temporarily remove the buddy allocator and related selftests
> and hook up the TTM range manager for i915 regions.
>
> Also modify the mock region selftests somewhat to account for a
> fragmenting manager.
>
> Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> ---
> v2:
> - Fix an error unwind in lmem_get_pages() (Reported by Matthew Auld)
> - Break out and modify usage of i915_sg_dma_sizes() (Reported by Mattew Auld)
> - Break out TTM changes to a separate patch (Reported by Christian König)
> ---

<snip>

> +
> +static int mock_region_get_pages(struct drm_i915_gem_object *obj)
> +{
> +       unsigned int flags;
> +       struct sg_table *pages;
> +
> +       flags = I915_ALLOC_MIN_PAGE_SIZE;
> +       if (obj->flags & I915_BO_ALLOC_CONTIGUOUS)
> +               flags |= I915_ALLOC_CONTIGUOUS;
> +
> +       obj->mm.st_mm_node = intel_region_ttm_node_alloc(obj->mm.region,
> +                                                        obj->base.size,
> +                                                        flags);
> +       if (IS_ERR(obj->mm.st_mm_node))
> +               return PTR_ERR(obj->mm.st_mm_node);
> +
> +       pages = intel_region_ttm_node_to_st(obj->mm.region, obj->mm.st_mm_node);
> +       if (IS_ERR(pages))
> +               return PTR_ERR(pages);

Needs some onion?


More information about the dri-devel mailing list