[PATCH v2 4/4] drm/udl: Remove struct udl_gem_object and functions

Noralf Trønnes noralf at tronnes.org
Wed Nov 6 11:48:48 UTC 2019



Den 06.11.2019 11.47, skrev Thomas Zimmermann:
> Simply removes all the obsolete GEM code from udl. No functional
> changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>  drivers/gpu/drm/udl/Makefile     |   2 +-
>  drivers/gpu/drm/udl/udl_dmabuf.c | 254 -------------------------------
>  drivers/gpu/drm/udl/udl_drv.h    |  29 ----
>  drivers/gpu/drm/udl/udl_gem.c    | 206 -------------------------
>  4 files changed, 1 insertion(+), 490 deletions(-)
>  delete mode 100644 drivers/gpu/drm/udl/udl_dmabuf.c
> 

<snip>

> -int udl_gem_vmap(struct udl_gem_object *obj)
> -{
> -	int page_count = obj->base.size / PAGE_SIZE;
> -	int ret;
> -
> -	if (obj->base.import_attach) {
> -		obj->vmapping = dma_buf_vmap(obj->base.import_attach->dmabuf);
> -		if (!obj->vmapping)
> -			return -ENOMEM;
> -		return 0;
> -	}
> -
> -	ret = udl_gem_get_pages(obj);
> -	if (ret)
> -		return ret;
> -
> -	obj->vmapping = vmap(obj->pages, page_count, 0, PAGE_KERNEL);

This differs from the shmem helper vmap:

	shmem->vaddr = vmap(shmem->pages, obj->size >> PAGE_SHIFT,
			    VM_MAP, pgprot_writecombine(PAGE_KERNEL));

Boris added the WC in be7d9f05c53e:

 drm/gem_shmem: Use a writecombine mapping for ->vaddr

 Right now, the BO is mapped as a cached region when ->vmap() is called
 and the underlying object is not a dmabuf.
 Doing that makes cache management a bit more complicated (you'd need
 to call dma_map/unmap_sg() on the ->sgt field everytime the BO is about
 to be passed to the GPU/CPU), so let's map the BO with writecombine
 attributes instead (as done in most drivers).

I don't know what the implications of this are, just pointing out a
difference.

Noralf.

> -	if (!obj->vmapping)
> -		return -ENOMEM;
> -	return 0;
> -}



More information about the dri-devel mailing list