diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-11-23 18:49:06 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-11-23 18:49:06 +0000 |
commit | d44ed417c9c923d8f29721defe7eafb1f63ef1b1 (patch) | |
tree | 5fce9ec558739c5bf5243ccbf477e4c40541bce9 /sys/dev/pci | |
parent | 785a2c018b870f8ec476fa5a30d387be2b97f53f (diff) |
Make it so that instead of grabbing and ungrabbing the spinlock one line apart,
we just grab it once and drop it when we're done.
will reduce spl/splx wrangling. While here, clean it up a little bit.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/drm/i915_drv.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915_irq.c | 30 |
2 files changed, 18 insertions, 16 deletions
diff --git a/sys/dev/pci/drm/i915_drv.h b/sys/dev/pci/drm/i915_drv.h index 9ff07dd05a3..30e8c6d99b3 100644 --- a/sys/dev/pci/drm/i915_drv.h +++ b/sys/dev/pci/drm/i915_drv.h @@ -261,8 +261,8 @@ extern int i915_emit_irq(struct drm_device * dev); extern int i915_enable_vblank(struct drm_device *dev, int crtc); extern void i915_disable_vblank(struct drm_device *dev, int crtc); extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc); -extern void i915_user_irq_get(struct drm_device *dev); -extern void i915_user_irq_put(struct drm_device *dev); +extern void i915_user_irq_get(struct drm_i915_private *); +extern void i915_user_irq_put(struct drm_i915_private *); /* ioctls */ extern int i915_dma_init(struct drm_device *, void *, struct drm_file *); diff --git a/sys/dev/pci/drm/i915_irq.c b/sys/dev/pci/drm/i915_irq.c index 0e7e9b47dac..b899f01b6b3 100644 --- a/sys/dev/pci/drm/i915_irq.c +++ b/sys/dev/pci/drm/i915_irq.c @@ -176,9 +176,9 @@ inteldrm_intr(void *arg) if (dev_priv->sarea_priv != NULL) dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); - if (iir & I915_USER_INTERRUPT) { + if (iir & I915_USER_INTERRUPT) wakeup(dev_priv); - } + mtx_leave(&dev_priv->user_irq_lock); if (pipea_stats & I915_VBLANK_INTERRUPT_STATUS) @@ -210,25 +210,21 @@ i915_emit_irq(struct drm_device *dev) } void -i915_user_irq_get(struct drm_device *dev) +i915_user_irq_get(struct drm_i915_private *dev_priv) { - drm_i915_private_t *dev_priv = dev->dev_private; + struct drm_device *dev = (struct drm_device *)dev_priv->drmdev; - mtx_enter(&dev_priv->user_irq_lock); if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) i915_enable_irq(dev_priv, I915_USER_INTERRUPT); - mtx_leave(&dev_priv->user_irq_lock); } void -i915_user_irq_put(struct drm_device *dev) +i915_user_irq_put(struct drm_i915_private *dev_priv) { - drm_i915_private_t *dev_priv = dev->dev_private; + struct drm_device *dev = (struct drm_device *)dev_priv->drmdev; - mtx_enter(&dev_priv->user_irq_lock); if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0)) i915_disable_irq(dev_priv, I915_USER_INTERRUPT); - mtx_leave(&dev_priv->user_irq_lock); } @@ -241,10 +237,16 @@ i915_wait_irq(struct drm_device *dev, int irq_nr) DRM_DEBUG("irq_nr=%d breadcrumb=%d\n", irq_nr, READ_BREADCRUMB(dev_priv)); - i915_user_irq_get(dev); - DRM_WAIT_ON(ret, dev_priv, &dev_priv->user_irq_lock, 3 * hz, "i915wt", - READ_BREADCRUMB(dev_priv) >= irq_nr); - i915_user_irq_put(dev); + mtx_enter(&dev_priv->user_irq_lock); + i915_user_irq_get(dev_priv); + while (ret == 0) { + if (READ_BREADCRUMB(dev_priv) >= irq_nr) + break; + ret = msleep(dev_priv, &dev_priv->user_irq_lock, + PZERO | PCATCH, "i915wt", 3 * hz); + } + i915_user_irq_put(dev_priv); + mtx_leave(&dev_priv->user_irq_lock); if (dev_priv->sarea_priv != NULL) dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); |