[PATCH 8/9] drm/omap: fix preclose to wait for scheduled work

Daniel Vetter daniel at ffwll.ch
Wed Sep 3 07:32:53 PDT 2014


On Wed, Sep 03, 2014 at 02:55:09PM +0300, Tomi Valkeinen wrote:
> We already wait for all scheduled work to be done on the driver's unload
> function. However, I think we need to wait on preclose() also, so that
> when an application closes the drm file descriptor, we are sure that
> there's no left around.

The justification (likely, didn't check omapdrm code) for this is that we
need to clear out all outstanding drm_events. Currently i915 and some
other drivers (but not all) have that open-coded. We should probably track
drm_events on a per-fd list and move this logic into the core instead of
adding more driver-specific hacks.
-Daniel
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 26fda74c1e48..f59fa6600cf8 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -594,7 +594,20 @@ static void dev_lastclose(struct drm_device *dev)
>  
>  static void dev_preclose(struct drm_device *dev, struct drm_file *file)
>  {
> +	struct omap_drm_private *priv = dev->dev_private;
> +	int i;
> +
>  	DBG("preclose: dev=%p", dev);
> +
> +	/*
> +	 * Flush crtcs to finish any pending work.
> +	 * Note: this may not be correct if there are multiple applications
> +	 * using the drm device, and could possibly result in a timeout from
> +	 * omap_crtc_flush() if an other application is actively queuing new
> +	 * work.
> +	 */
> +	for (i = 0; i < priv->num_crtcs; i++)
> +		omap_crtc_flush(priv->crtcs[i]);
>  }
>  
>  static void dev_postclose(struct drm_device *dev, struct drm_file *file)
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list