diff mbox series

[v2,9/9] drm/cma-helper: Remove unused fbdev code

Message ID 20181025201340.34227-10-noralf@tronnes.org (mailing list archive)
State New, archived
Headers show
Series drm/cma-helper drivers: Use drm_fbdev_generic_setup() | expand

Commit Message

Noralf Trønnes Oct. 25, 2018, 8:13 p.m. UTC
CMA helper drivers have been converted to drm_fbdev_generic_setup()
so the fbdev code can be removed.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---

Changes since version 1:
- Rebased

 drivers/gpu/drm/Kconfig             |   4 --
 drivers/gpu/drm/drm_fb_cma_helper.c | 130 ------------------------------------
 include/drm/drm_fb_cma_helper.h     |  22 ------
 3 files changed, 156 deletions(-)

Comments

Laurent Pinchart Nov. 28, 2018, 7:45 p.m. UTC | #1
Hi Noralf,

Thank you for the patch.

On Thursday, 25 October 2018 23:13:40 EET Noralf Trønnes wrote:
> CMA helper drivers have been converted to drm_fbdev_generic_setup()
> so the fbdev code can be removed.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> ---
> 
> Changes since version 1:
> - Rebased
> 
>  drivers/gpu/drm/Kconfig             |   4 --
>  drivers/gpu/drm/drm_fb_cma_helper.c | 130 ---------------------------------
>  include/drm/drm_fb_cma_helper.h     |  22 ------
>  3 files changed, 156 deletions(-)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 4385f00e1d05..bd943a71756c 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -170,10 +170,6 @@ config DRM_KMS_CMA_HELPER
>  	bool
>  	depends on DRM
>  	select DRM_GEM_CMA_HELPER
> -	select DRM_KMS_FB_HELPER
> -	select FB_SYS_FILLRECT
> -	select FB_SYS_COPYAREA
> -	select FB_SYS_IMAGEBLIT
>  	help
>  	  Choose this if you need the KMS CMA helper functions
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c
> b/drivers/gpu/drm/drm_fb_cma_helper.c index fc2b42dd3dc6..0ddf9c65e5ab
> 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -18,8 +18,6 @@
>   */
> 
>  #include <drm/drmP.h>
> -#include <drm/drm_client.h>
> -#include <drm/drm_fb_helper.h>
>  #include <drm/drm_framebuffer.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> @@ -27,10 +25,6 @@
>  #include <drm/drm_print.h>

