diff mbox

[07/12] drm: arm: malidp: Use drm_atomic_helper_shutdown() to disable planes on removal

Message ID 20180117215535.16517-8-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Jan. 17, 2018, 9:55 p.m. UTC
The plane cleanup handler currently calls drm_plane_helper_disable(),
which is a legacy helper function. Replace it with a call to
drm_atomic_helper_shutdown() at removal time.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/arm/malidp_drv.c    | 1 +
 drivers/gpu/drm/arm/malidp_planes.c | 4 ----
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Liviu Dudau Jan. 19, 2018, 3:48 p.m. UTC | #1
Hi Laurent,

On Wed, Jan 17, 2018 at 11:55:30PM +0200, Laurent Pinchart wrote:
> The plane cleanup handler currently calls drm_plane_helper_disable(),
> which is a legacy helper function. Replace it with a call to
> drm_atomic_helper_shutdown() at removal time.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  drivers/gpu/drm/arm/malidp_drv.c    | 1 +
>  drivers/gpu/drm/arm/malidp_planes.c | 4 ----
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 0711279e836f..5d037ea576c7 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -276,6 +276,7 @@ static int malidp_init(struct drm_device *drm)
>  
>  static void malidp_fini(struct drm_device *drm)
>  {
> +	drm_atomic_helper_shutdown(drm);
>  	drm_mode_config_cleanup(drm);
>  }
>  
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index d883d28d5d9d..2bc1264ec73a 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -56,10 +56,6 @@ static void malidp_de_plane_destroy(struct drm_plane *plane)
>  {
>  	struct malidp_plane *mp = to_malidp_plane(plane);
>  
> -	if (mp->base.fb)
> -		drm_framebuffer_put(mp->base.fb);
> -
> -	drm_plane_helper_disable(plane);
>  	drm_plane_cleanup(plane);
>  	kfree(mp);
>  }

With this change in place I'm getting

[drm:drm_atomic_helper_shutdown [drm_kms_helper]] *ERROR* Disabling all crtc's during unload failed with -22

when trying to remove the mali-dp module.

Echoing 0x3f into /sys/module/drm/parameters/debug I get this:

