[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a79a05f-5763-201a-86e8-bb298d4fe856@suse.de>
Date: Fri, 13 Sep 2019 15:02:25 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Gerd Hoffmann <kraxel@...hat.com>, dri-devel@...ts.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/8] drm/ttm: add drm_gem_ttm_mmap()
Hi
Am 13.09.19 um 14:29 schrieb Gerd Hoffmann:
> Add helper function to mmap ttm bo's using &drm_gem_object_funcs.mmap().
>
> Note that with this code path access verification is done by
> drm_gem_mmap() (which calls drm_vma_node_is_allowed(()).
> The &ttm_bo_driver.verify_access() callback is is not used.
>
> Signed-off-by: Gerd Hoffmann <kraxel@...hat.com>
> ---
> include/drm/drm_gem_ttm_helper.h | 2 ++
> drivers/gpu/drm/drm_gem_ttm_helper.c | 19 +++++++++++++++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/include/drm/drm_gem_ttm_helper.h b/include/drm/drm_gem_ttm_helper.h
> index 6268f89c5a48..118cef76f84f 100644
> --- a/include/drm/drm_gem_ttm_helper.h
> +++ b/include/drm/drm_gem_ttm_helper.h
> @@ -15,5 +15,7 @@
>
> void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
> const struct drm_gem_object *gem);
> +int drm_gem_ttm_mmap(struct drm_gem_object *gem,
> + struct vm_area_struct *vma);
>
> #endif
> diff --git a/drivers/gpu/drm/drm_gem_ttm_helper.c b/drivers/gpu/drm/drm_gem_ttm_helper.c
> index 9a4bafcf20df..34ce6cf78b35 100644
> --- a/drivers/gpu/drm/drm_gem_ttm_helper.c
> +++ b/drivers/gpu/drm/drm_gem_ttm_helper.c
> @@ -52,5 +52,24 @@ void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
> }
> EXPORT_SYMBOL(drm_gem_ttm_print_info);
>
> +/**
> + * drm_gem_ttm_mmap() - mmap &ttm_buffer_object
> + * @gem: GEM object.
> + * @vma: vm area.
> + *
> + * This function can be used as &drm_gem_object_funcs.mmap
> + * callback.
> + */
> +int drm_gem_ttm_mmap(struct drm_gem_object *gem,
> + struct vm_area_struct *vma)
> +{
> + struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
> +
> + ttm_bo_get(bo);
> + ttm_bo_mmap_vma_setup(bo, vma);
> + return 0;
> +}
This function looks like ttm_fbdev_mmap(). Can you use that instead?
Best regards
Thomas
> +EXPORT_SYMBOL(drm_gem_ttm_mmap);
> +
> MODULE_DESCRIPTION("DRM gem ttm helpers");
> MODULE_LICENSE("GPL");
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists