diff mbox series

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

Message ID 20210603150326.1326658-2-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show
Series shmem helpers for igt | expand

Commit Message

Daniel Vetter June 3, 2021, 3:03 p.m. UTC
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@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@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(-)

Comments

Thomas Zimmermann June 3, 2021, 3:54 p.m. UTC | #1
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@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@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);
>   
>
diff mbox series

Patch

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);
 
 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);