Re: [PATCH 3/4] drm/i915: treat shmem as a region

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

 



Quoting Matthew Auld (2019-10-17 18:45:43)
> @@ -434,9 +439,9 @@ const struct drm_i915_gem_object_ops i915_gem_shmem_ops = {
>         .release = shmem_release,
>  };
>  
> -static int create_shmem(struct drm_i915_private *i915,
> -                       struct drm_gem_object *obj,
> -                       size_t size)
> +static int __create_shmem(struct drm_i915_private *i915,
> +                         struct drm_gem_object *obj,
> +                         size_t size)

I would feel happier if our interface was consistent, right up until the
moment it met drm, i.e. resource_size_t size.

>  {
>         unsigned long flags = VM_NORESERVE;
>         struct file *filp;
> @@ -455,31 +460,23 @@ static int create_shmem(struct drm_i915_private *i915,
>         return 0;
>  }
>  
> -struct drm_i915_gem_object *
> -i915_gem_object_create_shmem(struct drm_i915_private *i915, u64 size)
> +static struct drm_i915_gem_object *
> +create_shmem(struct intel_memory_region *mem,
> +            resource_size_t size,
> +            unsigned int flags)
>  {
> +       struct drm_i915_private *i915 = mem->i915;
>         struct drm_i915_gem_object *obj;
>         struct address_space *mapping;
>         unsigned int cache_level;
>         gfp_t mask;
>         int ret;
>  
> -       /* There is a prevalence of the assumption that we fit the object's
> -        * page count inside a 32bit _signed_ variable. Let's document this and
> -        * catch if we ever need to fix it. In the meantime, if you do spot
> -        * such a local variable, please consider fixing!
> -        */
> -       if (size >> PAGE_SHIFT > INT_MAX)
> -               return ERR_PTR(-E2BIG);
> -
> -       if (overflows_type(size, obj->base.size))
> -               return ERR_PTR(-E2BIG);
> -
>         obj = i915_gem_object_alloc();
>         if (!obj)
>                 return ERR_PTR(-ENOMEM);
>  
> -       ret = create_shmem(i915, &obj->base, size);
> +       ret = __create_shmem(i915, &obj->base, size);
>         if (ret)
>                 goto fail;
_______________________________________________
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