diff mbox series

[13/20] drm/sti: Use drm_fbdev_generic_setup()

Message ID 20180908134648.2582-14-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 Sept. 8, 2018, 1:46 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().

If drm_fbdev_generic_setup() fails, an error is printed by the function.

drm_fbdev_generic_setup() handles mode_config.num_connector being zero.
In that case it retries fbdev setup on the next .output_poll_changed.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/sti/sti_drv.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Benjamin Gaignard Sept. 10, 2018, 9:39 a.m. UTC | #1
2018-09-08 15:46 GMT+02:00 Noralf Trønnes <noralf@tronnes.org>:
> 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().
>
> If drm_fbdev_generic_setup() fails, an error is printed by the function.
>
> drm_fbdev_generic_setup() handles mode_config.num_connector being zero.
> In that case it retries fbdev setup on the next .output_poll_changed.
>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

> ---
>  drivers/gpu/drm/sti/sti_drv.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 832fc43960ee..6dced8abcf16 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -121,7 +121,6 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
>
>  static const struct drm_mode_config_funcs sti_mode_config_funcs = {
>         .fb_create = drm_gem_fb_create,
> -       .output_poll_changed = drm_fb_helper_output_poll_changed,
>         .atomic_check = drm_atomic_helper_check,
>         .atomic_commit = drm_atomic_helper_commit,
>  };
> @@ -206,7 +205,6 @@ static void sti_cleanup(struct drm_device *ddev)
>  {
>         struct sti_private *private = ddev->dev_private;
>
> -       drm_fb_cma_fbdev_fini(ddev);
>         drm_kms_helper_poll_fini(ddev);
>         component_unbind_all(ddev->dev, ddev);
>         kfree(private);
> @@ -236,11 +234,7 @@ static int sti_bind(struct device *dev)
>
>         drm_mode_config_reset(ddev);
>
> -       if (ddev->mode_config.num_connector) {
> -               ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
> -               if (ret)
> -                       DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
> -       }
> +       drm_fbdev_generic_setup(ddev, 32);
>
>         return 0;
>
> --
> 2.15.1
>
Noralf Trønnes Sept. 25, 2018, 9:48 a.m. UTC | #2
Den 10.09.2018 11.39, skrev Benjamin Gaignard:
> 2018-09-08 15:46 GMT+02:00 Noralf Trønnes <noralf@tronnes.org>:
>> 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().
>>
>> If drm_fbdev_generic_setup() fails, an error is printed by the function.
>>
>> drm_fbdev_generic_setup() handles mode_config.num_connector being zero.
>> In that case it retries fbdev setup on the next .output_poll_changed.
>>
>> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>> Cc: Vincent Abriou <vincent.abriou@st.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

Applied to drm-misc-next, thanks.

Noralf

>> ---
>>   drivers/gpu/drm/sti/sti_drv.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
>> index 832fc43960ee..6dced8abcf16 100644
>> --- a/drivers/gpu/drm/sti/sti_drv.c
>> +++ b/drivers/gpu/drm/sti/sti_drv.c
>> @@ -121,7 +121,6 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
>>
>>   static const struct drm_mode_config_funcs sti_mode_config_funcs = {
>>          .fb_create = drm_gem_fb_create,
>> -       .output_poll_changed = drm_fb_helper_output_poll_changed,
>>          .atomic_check = drm_atomic_helper_check,
>>          .atomic_commit = drm_atomic_helper_commit,
>>   };
>> @@ -206,7 +205,6 @@ static void sti_cleanup(struct drm_device *ddev)
>>   {
>>          struct sti_private *private = ddev->dev_private;
>>
>> -       drm_fb_cma_fbdev_fini(ddev);
>>          drm_kms_helper_poll_fini(ddev);
>>          component_unbind_all(ddev->dev, ddev);
>>          kfree(private);
>> @@ -236,11 +234,7 @@ static int sti_bind(struct device *dev)
>>
>>          drm_mode_config_reset(ddev);
>>
>> -       if (ddev->mode_config.num_connector) {
>> -               ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
>> -               if (ret)
>> -                       DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
>> -       }
>> +       drm_fbdev_generic_setup(ddev, 32);
>>
>>          return 0;
>>
>> --
>> 2.15.1
>>
>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 832fc43960ee..6dced8abcf16 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -121,7 +121,6 @@  static int sti_drm_dbg_init(struct drm_minor *minor)
 
 static const struct drm_mode_config_funcs sti_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -206,7 +205,6 @@  static void sti_cleanup(struct drm_device *ddev)
 {
 	struct sti_private *private = ddev->dev_private;
 
-	drm_fb_cma_fbdev_fini(ddev);
 	drm_kms_helper_poll_fini(ddev);
 	component_unbind_all(ddev->dev, ddev);
 	kfree(private);
@@ -236,11 +234,7 @@  static int sti_bind(struct device *dev)
 
 	drm_mode_config_reset(ddev);
 
-	if (ddev->mode_config.num_connector) {
-		ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
-		if (ret)
-			DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
-	}
+	drm_fbdev_generic_setup(ddev, 32);
 
 	return 0;