[  332.072080] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4386, diff=1, hw=0 hw_last=0
[  332.091326] [drm:drm_sysfs_connector_remove [drm]] removing "HDMI-A-1" from sysfs
[  332.101255] Console: switching to colour dummy device 80x25
[  332.105506] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4387, diff=1, hw=0 hw_last=0
[  332.117772] [drm:drm_atomic_state_init [drm]] Allocated atomic state 0000000035c85576
[  332.125710] [drm:drm_mode_object_get [drm]] OBJ ID: 62 (3)
[  332.131302] [drm:drm_atomic_get_plane_state [drm]] Added [PLANE:28:plane-0] 000000002713c919 state to 0000000035c85576
[  332.139069] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4388, diff=1, hw=0 hw_last=0
[  332.152827] [drm:drm_mode_object_get [drm]] OBJ ID: 45 (1)
[  332.158558] [drm:drm_atomic_get_crtc_state [drm]] Added [CRTC:35:crtc-0] 00000000da10cba0 state to 0000000035c85576
[  332.169169] [drm:drm_atomic_set_fb_for_plane [drm]] Set [NOFB] for plane state 000000002713c919
[  332.178051] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4389, diff=1, hw=0 hw_last=0
[  332.188836] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 62 (4)
[  332.195145] [drm:drm_atomic_set_crtc_for_plane [drm]] Link plane state 000000002713c919 to [NOCRTC]
[  332.204373] [drm:drm_atomic_check_only [drm]] checking 0000000035c85576
[  332.211182] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4390, diff=1, hw=0 hw_last=0
[  332.221968] [drm:drm_atomic_commit [drm]] committing 0000000035c85576
[  332.228617] [drm:drm_calc_timestamping_constants [drm]] crtc 35: hwmode: htotal 2200, vtotal 562, vdisplay 540
[  332.238787] [drm:drm_calc_timestamping_constants [drm]] crtc 35: clock 74250 kHz framedur 8325925 linedur 29629
[  332.249039] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4391, diff=1, hw=0 hw_last=0
[  332.272706] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4392, diff=1, hw=0 hw_last=0
[  332.306160] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4393, diff=1, hw=0 hw_last=0
[  332.317030] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 62 (3)
[  332.323327] [drm:drm_atomic_state_default_clear [drm]] Clearing atomic state 0000000035c85576
[  332.332041] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 45 (2)
[  332.338331] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 62 (2)
[  332.339680] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4394, diff=1, hw=0 hw_last=0
[  332.355181] [drm:__drm_atomic_state_free [drm]] Freeing atomic state 0000000035c85576
[  332.363204] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 62 (1)
[  332.373126] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4395, diff=1, hw=0 hw_last=0
[  332.395308] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 37 (4)
[  332.401599] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 37 (3)
[  332.406566] [drm:drm_update_vblank_count [drm]] updating vblank count on crtc 0: current=4396, diff=1, hw=0 hw_last=0
[  332.418489] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 0 (2)
[  332.432903] [drm:drm_atomic_state_init [drm]] Allocated atomic state 00000000af12a943
[  332.440934] [drm:drm_mode_object_get [drm]] OBJ ID: 45 (1)
[  332.446635] [drm:drm_atomic_get_crtc_state [drm]] Added [CRTC:35:crtc-0] 000000006a7e1466 state to 00000000af12a943
[  332.457242] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 45 (2)
[  332.463529] [drm:drm_atomic_set_mode_prop_for_crtc [drm]] Set [NOMODE] for CRTC state 000000006a7e1466
[  332.473014] [drm:drm_atomic_add_affected_connectors [drm]] Adding all current connectors for [CRTC:35:crtc-0] to 00000000af12a943
[  332.484819] [drm:drm_atomic_check_only [drm]] checking 00000000af12a943
[  332.491537] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] [CRTC:35:crtc-0] mode changed
[  332.500391] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] [CRTC:35:crtc-0] enable changed
[  332.509419] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] [CRTC:35:crtc-0] active changed
[  332.518442] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] [CRTC:35:crtc-0] enabled/connectors mismatch
[  332.528700] [drm:drm_atomic_state_default_clear [drm]] Clearing atomic state 00000000af12a943
[  332.537399] [drm:__drm_atomic_state_free [drm]] Freeing atomic state 00000000af12a943
[  332.551046] [drm:drm_atomic_helper_shutdown [drm_kms_helper]] *ERROR* Disabling all crtc's during unload failed with -22
[  332.562153] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 45 (1)
[  332.568444] [drm:drm_mode_object_put.part.0 [drm]] OBJ ID: 63 (1)

It looks like drm_atomic_helper_check_modeset is being tripped by the final drm_atomic_commit()
that happens in the drm_atomic_helper_disable_all() function as called by drm_atomic_helper_shutdown().

Not sure why the new_crtc_state->connector_mask is not zero when drm_atomic_helper_check_modeset()
gets called. Any suggestions?

Best regards,
Liviu


> -- 
> Regards,
> 
> Laurent Pinchart
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 0711279e836f..5d037ea576c7 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -276,6 +276,7 @@  static int malidp_init(struct drm_device *drm)
 
 static void malidp_fini(struct drm_device *drm)
 {
+	drm_atomic_helper_shutdown(drm);
 	drm_mode_config_cleanup(drm);
 }
 
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index d883d28d5d9d..2bc1264ec73a 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -56,10 +56,6 @@  static void malidp_de_plane_destroy(struct drm_plane *plane)
 {
 	struct malidp_plane *mp = to_malidp_plane(plane);
 
-	if (mp->base.fb)
-		drm_framebuffer_put(mp->base.fb);
-
-	drm_plane_helper_disable(plane);
 	drm_plane_cleanup(plane);
 	kfree(mp);
 }