As far as I can tell, you can also drop drm/drm_fb_cma_helper.h and drm/
drm_print.h. If you include drm/drm_fourcc.h and drm/drm_plane.h, you can also 
drop drm/drmP.h.

Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  #include <linux/module.h>
> 
> -struct drm_fbdev_cma {
> -	struct drm_fb_helper	fb_helper;
> -};
> -
>  /**
>   * DOC: framebuffer cma helper functions
>   *
> @@ -39,16 +33,8 @@ struct drm_fbdev_cma {
>   *
>   * drm_gem_fb_create() is used in the &drm_mode_config_funcs.fb_create
>   * callback function to create a cma backed framebuffer.
> - *
> - * An fbdev framebuffer backed by cma is also available by calling
> - * drm_fb_cma_fbdev_init(). drm_fb_cma_fbdev_fini() tears it down.
>   */
> 
> -static inline struct drm_fbdev_cma *to_fbdev_cma(struct drm_fb_helper
> *helper) -{
> -	return container_of(helper, struct drm_fbdev_cma, fb_helper);
> -}
> -
>  /**
>   * drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer
>   * @fb: The framebuffer
> @@ -105,119 +91,3 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct
> drm_framebuffer *fb, return paddr;
>  }
>  EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
> -
> -/**
> - * drm_fb_cma_fbdev_init() - Allocate and initialize fbdev emulation
> - * @dev: DRM device
> - * @preferred_bpp: Preferred bits per pixel for the device.
> - *                 @dev->mode_config.preferred_depth is used if this is
> zero. - * @max_conn_count: Maximum number of connectors.
> - *                  @dev->mode_config.num_connector is used if this is
> zero. - *
> - * Returns:
> - * Zero on success or negative error code on failure.
> - */
> -int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int
> preferred_bpp, -			  unsigned int max_conn_count)
> -{
> -	struct drm_fbdev_cma *fbdev_cma;
> -
> -	/* dev->fb_helper will indirectly point to fbdev_cma after this call */
> -	fbdev_cma = drm_fbdev_cma_init(dev, preferred_bpp, max_conn_count);
> -	return PTR_ERR_OR_ZERO(fbdev_cma);
> -}
> -EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init);
> -
> -/**
> - * drm_fb_cma_fbdev_fini() - Teardown fbdev emulation
> - * @dev: DRM device
> - */
> -void drm_fb_cma_fbdev_fini(struct drm_device *dev)
> -{
> -	if (dev->fb_helper)
> -		drm_fbdev_cma_fini(to_fbdev_cma(dev->fb_helper));
> -}
> -EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini);
> -
> -static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
> -	.fb_probe = drm_fb_helper_generic_probe,
> -};
> -
> -/**
> - * drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct
> - * @dev: DRM device
> - * @preferred_bpp: Preferred bits per pixel for the device
> - * @max_conn_count: Maximum number of connectors
> - *
> - * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
> - */
> -struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
> -	unsigned int preferred_bpp, unsigned int max_conn_count)
> -{
> -	struct drm_fbdev_cma *fbdev_cma;
> -	struct drm_fb_helper *fb_helper;
> -	int ret;
> -
> -	fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL);
> -	if (!fbdev_cma)
> -		return ERR_PTR(-ENOMEM);
> -
> -	fb_helper = &fbdev_cma->fb_helper;
> -
> -	ret = drm_client_new(dev, &fb_helper->client, "fbdev", NULL);
> -	if (ret)
> -		goto err_free;
> -
> -	ret = drm_fb_helper_fbdev_setup(dev, fb_helper, &drm_fb_cma_helper_funcs,
> -					preferred_bpp, max_conn_count);
> -	if (ret)
> -		goto err_client_put;
> -
> -	return fbdev_cma;
> -
> -err_client_put:
> -	drm_client_release(&fb_helper->client);
> -err_free:
> -	kfree(fbdev_cma);
> -
> -	return ERR_PTR(ret);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);
> -
> -/**
> - * drm_fbdev_cma_fini() - Free drm_fbdev_cma struct
> - * @fbdev_cma: The drm_fbdev_cma struct
> - */
> -void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma)
> -{
> -	drm_fb_helper_unregister_fbi(&fbdev_cma->fb_helper);
> -	/* All resources have now been freed by drm_fbdev_fb_destroy() */
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini);
> -
> -/**
> - * drm_fbdev_cma_restore_mode() - Restores initial framebuffer mode
> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> - *
> - * This function is usually called from the &drm_driver.lastclose callback.
> - */
> -void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma)
> -{
> -	if (fbdev_cma)
> -		drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev_cma->fb_helper);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode);
> -
> -/**
> - * drm_fbdev_cma_hotplug_event() - Poll for hotpulug events
> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> - *
> - * This function is usually called from the
> &drm_mode_config.output_poll_changed - * callback.
> - */
> -void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma)
> -{
> -	if (fbdev_cma)
> -		drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
> diff --git a/include/drm/drm_fb_cma_helper.h
> b/include/drm/drm_fb_cma_helper.h index 8dbbe1eece1b..4becb09975a4 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -2,31 +2,9 @@
>  #ifndef __DRM_FB_CMA_HELPER_H__
>  #define __DRM_FB_CMA_HELPER_H__
> 
> -struct drm_fbdev_cma;
> -struct drm_gem_cma_object;
> -
> -struct drm_fb_helper_surface_size;
> -struct drm_framebuffer_funcs;
> -struct drm_fb_helper_funcs;
>  struct drm_framebuffer;
> -struct drm_fb_helper;
> -struct drm_device;
> -struct drm_file;
> -struct drm_mode_fb_cmd2;
> -struct drm_plane;
>  struct drm_plane_state;
> 
> -int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int
> preferred_bpp, -			  unsigned int max_conn_count);
> -void drm_fb_cma_fbdev_fini(struct drm_device *dev);
> -
> -struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
> -	unsigned int preferred_bpp, unsigned int max_conn_count);
> -void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
> -
> -void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
> -void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
> -
>  struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer
> *fb, unsigned int plane);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 4385f00e1d05..bd943a71756c 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -170,10 +170,6 @@  config DRM_KMS_CMA_HELPER
 	bool
 	depends on DRM
 	select DRM_GEM_CMA_HELPER
-	select DRM_KMS_FB_HELPER
-	select FB_SYS_FILLRECT
-	select FB_SYS_COPYAREA
-	select FB_SYS_IMAGEBLIT
 	help
 	  Choose this if you need the KMS CMA helper functions
 
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index fc2b42dd3dc6..0ddf9c65e5ab 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -18,8 +18,6 @@ 
  */
 
 #include <drm/drmP.h>
-#include <drm/drm_client.h>
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -27,10 +25,6 @@ 
 #include <drm/drm_print.h>
 #include <linux/module.h>
 
-struct drm_fbdev_cma {
-	struct drm_fb_helper	fb_helper;
-};
-
 /**
  * DOC: framebuffer cma helper functions
  *
@@ -39,16 +33,8 @@  struct drm_fbdev_cma {
  *
  * drm_gem_fb_create() is used in the &drm_mode_config_funcs.fb_create
  * callback function to create a cma backed framebuffer.
- *
- * An fbdev framebuffer backed by cma is also available by calling
- * drm_fb_cma_fbdev_init(). drm_fb_cma_fbdev_fini() tears it down.
  */
 
