diff mbox series

[v2,8/9] drm/tilcdc: Use drm_fbdev_generic_setup()

Message ID 20181025201340.34227-9-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: Jyri Sarha <jsarha@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Jyri Sarha Oct. 29, 2018, 3:55 p.m. UTC | #1
On 25/10/18 23:13, Noralf Trønnes 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: Jyri Sarha <jsarha@ti.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>

Thanks!

Acked-by: Jyri Sarha <jsarha@ti.com>

> ---
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 33e533268488..3dac08b24140 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -140,7 +140,6 @@ static int tilcdc_commit(struct drm_device *dev,
>  
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = tilcdc_fb_create,
> -	.output_poll_changed = drm_fb_helper_output_poll_changed,
>  	.atomic_check = tilcdc_atomic_check,
>  	.atomic_commit = tilcdc_commit,
>  };
> @@ -191,9 +190,6 @@ static void tilcdc_fini(struct drm_device *dev)
>  		drm_dev_unregister(dev);
>  
>  	drm_kms_helper_poll_fini(dev);
> -
> -	drm_fb_cma_fbdev_fini(dev);
> -
>  	drm_irq_uninstall(dev);
>  	drm_mode_config_cleanup(dev);
>  	tilcdc_remove_external_device(dev);
> @@ -396,16 +392,14 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
>  
>  	drm_mode_config_reset(ddev);
>  
> -	ret = drm_fb_cma_fbdev_init(ddev, bpp, 0);
> -	if (ret)
> -		goto init_failed;
> -
>  	drm_kms_helper_poll_init(ddev);
>  
>  	ret = drm_dev_register(ddev, 0);
>  	if (ret)
>  		goto init_failed;
>  
> +	drm_fbdev_generic_setup(ddev, bpp);
> +
>  	priv->is_registered = true;
>  	return 0;
>  
> @@ -519,7 +513,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>  static struct drm_driver tilcdc_driver = {
>  	.driver_features    = (DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET |
>  			       DRIVER_PRIME | DRIVER_ATOMIC),
> -	.lastclose          = drm_fb_helper_lastclose,
>  	.irq_handler        = tilcdc_irq,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
>  	.gem_print_info     = drm_gem_cma_print_info,
>
Noralf Trønnes Nov. 1, 2018, 2:35 p.m. UTC | #2
Den 29.10.2018 16.55, skrev Jyri Sarha:
> On 25/10/18 23:13, Noralf Trønnes 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: Jyri Sarha <jsarha@ti.com>
>> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> Thanks!
>
> Acked-by: Jyri Sarha <jsarha@ti.com>

Applied to drm-misc-next.

Noralf.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 33e533268488..3dac08b24140 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -140,7 +140,6 @@  static int tilcdc_commit(struct drm_device *dev,
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = tilcdc_fb_create,
-	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = tilcdc_atomic_check,
 	.atomic_commit = tilcdc_commit,
 };
@@ -191,9 +190,6 @@  static void tilcdc_fini(struct drm_device *dev)
 		drm_dev_unregister(dev);
 
 	drm_kms_helper_poll_fini(dev);
-
-	drm_fb_cma_fbdev_fini(dev);
-
 	drm_irq_uninstall(dev);
 	drm_mode_config_cleanup(dev);
 	tilcdc_remove_external_device(dev);
@@ -396,16 +392,14 @@  static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
 
 	drm_mode_config_reset(ddev);
 
-	ret = drm_fb_cma_fbdev_init(ddev, bpp, 0);
-	if (ret)
-		goto init_failed;
-
 	drm_kms_helper_poll_init(ddev);
 
 	ret = drm_dev_register(ddev, 0);
 	if (ret)
 		goto init_failed;
 
+	drm_fbdev_generic_setup(ddev, bpp);
+
 	priv->is_registered = true;
 	return 0;
 
@@ -519,7 +513,6 @@  DEFINE_DRM_GEM_CMA_FOPS(fops);
 static struct drm_driver tilcdc_driver = {
 	.driver_features    = (DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET |
 			       DRIVER_PRIME | DRIVER_ATOMIC),
-	.lastclose          = drm_fb_helper_lastclose,
 	.irq_handler        = tilcdc_irq,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_print_info     = drm_gem_cma_print_info,