Re: [PATCH 27/29] drm/vgem: Move get_pages to gem_create

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

 



On 23.11.2015 10:33, Daniel Vetter wrote:
> vgem doesn't have a shrinker or anything like that and drops backing
> storage only at object_free time. There's no use in trying to be
> clever and allocating backing storage delayed, it only causes trouble
> by requiring locking.
> 
> Instead grab pages when we allocate the object right away.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> ---
>  drivers/gpu/drm/vgem/vgem_drv.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
> index 63026d4324ad..1a609347236b 100644
> --- a/drivers/gpu/drm/vgem/vgem_drv.c
> +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> @@ -154,6 +154,10 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev,
>  	if (err)
>  		goto out;
>  
> +	ret = vgem_gem_get_pages(to_vgem_bo(obj));
> +	if (ret)
> +		goto out;
> +
>  	err = drm_gem_handle_create(file, gem_object, handle);
>  	if (err)
>  		goto handle_out;
> @@ -216,16 +220,8 @@ int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
>  
>  	obj->filp->private_data = obj;
>  
> -	ret = vgem_gem_get_pages(to_vgem_bo(obj));
> -	if (ret)
> -		goto fail_get_pages;
> -
>  	*offset = drm_vma_node_offset_addr(&obj->vma_node);
>  
> -	goto unref;
> -
> -fail_get_pages:
> -	drm_gem_free_mmap_offset(obj);
>  unref:
>  	drm_gem_object_unreference(obj);
>  unlock:
> 


drivers/gpu/drm/vgem/vgem_drv.c: In function 'vgem_gem_fault':
drivers/gpu/drm/vgem/vgem_drv.c:92:21: warning: unused variable 'dev' [-Wunused-variable]
  struct drm_device *dev = obj->base.dev;
                     ^
drivers/gpu/drm/vgem/vgem_drv.c: In function 'vgem_gem_create':
drivers/gpu/drm/vgem/vgem_drv.c:153:2: error: 'ret' undeclared (first use in this function)
  ret = vgem_gem_get_pages(to_vgem_bo(obj));
  ^
drivers/gpu/drm/vgem/vgem_drv.c:153:2: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/list.h:8:0,
                 from include/linux/module.h:9,
                 from drivers/gpu/drm/vgem/vgem_drv.c:33:
include/linux/kernel.h:813:48: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
  const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                ^
drivers/gpu/drm/vgem/vgem_drv.h:35:23: note: in expansion of macro 'container_of'
 #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base)
                       ^
drivers/gpu/drm/vgem/vgem_drv.c:153:27: note: in expansion of macro 'to_vgem_bo'
  ret = vgem_gem_get_pages(to_vgem_bo(obj));
                           ^

This breaks the build, therefore "armada" batch cannot be tested entirely.


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux