i915_irq.c (152909) | i915_irq.c (157617) |
---|---|
1/* i915_irq.c -- IRQ support for the I915 -*- linux-c -*- 2 */ 3/*- 4 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * All Rights Reserved. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the --- 13 unchanged lines hidden (view full) --- 22 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 * 27 */ 28 29#include <sys/cdefs.h> | 1/* i915_irq.c -- IRQ support for the I915 -*- linux-c -*- 2 */ 3/*- 4 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5 * All Rights Reserved. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the --- 13 unchanged lines hidden (view full) --- 22 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 * 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/drm/i915_irq.c 152909 2005-11-28 23:13:57Z anholt $"); | 30__FBSDID("$FreeBSD: head/sys/dev/drm/i915_irq.c 157617 2006-04-09 20:45:45Z anholt $"); |
31 32#include "dev/drm/drmP.h" 33#include "dev/drm/drm.h" 34#include "dev/drm/i915_drm.h" 35#include "dev/drm/i915_drv.h" 36 | 31 32#include "dev/drm/drmP.h" 33#include "dev/drm/drm.h" 34#include "dev/drm/i915_drm.h" 35#include "dev/drm/i915_drv.h" 36 |
37#define USER_INT_FLAG 0x2 | 37#define USER_INT_FLAG (1<<1) 38#define VSYNC_PIPEB_FLAG (1<<5) 39#define VSYNC_PIPEA_FLAG (1<<7) 40 |
38#define MAX_NOPID ((u32)~0) | 41#define MAX_NOPID ((u32)~0) |
39#define READ_BREADCRUMB(dev_priv) (((u32*)(dev_priv->hw_status_page))[5]) | |
40 41irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) 42{ 43 drm_device_t *dev = (drm_device_t *) arg; 44 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 45 u16 temp; 46 47 temp = I915_READ16(I915REG_INT_IDENTITY_R); | 42 43irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) 44{ 45 drm_device_t *dev = (drm_device_t *) arg; 46 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 47 u16 temp; 48 49 temp = I915_READ16(I915REG_INT_IDENTITY_R); |
48 temp &= USER_INT_FLAG; | |
49 | 50 |
51 temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG); 52 |
|
50 DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); 51 52 if (temp == 0) 53 return IRQ_NONE; 54 55 I915_WRITE16(I915REG_INT_IDENTITY_R, temp); | 53 DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); 54 55 if (temp == 0) 56 return IRQ_NONE; 57 58 I915_WRITE16(I915REG_INT_IDENTITY_R, temp); |
56 DRM_WAKEUP(&dev_priv->irq_queue); | |
57 | 59 |
60 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 61 62 if (temp & USER_INT_FLAG) 63 DRM_WAKEUP(&dev_priv->irq_queue); 64 65 if (temp & VSYNC_PIPEA_FLAG) { 66 atomic_inc(&dev->vbl_received); 67 DRM_WAKEUP(&dev->vbl_queue); 68 drm_vbl_send_signals(dev); 69 } 70 |
|
58 return IRQ_HANDLED; 59} 60 61static int i915_emit_irq(drm_device_t * dev) 62{ 63 drm_i915_private_t *dev_priv = dev->dev_private; 64 u32 ret; 65 RING_LOCALS; --- 33 unchanged lines hidden (view full) --- 99 __FUNCTION__, 100 READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); 101 } 102 103 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 104 return ret; 105} 106 | 71 return IRQ_HANDLED; 72} 73 74static int i915_emit_irq(drm_device_t * dev) 75{ 76 drm_i915_private_t *dev_priv = dev->dev_private; 77 u32 ret; 78 RING_LOCALS; --- 33 unchanged lines hidden (view full) --- 112 __FUNCTION__, 113 READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); 114 } 115 116 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 117 return ret; 118} 119 |
120int i915_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) 121{ 122 drm_i915_private_t *dev_priv = dev->dev_private; 123 unsigned int cur_vblank; 124 int ret = 0; 125 126 if (!dev_priv) { 127 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 128 return DRM_ERR(EINVAL); 129 } 130 131 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, 132 (((cur_vblank = atomic_read(&dev->vbl_received)) 133 - *sequence) <= (1<<23))); 134 135 *sequence = cur_vblank; 136 137 return ret; 138} 139 |
|
107/* Needs the lock as it touches the ring. 108 */ 109int i915_irq_emit(DRM_IOCTL_ARGS) 110{ 111 DRM_DEVICE; 112 drm_i915_private_t *dev_priv = dev->dev_private; 113 drm_i915_irq_emit_t emit; 114 int result; --- 47 unchanged lines hidden (view full) --- 162 I915_WRITE16(I915REG_INT_MASK_R, 0x0); 163 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); 164} 165 166void i915_driver_irq_postinstall(drm_device_t * dev) 167{ 168 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 169 | 140/* Needs the lock as it touches the ring. 141 */ 142int i915_irq_emit(DRM_IOCTL_ARGS) 143{ 144 DRM_DEVICE; 145 drm_i915_private_t *dev_priv = dev->dev_private; 146 drm_i915_irq_emit_t emit; 147 int result; --- 47 unchanged lines hidden (view full) --- 195 I915_WRITE16(I915REG_INT_MASK_R, 0x0); 196 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); 197} 198 199void i915_driver_irq_postinstall(drm_device_t * dev) 200{ 201 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 202 |
170 I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG); | 203 I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | VSYNC_PIPEA_FLAG); |
171 DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); 172} 173 174void i915_driver_irq_uninstall(drm_device_t * dev) 175{ 176 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 204 DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); 205} 206 207void i915_driver_irq_uninstall(drm_device_t * dev) 208{ 209 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
210 u16 temp; |
|
177 if (!dev_priv) 178 return; 179 180 I915_WRITE16(I915REG_HWSTAM, 0xffff); 181 I915_WRITE16(I915REG_INT_MASK_R, 0xffff); 182 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); | 211 if (!dev_priv) 212 return; 213 214 I915_WRITE16(I915REG_HWSTAM, 0xffff); 215 I915_WRITE16(I915REG_INT_MASK_R, 0xffff); 216 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); |
217 218 temp = I915_READ16(I915REG_INT_IDENTITY_R); 219 I915_WRITE16(I915REG_INT_IDENTITY_R, temp); |
|
183} | 220} |