staging: gma500: frame buffer locking
authorAlan Cox <alan@linux.intel.com>
Thu, 22 Sep 2011 12:20:57 +0000 (13:20 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 27 Sep 2011 00:32:53 +0000 (17:32 -0700)
If we are the console then a printk can hit us with a spin lock held (and
in fact the kernel will do its best to take printing lock).

In that case we cannot politely sleep when synching after an accelerated op
but must behave obnixously to be sure of getting the bits out.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/gma500/accel_2d.c
drivers/staging/gma500/psb_drv.c
drivers/staging/gma500/psb_drv.h

index be9237184ab83a55ada02430f4908e123355cd05..114b99a1ce1914d8e5b906d7e070986350e974ae 100644 (file)
@@ -111,8 +111,9 @@ static int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
        int ret = 0;
        int i;
        unsigned submit_size;
+       unsigned long flags;
 
-       mutex_lock(&dev_priv->mutex_2d);
+       spin_lock_irqsave(&dev_priv->lock_2d, flags);
        while (size > 0) {
                submit_size = (size < 0x60) ? size : 0x60;
                size -= submit_size;
@@ -127,7 +128,7 @@ static int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
 
                (void)PSB_RSGX32(PSB_SGX_2D_SLAVE_PORT + i - 4);
        }
-       mutex_unlock(&dev_priv->mutex_2d);
+       spin_unlock_irqrestore(&dev_priv->lock_2d, flags);
        return ret;
 }
 
@@ -327,8 +328,9 @@ int psbfb_sync(struct fb_info *info)
        struct drm_psb_private *dev_priv = dev->dev_private;
        unsigned long _end = jiffies + DRM_HZ;
        int busy = 0;
+       unsigned long flags;
 
-       mutex_lock(&dev_priv->mutex_2d);
+       spin_lock_irqsave(&dev_priv->lock_2d, flags);
        /*
         * First idle the 2D engine.
         */
@@ -357,7 +359,7 @@ int psbfb_sync(struct fb_info *info)
                                        _PSB_C2B_STATUS_BUSY) != 0);
 
 out:
-       mutex_unlock(&dev_priv->mutex_2d);
+       spin_unlock_irqrestore(&dev_priv->lock_2d, flags);
        return (busy) ? -EBUSY : 0;
 }
 
index 297b05a391d638e93eccb539153ef7584571b78e..dc676c2ce810c1d5303a36f6b034424afe8ad652 100644 (file)
@@ -228,7 +228,7 @@ static int psb_do_init(struct drm_device *dev)
 
 
        spin_lock_init(&dev_priv->irqmask_lock);
-       mutex_init(&dev_priv->mutex_2d);
+       spin_lock_init(&dev_priv->lock_2d);
 
        PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0);
        PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1);
index 9cbb494ed3d601a4588bb127fbd7a6653775de3a..11d963a055be74ebb07108b1c30e4da225e69c4e 100644 (file)
@@ -612,7 +612,7 @@ struct drm_psb_private {
        void (*exit_idle)(struct drm_device *dev, u32 update_src);
 
        /* 2D acceleration */
-       struct mutex mutex_2d;
+       spinlock_t lock_2d;
 
        /* FIXME: Arrays anyone ? */
        struct mdfld_dsi_encoder *encoder0;     
This page took 0.028441 seconds and 5 git commands to generate.