All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Move vblank cleanup from unregister to release
@ 2016-12-14 10:48 Laurent Pinchart
  2016-12-14 11:16 ` Lucas Stach
  2016-12-14 11:18 ` Tomi Valkeinen
  0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2016-12-14 10:48 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, Tomi Valkeinen

Calling drm_vblank_cleanup() in drm_dev_unregister() causes issues with
drivers that have moved away from the .load() and .unload() midlayer.
Those drivers call drm_dev_unregister() as the first operation at unbind
time, before shutting down the device. This results in warnings due to
drm_vblank_cleanup() being called with vblank interrupts still active,
and then to vblank events being sent after cleanup.

Fix the problem by moving vblank cleanup from drm_dev_unregister() to
drm_dev_release() that is guaranteed to be called after drivers shut
down the device.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Tomi, this fixes the rmmod issue you've reported in response to
"[PATCH v4 00/22] OMAP DRM fixes and improvements".

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index a525751b4559..a899daf54ac3 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -595,6 +595,8 @@ static void drm_dev_release(struct kref *ref)
 {
 	struct drm_device *dev = container_of(ref, struct drm_device, ref);
 
+	drm_vblank_cleanup(dev);
+
 	if (drm_core_check_feature(dev, DRIVER_GEM))
 		drm_gem_destroy(dev);
 
@@ -794,8 +796,6 @@ void drm_dev_unregister(struct drm_device *dev)
 	if (dev->agp)
 		drm_pci_agp_destroy(dev);
 
-	drm_vblank_cleanup(dev);
-
 	list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
 		drm_legacy_rmmap(dev, r_list->map);
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: Move vblank cleanup from unregister to release
  2016-12-14 10:48 [PATCH] drm: Move vblank cleanup from unregister to release Laurent Pinchart
@ 2016-12-14 11:16 ` Lucas Stach
  2016-12-14 11:18 ` Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas Stach @ 2016-12-14 11:16 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Daniel Vetter, Tomi Valkeinen, dri-devel

Am Mittwoch, den 14.12.2016, 12:48 +0200 schrieb Laurent Pinchart:
> Calling drm_vblank_cleanup() in drm_dev_unregister() causes issues with
> drivers that have moved away from the .load() and .unload() midlayer.
> Those drivers call drm_dev_unregister() as the first operation at unbind
> time, before shutting down the device. This results in warnings due to
> drm_vblank_cleanup() being called with vblank interrupts still active,
> and then to vblank events being sent after cleanup.
> 
> Fix the problem by moving vblank cleanup from drm_dev_unregister() to
> drm_dev_release() that is guaranteed to be called after drivers shut
> down the device.
> 
> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  drivers/gpu/drm/drm_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Tomi, this fixes the rmmod issue you've reported in response to
> "[PATCH v4 00/22] OMAP DRM fixes and improvements".
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index a525751b4559..a899daf54ac3 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -595,6 +595,8 @@ static void drm_dev_release(struct kref *ref)
>  {
>  	struct drm_device *dev = container_of(ref, struct drm_device, ref);
>  
> +	drm_vblank_cleanup(dev);
> +
>  	if (drm_core_check_feature(dev, DRIVER_GEM))
>  		drm_gem_destroy(dev);
>  
> @@ -794,8 +796,6 @@ void drm_dev_unregister(struct drm_device *dev)
>  	if (dev->agp)
>  		drm_pci_agp_destroy(dev);
>  
> -	drm_vblank_cleanup(dev);
> -
>  	list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
>  		drm_legacy_rmmap(dev, r_list->map);
>  


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: Move vblank cleanup from unregister to release
  2016-12-14 10:48 [PATCH] drm: Move vblank cleanup from unregister to release Laurent Pinchart
  2016-12-14 11:16 ` Lucas Stach
@ 2016-12-14 11:18 ` Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2016-12-14 11:18 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel; +Cc: Daniel Vetter


[-- Attachment #1.1.1: Type: text/plain, Size: 835 bytes --]

On 14/12/16 12:48, Laurent Pinchart wrote:
> Calling drm_vblank_cleanup() in drm_dev_unregister() causes issues with
> drivers that have moved away from the .load() and .unload() midlayer.
> Those drivers call drm_dev_unregister() as the first operation at unbind
> time, before shutting down the device. This results in warnings due to
> drm_vblank_cleanup() being called with vblank interrupts still active,
> and then to vblank events being sent after cleanup.
> 
> Fix the problem by moving vblank cleanup from drm_dev_unregister() to
> drm_dev_release() that is guaranteed to be called after drivers shut
> down the device.
> 
> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Tested-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

 Tomi


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-14 11:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14 10:48 [PATCH] drm: Move vblank cleanup from unregister to release Laurent Pinchart
2016-12-14 11:16 ` Lucas Stach
2016-12-14 11:18 ` Tomi Valkeinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.