staging: drm/omap: add a workqueue
authorRob Clark <rob@ti.com>
Mon, 5 Mar 2012 16:48:32 +0000 (10:48 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Mar 2012 21:38:06 +0000 (13:38 -0800)
Add a workqueue for omapdrm driver, which is needed for at least a
couple things currently: (1) moving omap_gem_roll() to a non-atomic
context, (2) synchronizing page flips w/ DSS scanout related irq's
(in particular not unmapping previous buffer until DSS finishes
scanout).

Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/omapdrm/omap_drv.c
drivers/staging/omapdrm/omap_drv.h

index 3bbea9aac404338e0d87bb20e0cccc8e7620a489..7417e1f35aa9bc73f0a73a64af54a15f3d73b30f 100644 (file)
@@ -570,6 +570,9 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
 
        dev->dev_private = priv;
 
+       priv->wq = alloc_workqueue("omapdrm",
+                       WQ_UNBOUND | WQ_NON_REENTRANT, 1);
+
        omap_gem_init(dev);
 
        ret = omap_modeset_init(dev);
@@ -598,6 +601,8 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
 
 static int dev_unload(struct drm_device *dev)
 {
+       struct omap_drm_private *priv = dev->dev_private;
+
        DBG("unload: dev=%p", dev);
 
        drm_vblank_cleanup(dev);
@@ -607,6 +612,9 @@ static int dev_unload(struct drm_device *dev)
        omap_modeset_free(dev);
        omap_gem_deinit(dev);
 
+       flush_workqueue(priv->wq);
+       destroy_workqueue(priv->wq);
+
        kfree(dev->dev_private);
        dev->dev_private = NULL;
 
index d924c95c769ec37080169e7b58b7dfa95e1ffad5..a84547c2464b48d7efca502c84b75cffc4d9f9bd 100644 (file)
@@ -51,6 +51,8 @@ struct omap_drm_private {
 
        struct drm_fb_helper *fbdev;
 
+       struct workqueue_struct *wq;
+
        bool has_dmm;
 };