Re: [PATCH 04/22] drm/i915/region: support continuous allocations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Matthew Auld (2019-09-27 18:33:51)
>  struct drm_i915_gem_object *
> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> index 4e1805aaeb99..f9fbf2865782 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> @@ -471,7 +471,8 @@ static int igt_mock_memory_region_huge_pages(void *arg)
>                 unsigned int page_size = BIT(bit);
>                 resource_size_t phys;
>  
> -               obj = i915_gem_object_create_region(mem, page_size, 0);
> +               obj = i915_gem_object_create_region(mem, page_size,
> +                                                   I915_BO_ALLOC_CONTIGUOUS);

Seems a good opportunity to test both?

>                 if (IS_ERR(obj)) {
>                         err = PTR_ERR(obj);
>                         goto out_destroy_device;
> diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c
> index e48d5c37c4df..7a66872d9eac 100644
> --- a/drivers/gpu/drm/i915/intel_memory_region.c
> +++ b/drivers/gpu/drm/i915/intel_memory_region.c
> @@ -47,8 +47,8 @@ __intel_memory_region_get_pages_buddy(struct intel_memory_region *mem,
>                                       unsigned int flags,
>                                       struct list_head *blocks)
>  {
> -       unsigned long n_pages = size >> ilog2(mem->mm.chunk_size);
>         unsigned int min_order = 0;
> +       unsigned long n_pages;
>  
>         GEM_BUG_ON(!IS_ALIGNED(size, mem->mm.chunk_size));
>         GEM_BUG_ON(!list_empty(blocks));
> @@ -58,6 +58,13 @@ __intel_memory_region_get_pages_buddy(struct intel_memory_region *mem,
>                             ilog2(mem->mm.chunk_size);
>         }
>  
> +       if (flags & I915_ALLOC_CONTIGUOUS) {
> +               size = roundup_pow_of_two(size);
> +               min_order = ilog2(size) - ilog2(mem->mm.chunk_size);
> +       }
> +
> +       n_pages = size >> ilog2(mem->mm.chunk_size);
> +
>         mutex_lock(&mem->mm_lock);
>  
>         do {
> @@ -104,7 +111,9 @@ __intel_memory_region_get_block_buddy(struct intel_memory_region *mem,
>         int ret;
>  
>         INIT_LIST_HEAD(&blocks);
> -       ret = __intel_memory_region_get_pages_buddy(mem, size, 0, &blocks);
> +       ret = __intel_memory_region_get_pages_buddy(mem, size,
> +                                                   I915_ALLOC_CONTIGUOUS,
> +                                                   &blocks);

This chunk looks odd. Quick explanation why we don't pass flags here?

>         if (ret)
>                 return ERR_PTR(ret);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux