[PATCH v2 2/2] drm/udl: Use GEM vmap/mmap function from SHMEM helpers

Noralf Trønnes noralf at tronnes.org
Thu May 21 12:17:04 UTC 2020



Den 19.05.2020 10.04, skrev Thomas Zimmermann:
> The udl driver contains an implementation of GEM vmap and mmap
> operations that is identical to the common SHMEM helper; except
> that udl's code uses cached pages by default.
> 
> Convert udl to regular SHMEM helper functions. There's no reason
> to have udl behave differently from all other SHMEM drivers. The
> udl driver uses the SHMEM helper to enable caching.
> 
> v2:
> 	* implement .gem_create_object with SHMEM helper
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---

> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index d1aa50fd6d65a..96d4317a2c1bd 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -37,8 +37,8 @@ DEFINE_DRM_GEM_FOPS(udl_driver_fops);
>  static struct drm_driver driver = {
>  	.driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET,
>  
> -	/* gem hooks */
> -	.gem_create_object = udl_driver_gem_create_object,
> +	/* GEM hooks */
> +	.gem_create_object = drm_gem_shmem_create_object_cached,
>  
>  	.fops = &udl_driver_fops,
>  	DRM_GEM_SHMEM_DRIVER_OPS,

You could add a DRM_GEM_SHMEM_CACHED_DRIVER_OPS macro and use that instead.

Noralf.


More information about the dri-devel mailing list