-static inline struct drm_fbdev_cma *to_fbdev_cma(struct drm_fb_helper *helper)
-{
-	return container_of(helper, struct drm_fbdev_cma, fb_helper);
-}
-
 /**
  * drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer
  * @fb: The framebuffer
@@ -105,119 +91,3 @@  dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb,
 	return paddr;
 }
 EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
-
-/**
- * drm_fb_cma_fbdev_init() - Allocate and initialize fbdev emulation
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device.
- *                 @dev->mode_config.preferred_depth is used if this is zero.
- * @max_conn_count: Maximum number of connectors.
- *                  @dev->mode_config.num_connector is used if this is zero.
- *
- * Returns:
- * Zero on success or negative error code on failure.
- */
-int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
-			  unsigned int max_conn_count)
-{
-	struct drm_fbdev_cma *fbdev_cma;
-
-	/* dev->fb_helper will indirectly point to fbdev_cma after this call */
-	fbdev_cma = drm_fbdev_cma_init(dev, preferred_bpp, max_conn_count);
-	return PTR_ERR_OR_ZERO(fbdev_cma);
-}
-EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init);
-
-/**
- * drm_fb_cma_fbdev_fini() - Teardown fbdev emulation
- * @dev: DRM device
- */
-void drm_fb_cma_fbdev_fini(struct drm_device *dev)
-{
-	if (dev->fb_helper)
-		drm_fbdev_cma_fini(to_fbdev_cma(dev->fb_helper));
-}
-EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini);
-
-static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
-	.fb_probe = drm_fb_helper_generic_probe,
-};
-
-/**
- * drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device
- * @max_conn_count: Maximum number of connectors
- *
- * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
- */
-struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
-	unsigned int preferred_bpp, unsigned int max_conn_count)
-{
-	struct drm_fbdev_cma *fbdev_cma;
-	struct drm_fb_helper *fb_helper;
-	int ret;
-
-	fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL);
-	if (!fbdev_cma)
-		return ERR_PTR(-ENOMEM);
-
-	fb_helper = &fbdev_cma->fb_helper;
-
-	ret = drm_client_new(dev, &fb_helper->client, "fbdev", NULL);
-	if (ret)
-		goto err_free;
-
-	ret = drm_fb_helper_fbdev_setup(dev, fb_helper, &drm_fb_cma_helper_funcs,
-					preferred_bpp, max_conn_count);
-	if (ret)
-		goto err_client_put;
-
-	return fbdev_cma;
-
-err_client_put:
-	drm_client_release(&fb_helper->client);
-err_free:
-	kfree(fbdev_cma);
-
-	return ERR_PTR(ret);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);
-
-/**
- * drm_fbdev_cma_fini() - Free drm_fbdev_cma struct
- * @fbdev_cma: The drm_fbdev_cma struct
- */
-void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma)
-{
-	drm_fb_helper_unregister_fbi(&fbdev_cma->fb_helper);
-	/* All resources have now been freed by drm_fbdev_fb_destroy() */
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini);
-
-/**
- * drm_fbdev_cma_restore_mode() - Restores initial framebuffer mode
- * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
- *
- * This function is usually called from the &drm_driver.lastclose callback.
- */
-void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma)
-{
-	if (fbdev_cma)
-		drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev_cma->fb_helper);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode);
-
-/**
- * drm_fbdev_cma_hotplug_event() - Poll for hotpulug events
- * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
- *
- * This function is usually called from the &drm_mode_config.output_poll_changed
- * callback.
- */
-void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma)
-{
-	if (fbdev_cma)
-		drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 8dbbe1eece1b..4becb09975a4 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -2,31 +2,9 @@ 
 #ifndef __DRM_FB_CMA_HELPER_H__
 #define __DRM_FB_CMA_HELPER_H__
 
-struct drm_fbdev_cma;
-struct drm_gem_cma_object;
-
-struct drm_fb_helper_surface_size;
-struct drm_framebuffer_funcs;
-struct drm_fb_helper_funcs;
 struct drm_framebuffer;
-struct drm_fb_helper;
-struct drm_device;
-struct drm_file;
-struct drm_mode_fb_cmd2;
-struct drm_plane;
 struct drm_plane_state;
 
-int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
-			  unsigned int max_conn_count);
-void drm_fb_cma_fbdev_fini(struct drm_device *dev);
-
-struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
-	unsigned int preferred_bpp, unsigned int max_conn_count);
-void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
-
-void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
-void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
-
 struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
 	unsigned int plane);