diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2006-01-02 04:14:23 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-01-02 04:14:23 -0500 |
commit | 0d6aa60b4ac9689b750e35cd66f5d7c053aff0f4 (patch) | |
tree | dfc0d9ddfb139df8612e1823f9af89a6ff000a31 /drivers/char/drm/i915_irq.c | |
parent | f0c408b564ddefa0959ada4e2c2248f4a57f1842 (diff) |
drm: update to i915 1.3.0
Add support for vblank ioctls to i915 driver
From: Dave Airlie <airlied@linux.ie>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/i915_irq.c')
-rw-r--r-- | drivers/char/drm/i915_irq.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index 4fa448ee846b..a1381c61aa63 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* i915_dma.c -- DMA support for the I915 -*- linux-c -*- | 1 | /* i915_irq.c -- IRQ support for the I915 -*- linux-c -*- |
2 | */ | 2 | */ |
3 | /************************************************************************** | 3 | /* |
4 | * | ||
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. | 4 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
6 | * All Rights Reserved. | 5 | * All Rights Reserved. |
7 | * | 6 | * |
@@ -25,16 +24,18 @@ | |||
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | * | 26 | * |
28 | **************************************************************************/ | 27 | */ |
29 | 28 | ||
30 | #include "drmP.h" | 29 | #include "drmP.h" |
31 | #include "drm.h" | 30 | #include "drm.h" |
32 | #include "i915_drm.h" | 31 | #include "i915_drm.h" |
33 | #include "i915_drv.h" | 32 | #include "i915_drv.h" |
34 | 33 | ||
35 | #define USER_INT_FLAG 0x2 | 34 | #define USER_INT_FLAG (1<<1) |
35 | #define VSYNC_PIPEB_FLAG (1<<5) | ||
36 | #define VSYNC_PIPEA_FLAG (1<<7) | ||
37 | |||
36 | #define MAX_NOPID ((u32)~0) | 38 | #define MAX_NOPID ((u32)~0) |
37 | #define READ_BREADCRUMB(dev_priv) (((u32*)(dev_priv->hw_status_page))[5]) | ||
38 | 39 | ||
39 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 40 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
40 | { | 41 | { |
@@ -43,7 +44,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
43 | u16 temp; | 44 | u16 temp; |
44 | 45 | ||
45 | temp = I915_READ16(I915REG_INT_IDENTITY_R); | 46 | temp = I915_READ16(I915REG_INT_IDENTITY_R); |
46 | temp &= USER_INT_FLAG; | 47 | temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG); |
47 | 48 | ||
48 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); | 49 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); |
49 | 50 | ||
@@ -51,7 +52,15 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
51 | return IRQ_NONE; | 52 | return IRQ_NONE; |
52 | 53 | ||
53 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); | 54 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); |
54 | DRM_WAKEUP(&dev_priv->irq_queue); | 55 | |
56 | if (temp & USER_INT_FLAG) | ||
57 | DRM_WAKEUP(&dev_priv->irq_queue); | ||
58 | |||
59 | if (temp & VSYNC_PIPEA_FLAG) { | ||
60 | atomic_inc(&dev->vbl_received); | ||
61 | DRM_WAKEUP(&dev->vbl_queue); | ||
62 | drm_vbl_send_signals(dev); | ||
63 | } | ||
55 | 64 | ||
56 | return IRQ_HANDLED; | 65 | return IRQ_HANDLED; |
57 | } | 66 | } |
@@ -102,6 +111,27 @@ static int i915_wait_irq(drm_device_t * dev, int irq_nr) | |||
102 | return ret; | 111 | return ret; |
103 | } | 112 | } |
104 | 113 | ||
114 | int i915_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) | ||
115 | { | ||
116 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
117 | unsigned int cur_vblank; | ||
118 | int ret = 0; | ||
119 | |||
120 | if (!dev_priv) { | ||
121 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | ||
122 | return DRM_ERR(EINVAL); | ||
123 | } | ||
124 | |||
125 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
126 | (((cur_vblank = atomic_read(&dev->vbl_received)) | ||
127 | - *sequence) <= (1<<23))); | ||
128 | |||
129 | *sequence = cur_vblank; | ||
130 | |||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | |||
105 | /* Needs the lock as it touches the ring. | 135 | /* Needs the lock as it touches the ring. |
106 | */ | 136 | */ |
107 | int i915_irq_emit(DRM_IOCTL_ARGS) | 137 | int i915_irq_emit(DRM_IOCTL_ARGS) |
@@ -165,7 +195,7 @@ void i915_driver_irq_postinstall(drm_device_t * dev) | |||
165 | { | 195 | { |
166 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 196 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
167 | 197 | ||
168 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG); | 198 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | VSYNC_PIPEA_FLAG); |
169 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 199 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
170 | } | 200 | } |
171 | 201 | ||