Rev 3480 | Rev 4104 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3480 | Rev 4075 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | * vblank irq in drm_handle_vblank(). 1 msec should be ok. |
57 | * vblank irq in drm_handle_vblank(). 1 msec should be ok. |
58 | */ |
58 | */ |
59 | #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 |
59 | #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 |
Line -... | Line 60... | ||
- | 60 | ||
- | 61 | ||
- | 62 | irqreturn_t device_irq_handler(struct drm_device *dev) |
|
- | 63 | { |
|
- | 64 | ||
- | 65 | printf("video irq\n"); |
|
- | 66 | ||
- | 67 | // printf("device %p driver %p handler %p\n", dev, dev->driver, dev->driver->irq_handler) ; |
|
- | 68 | ||
- | 69 | return dev->driver->irq_handler(0, dev); |
|
- | 70 | } |
|
- | 71 | ||
- | 72 | /** |
|
- | 73 | * Install IRQ handler. |
|
- | 74 | * |
|
- | 75 | * \param dev DRM device. |
|
- | 76 | * |
|
- | 77 | * Initializes the IRQ related data. Installs the handler, calling the driver |
|
- | 78 | * \c irq_preinstall() and \c irq_postinstall() functions |
|
- | 79 | * before and after the installation. |
|
- | 80 | */ |
|
- | 81 | int drm_irq_install(struct drm_device *dev) |
|
- | 82 | { |
|
- | 83 | int ret; |
|
- | 84 | unsigned long sh_flags = 0; |
|
- | 85 | char *irqname; |
|
- | 86 | ||
- | 87 | ||
- | 88 | if (drm_dev_to_irq(dev) == 0) |
|
- | 89 | return -EINVAL; |
|
- | 90 | ||
- | 91 | mutex_lock(&dev->struct_mutex); |
|
- | 92 | ||
- | 93 | /* Driver must have been initialized */ |
|
- | 94 | if (!dev->dev_private) { |
|
- | 95 | mutex_unlock(&dev->struct_mutex); |
|
- | 96 | return -EINVAL; |
|
- | 97 | } |
|
- | 98 | ||
- | 99 | if (dev->irq_enabled) { |
|
- | 100 | mutex_unlock(&dev->struct_mutex); |
|
- | 101 | return -EBUSY; |
|
- | 102 | } |
|
- | 103 | dev->irq_enabled = 1; |
|
- | 104 | mutex_unlock(&dev->struct_mutex); |
|
- | 105 | ||
- | 106 | DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev)); |
|
- | 107 | ||
- | 108 | /* Before installing handler */ |
|
- | 109 | if (dev->driver->irq_preinstall) |
|
- | 110 | dev->driver->irq_preinstall(dev); |
|
- | 111 | ||
- | 112 | ret = !AttachIntHandler(drm_dev_to_irq(dev), device_irq_handler, (u32)dev); |
|
- | 113 | ||
- | 114 | /* After installing handler */ |
|
- | 115 | if (dev->driver->irq_postinstall) |
|
- | 116 | ret = dev->driver->irq_postinstall(dev); |
|
- | 117 | ||
- | 118 | if (ret < 0) { |
|
- | 119 | DRM_ERROR(__FUNCTION__); |
|
- | 120 | } |
|
- | 121 | ||
- | 122 | u16_t cmd = PciRead16(dev->pdev->busnr, dev->pdev->devfn, 4); |
|
- | 123 | cmd&= ~(1<<10); |
|
- | 124 | PciWrite16(dev->pdev->busnr, dev->pdev->devfn, 4, cmd); |
|
- | 125 | ||
- | 126 | return ret; |
|
- | 127 | } |
|
- | 128 | EXPORT_SYMBOL(drm_irq_install); |
|
60 | 129 | ||
61 | 130 | ||
62 | static inline u64 div_u64(u64 dividend, u32 divisor) |
131 | static inline u64 div_u64(u64 dividend, u32 divisor) |
63 | { |
132 | { |
64 | u32 remainder; |
133 | u32 remainder; |
Line 80... | Line 149... | ||
80 | d = divisor; |
149 | d = divisor; |
Line 81... | Line 150... | ||
81 | 150 | ||
82 | return div_u64(dividend, d); |
151 | return div_u64(dividend, d); |
Line 83... | Line -... | ||
83 | } |
- | |
84 | 152 | } |
|
85 | 153 | ||
86 | /** |
154 | /** |
87 | * drm_calc_timestamping_constants - Calculate and |
155 | * drm_calc_timestamping_constants - Calculate and |
88 | * store various constants which are later needed by |
156 | * store various constants which are later needed by |
Line 173... | Line 241... | ||
173 | void drm_vblank_post_modeset(struct drm_device *dev, int crtc) |
241 | void drm_vblank_post_modeset(struct drm_device *dev, int crtc) |
174 | { |
242 | { |
175 | #if 0 |
243 | #if 0 |
176 | unsigned long irqflags; |
244 | unsigned long irqflags; |
Line -... | Line 245... | ||
- | 245 | ||
- | 246 | /* vblank is not initialized (IRQ not installed ?), or has been freed */ |
|
- | 247 | if (!dev->num_crtcs) |
|
- | 248 | return; |
|
177 | 249 | ||
178 | if (dev->vblank_inmodeset[crtc]) { |
250 | if (dev->vblank_inmodeset[crtc]) { |
179 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
251 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
180 | dev->vblank_disable_allowed = 1; |
252 | dev->vblank_disable_allowed = 1; |
Line 186... | Line 258... | ||
186 | dev->vblank_inmodeset[crtc] = 0; |
258 | dev->vblank_inmodeset[crtc] = 0; |
187 | } |
259 | } |
188 | #endif |
260 | #endif |
189 | } |
261 | } |
190 | EXPORT_SYMBOL(drm_vblank_post_modeset); |
262 | EXPORT_SYMBOL(drm_vblank_post_modeset);10); |
- | 263 | ><10); |
|
- | 264 | >> |
|
- | 265 | ||
- | 266 |