[PATCH v2 1/4] drm/gem-shmem-helper: Export drm_gem_shmem_funcs

Thomas Zimmermann tzimmermann at suse.de
Thu Jun 3 15:54:15 UTC 2021


Hi

Am 03.06.21 um 17:03 schrieb Daniel Vetter:
> Drivers which need to overwrite the drm_driver->gem_create_object hook
> need this. Specifically vgem, which wants wc mode, but everything else
> is fine as-is.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Maxime Ripard <mripard at kernel.org>
> Cc: Thomas Zimmermann <tzimmermann at suse.de>
> Cc: David Airlie <airlied at linux.ie>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> ---
>   drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++-
>   include/drm/drm_gem_shmem_helper.h     | 1 +
>   2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
> index 6d625cee7a6a..4439004e62fe 100644
> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
> @@ -24,7 +24,7 @@
>    * allocated using anonymous pageable memory.
>    */
>   
> -static const struct drm_gem_object_funcs drm_gem_shmem_funcs = {
> +const struct drm_gem_object_funcs drm_gem_shmem_funcs = {
>   	.free = drm_gem_shmem_free_object,
>   	.print_info = drm_gem_shmem_print_info,
>   	.pin = drm_gem_shmem_pin,
> @@ -34,6 +34,7 @@ static const struct drm_gem_object_funcs drm_gem_shmem_funcs = {
>   	.vunmap = drm_gem_shmem_vunmap,
>   	.mmap = drm_gem_shmem_mmap,
>   };
> +EXPORT_SYMBOL(drm_gem_shmem_funcs);

No that's not needed. If you leave out the funcs pointer in your 
gem_create_object, __drm_gem_shmem_create() will set this default for 
you. [1] So please drop this patch.

Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v5.12/source/drivers/gpu/drm/drm_gem_shmem_helper.c#L56

>   
>   static struct drm_gem_shmem_object *
>   __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private)
> diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h
> index 434328d8a0d9..b29667f2b8a3 100644
> --- a/include/drm/drm_gem_shmem_helper.h
> +++ b/include/drm/drm_gem_shmem_helper.h
> @@ -106,6 +106,7 @@ struct drm_gem_shmem_object {
>   #define to_drm_gem_shmem_obj(obj) \
>   	container_of(obj, struct drm_gem_shmem_object, base)
>   
> +extern const struct drm_gem_object_funcs drm_gem_shmem_funcs;
>   struct drm_gem_shmem_object *drm_gem_shmem_create(struct drm_device *dev, size_t size);
>   void drm_gem_shmem_free_object(struct drm_gem_object *obj);
>   
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210603/f6c32e95/attachment-0001.sig>


More information about the dri-devel mailing list