Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gma500: frame buffer locking

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 the console printing lock).

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

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Alan Cox and committed by
Dave Airlie
9242fe23 1f0d0b51

+8 -6
+6 -4
drivers/gpu/drm/gma500/accel_2d.c
··· 111 111 int ret = 0; 112 112 int i; 113 113 unsigned submit_size; 114 + unsigned long flags; 114 115 115 - mutex_lock(&dev_priv->mutex_2d); 116 + spin_lock_irqsave(&dev_priv->lock_2d, flags); 116 117 while (size > 0) { 117 118 submit_size = (size < 0x60) ? size : 0x60; 118 119 size -= submit_size; ··· 128 127 129 128 (void)PSB_RSGX32(PSB_SGX_2D_SLAVE_PORT + i - 4); 130 129 } 131 - mutex_unlock(&dev_priv->mutex_2d); 130 + spin_unlock_irqrestore(&dev_priv->lock_2d, flags); 132 131 return ret; 133 132 } 134 133 ··· 328 327 struct drm_psb_private *dev_priv = dev->dev_private; 329 328 unsigned long _end = jiffies + DRM_HZ; 330 329 int busy = 0; 330 + unsigned long flags; 331 331 332 - mutex_lock(&dev_priv->mutex_2d); 332 + spin_lock_irqsave(&dev_priv->lock_2d, flags); 333 333 /* 334 334 * First idle the 2D engine. 335 335 */ ··· 359 357 _PSB_C2B_STATUS_BUSY) != 0); 360 358 361 359 out: 362 - mutex_unlock(&dev_priv->mutex_2d); 360 + spin_unlock_irqrestore(&dev_priv->lock_2d, flags); 363 361 return (busy) ? -EBUSY : 0; 364 362 }
+1 -1
drivers/gpu/drm/gma500/psb_drv.c
··· 186 186 187 187 188 188 spin_lock_init(&dev_priv->irqmask_lock); 189 - mutex_init(&dev_priv->mutex_2d); 189 + spin_lock_init(&dev_priv->lock_2d); 190 190 191 191 PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0); 192 192 PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1);
+1 -1
drivers/gpu/drm/gma500/psb_drv.h
··· 606 606 void *fbdev; 607 607 608 608 /* 2D acceleration */ 609 - struct mutex mutex_2d; 609 + spinlock_t lock_2d; 610 610 }; 611 611 612 612