diff mbox series

[v2,6/9] drm/atmel-hlcdc: Use drm_fbdev_generic_setup()

Message ID 20181025201340.34227-7-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
The CMA helper is already using the drm_fb_helper_generic_probe part of
the generic fbdev emulation. This patch makes full use of the generic
fbdev emulation by using its drm_client callbacks. This means that
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
now handled by the emulation code. Additionally fbdev unregister happens
automatically on drm_dev_unregister().

The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
driver. This is done to highlight the fact that fbdev emulation is an
internal client that makes use of the driver, it is not part of the
driver as such. If fbdev setup fails, an error is printed, but the driver
succeeds probing.

Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Boris Brezillon Oct. 25, 2018, 8:25 p.m. UTC | #1
On Thu, 25 Oct 2018 22:13:37 +0200
Noralf Trønnes <noralf@tronnes.org> wrote:

> The CMA helper is already using the drm_fb_helper_generic_probe part of
> the generic fbdev emulation. This patch makes full use of the generic
> fbdev emulation by using its drm_client callbacks. This means that
> drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
> now handled by the emulation code. Additionally fbdev unregister happens
> automatically on drm_dev_unregister().
> 
> The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
> driver. This is done to highlight the fact that fbdev emulation is an
> internal client that makes use of the driver, it is not part of the
> driver as such. If fbdev setup fails, an error is printed, but the driver
> succeeds probing.
> 
> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>

Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>

> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index fedbfa333bb0..034a91112098 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -556,7 +556,6 @@ static int atmel_hlcdc_dc_atomic_commit(struct drm_device *dev,
>  
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = atmel_hlcdc_fb_create,
> -	.output_poll_changed = drm_fb_helper_output_poll_changed,
>  	.atomic_check = drm_atomic_helper_check,
>  	.atomic_commit = atmel_hlcdc_dc_atomic_commit,
>  };
> @@ -658,8 +657,6 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>  
>  	platform_set_drvdata(pdev, dev);
>  
> -	drm_fb_cma_fbdev_init(dev, 24, 0);
> -
>  	drm_kms_helper_poll_init(dev);
>  
>  	return 0;
> @@ -678,7 +675,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  {
>  	struct atmel_hlcdc_dc *dc = dev->dev_private;
>  
> -	drm_fb_cma_fbdev_fini(dev);
>  	flush_workqueue(dc->wq);
>  	drm_kms_helper_poll_fini(dev);
>  	drm_atomic_helper_shutdown(dev);
> @@ -727,7 +723,6 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
>  	.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
>  			   DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
> -	.lastclose = drm_fb_helper_lastclose,
>  	.irq_handler = atmel_hlcdc_dc_irq_handler,
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
> @@ -769,6 +764,8 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_unload;
>  
> +	drm_fbdev_generic_setup(ddev, 24);
> +
>  	return 0;
>  
>  err_unload:
Noralf Trønnes Nov. 1, 2018, 2:35 p.m. UTC | #2
Den 25.10.2018 22.25, skrev Boris Brezillon:
> On Thu, 25 Oct 2018 22:13:37 +0200
> Noralf Trønnes <noralf@tronnes.org> wrote:
>
>> The CMA helper is already using the drm_fb_helper_generic_probe part of
>> the generic fbdev emulation. This patch makes full use of the generic
>> fbdev emulation by using its drm_client callbacks. This means that
>> drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
>> now handled by the emulation code. Additionally fbdev unregister happens
>> automatically on drm_dev_unregister().
>>
>> The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
>> driver. This is done to highlight the fact that fbdev emulation is an
>> internal client that makes use of the driver, it is not part of the
>> driver as such. If fbdev setup fails, an error is printed, but the driver
>> succeeds probing.
>>
>> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>

Applied to drm-misc-next.

Noralf.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index fedbfa333bb0..034a91112098 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -556,7 +556,6 @@  static int atmel_hlcdc_dc_atomic_commit(struct drm_device *dev,
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = atmel_hlcdc_fb_create,
-	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = atmel_hlcdc_dc_atomic_commit,
 };
@@ -658,8 +657,6 @@  static int atmel_hlcdc_dc_load(struct drm_device *dev)
 
 	platform_set_drvdata(pdev, dev);
 
-	drm_fb_cma_fbdev_init(dev, 24, 0);
-
 	drm_kms_helper_poll_init(dev);
 
 	return 0;
@@ -678,7 +675,6 @@  static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 {
 	struct atmel_hlcdc_dc *dc = dev->dev_private;
 
-	drm_fb_cma_fbdev_fini(dev);
 	flush_workqueue(dc->wq);
 	drm_kms_helper_poll_fini(dev);
 	drm_atomic_helper_shutdown(dev);
@@ -727,7 +723,6 @@  static struct drm_driver atmel_hlcdc_dc_driver = {
 	.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
 			   DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
-	.lastclose = drm_fb_helper_lastclose,
 	.irq_handler = atmel_hlcdc_dc_irq_handler,
 	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
 	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
@@ -769,6 +764,8 @@  static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
+	drm_fbdev_generic_setup(ddev, 24);
+
 	return 0;
 
 err_unload: