i915_irq.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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
  9. * "Software"), to deal in the Software without restriction, including
  10. * without limitation the rights to use, copy, modify, merge, publish,
  11. * distribute, sub license, and/or sell copies of the Software, and to
  12. * permit persons to whom the Software is furnished to do so, subject to
  13. * the following conditions:
  14. *
  15. * The above copyright notice and this permission notice (including the
  16. * next paragraph) shall be included in all copies or substantial portions
  17. * of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  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. #include "drmP.h"
  29. #include "drm.h"
  30. #include "i915_drm.h"
  31. #include "i915_drv.h"
  32. #include "intel_drv.h"
  33. #define MAX_NOPID ((u32)~0)
  34. /**
  35. * Interrupts that are always left unmasked.
  36. *
  37. * Since pipe events are edge-triggered from the PIPESTAT register to IIR,
  38. * we leave them always unmasked in IMR and then control enabling them through
  39. * PIPESTAT alone.
  40. */
  41. #define I915_INTERRUPT_ENABLE_FIX (I915_ASLE_INTERRUPT | \
  42. I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | \
  43. I915_DISPLAY_PIPE_B_EVENT_INTERRUPT)
  44. /** Interrupts that we mask and unmask at runtime. */
  45. #define I915_INTERRUPT_ENABLE_VAR (I915_USER_INTERRUPT)
  46. /** These are all of the interrupts used by the driver */
  47. #define I915_INTERRUPT_ENABLE_MASK (I915_INTERRUPT_ENABLE_FIX | \
  48. I915_INTERRUPT_ENABLE_VAR)
  49. #define I915_PIPE_VBLANK_STATUS (PIPE_START_VBLANK_INTERRUPT_STATUS |\
  50. PIPE_VBLANK_INTERRUPT_STATUS)
  51. #define I915_PIPE_VBLANK_ENABLE (PIPE_START_VBLANK_INTERRUPT_ENABLE |\
  52. PIPE_VBLANK_INTERRUPT_ENABLE)
  53. #define DRM_I915_VBLANK_PIPE_ALL (DRM_I915_VBLANK_PIPE_A | \
  54. DRM_I915_VBLANK_PIPE_B)
  55. void
  56. i915_enable_irq(drm_i915_private_t *dev_priv, u32 mask)
  57. {
  58. if ((dev_priv->irq_mask_reg & mask) != 0) {
  59. dev_priv->irq_mask_reg &= ~mask;
  60. I915_WRITE(IMR, dev_priv->irq_mask_reg);
  61. (void) I915_READ(IMR);
  62. }
  63. }
  64. static inline void
  65. i915_disable_irq(drm_i915_private_t *dev_priv, u32 mask)
  66. {
  67. if ((dev_priv->irq_mask_reg & mask) != mask) {
  68. dev_priv->irq_mask_reg |= mask;
  69. I915_WRITE(IMR, dev_priv->irq_mask_reg);
  70. (void) I915_READ(IMR);
  71. }
  72. }
  73. static inline u32
  74. i915_pipestat(int pipe)
  75. {
  76. if (pipe == 0)
  77. return PIPEASTAT;
  78. if (pipe == 1)
  79. return PIPEBSTAT;
  80. BUG();
  81. }
  82. void
  83. i915_enable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask)
  84. {
  85. if ((dev_priv->pipestat[pipe] & mask) != mask) {
  86. u32 reg = i915_pipestat(pipe);
  87. dev_priv->pipestat[pipe] |= mask;
  88. /* Enable the interrupt, clear any pending status */
  89. I915_WRITE(reg, dev_priv->pipestat[pipe] | (mask >> 16));
  90. (void) I915_READ(reg);
  91. }
  92. }
  93. void
  94. i915_disable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask)
  95. {
  96. if ((dev_priv->pipestat[pipe] & mask) != 0) {
  97. u32 reg = i915_pipestat(pipe);
  98. dev_priv->pipestat[pipe] &= ~mask;
  99. I915_WRITE(reg, dev_priv->pipestat[pipe]);
  100. (void) I915_READ(reg);
  101. }
  102. }
  103. /**
  104. * i915_pipe_enabled - check if a pipe is enabled
  105. * @dev: DRM device
  106. * @pipe: pipe to check
  107. *
  108. * Reading certain registers when the pipe is disabled can hang the chip.
  109. * Use this routine to make sure the PLL is running and the pipe is active
  110. * before reading such registers if unsure.
  111. */
  112. static int
  113. i915_pipe_enabled(struct drm_device *dev, int pipe)
  114. {
  115. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  116. unsigned long pipeconf = pipe ? PIPEBCONF : PIPEACONF;
  117. if (I915_READ(pipeconf) & PIPEACONF_ENABLE)
  118. return 1;
  119. return 0;
  120. }
  121. /* Called from drm generic code, passed a 'crtc', which
  122. * we use as a pipe index
  123. */
  124. u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
  125. {
  126. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  127. unsigned long high_frame;
  128. unsigned long low_frame;
  129. u32 high1, high2, low, count;
  130. high_frame = pipe ? PIPEBFRAMEHIGH : PIPEAFRAMEHIGH;
  131. low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL;
  132. if (!i915_pipe_enabled(dev, pipe)) {
  133. DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe);
  134. return 0;
  135. }
  136. /*
  137. * High & low register fields aren't synchronized, so make sure
  138. * we get a low value that's stable across two reads of the high
  139. * register.
  140. */
  141. do {
  142. high1 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >>
  143. PIPE_FRAME_HIGH_SHIFT);
  144. low = ((I915_READ(low_frame) & PIPE_FRAME_LOW_MASK) >>
  145. PIPE_FRAME_LOW_SHIFT);
  146. high2 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >>
  147. PIPE_FRAME_HIGH_SHIFT);
  148. } while (high1 != high2);
  149. count = (high1 << 8) | low;
  150. return count;
  151. }
  152. u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
  153. {
  154. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  155. int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45;
  156. if (!i915_pipe_enabled(dev, pipe)) {
  157. DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe);
  158. return 0;
  159. }
  160. return I915_READ(reg);
  161. }
  162. irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
  163. {
  164. struct drm_device *dev = (struct drm_device *) arg;
  165. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  166. struct drm_i915_master_private *master_priv;
  167. u32 iir, new_iir;
  168. u32 pipea_stats, pipeb_stats;
  169. u32 vblank_status;
  170. u32 vblank_enable;
  171. int vblank = 0;
  172. unsigned long irqflags;
  173. int irq_received;
  174. int ret = IRQ_NONE;
  175. atomic_inc(&dev_priv->irq_received);
  176. iir = I915_READ(IIR);
  177. if (IS_I965G(dev)) {
  178. vblank_status = I915_START_VBLANK_INTERRUPT_STATUS;
  179. vblank_enable = PIPE_START_VBLANK_INTERRUPT_ENABLE;
  180. } else {
  181. vblank_status = I915_VBLANK_INTERRUPT_STATUS;
  182. vblank_enable = I915_VBLANK_INTERRUPT_ENABLE;
  183. }
  184. for (;;) {
  185. irq_received = iir != 0;
  186. /* Can't rely on pipestat interrupt bit in iir as it might
  187. * have been cleared after the pipestat interrupt was received.
  188. * It doesn't set the bit in iir again, but it still produces
  189. * interrupts (for non-MSI).
  190. */
  191. spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
  192. pipea_stats = I915_READ(PIPEASTAT);
  193. pipeb_stats = I915_READ(PIPEBSTAT);
  194. /*
  195. * Clear the PIPE(A|B)STAT regs before the IIR
  196. */
  197. if (pipea_stats & 0x8000ffff) {
  198. I915_WRITE(PIPEASTAT, pipea_stats);
  199. irq_received = 1;
  200. }
  201. if (pipeb_stats & 0x8000ffff) {
  202. I915_WRITE(PIPEBSTAT, pipeb_stats);
  203. irq_received = 1;
  204. }
  205. spin_unlock_irqrestore(&dev_priv->user_irq_lock, irqflags);
  206. if (!irq_received)
  207. break;
  208. ret = IRQ_HANDLED;
  209. I915_WRITE(IIR, iir);
  210. new_iir = I915_READ(IIR); /* Flush posted writes */
  211. if (dev->primary->master) {
  212. master_priv = dev->primary->master->driver_priv;
  213. if (master_priv->sarea_priv)
  214. master_priv->sarea_priv->last_dispatch =
  215. READ_BREADCRUMB(dev_priv);
  216. }
  217. if (iir & I915_USER_INTERRUPT) {
  218. dev_priv->mm.irq_gem_seqno = i915_get_gem_seqno(dev);
  219. DRM_WAKEUP(&dev_priv->irq_queue);
  220. }
  221. if (pipea_stats & vblank_status) {
  222. vblank++;
  223. drm_handle_vblank(dev, 0);
  224. }
  225. if (pipeb_stats & vblank_status) {
  226. vblank++;
  227. drm_handle_vblank(dev, 1);
  228. }
  229. if ((pipeb_stats & I915_LEGACY_BLC_EVENT_STATUS) ||
  230. (iir & I915_ASLE_INTERRUPT))
  231. opregion_asle_intr(dev);
  232. /* With MSI, interrupts are only generated when iir
  233. * transitions from zero to nonzero. If another bit got
  234. * set while we were handling the existing iir bits, then
  235. * we would never get another interrupt.
  236. *
  237. * This is fine on non-MSI as well, as if we hit this path
  238. * we avoid exiting the interrupt handler only to generate
  239. * another one.
  240. *
  241. * Note that for MSI this could cause a stray interrupt report
  242. * if an interrupt landed in the time between writing IIR and
  243. * the posting read. This should be rare enough to never
  244. * trigger the 99% of 100,000 interrupts test for disabling
  245. * stray interrupts.
  246. */
  247. iir = new_iir;
  248. }
  249. return ret;
  250. }
  251. static int i915_emit_irq(struct drm_device * dev)
  252. {
  253. drm_i915_private_t *dev_priv = dev->dev_private;
  254. struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
  255. RING_LOCALS;
  256. i915_kernel_lost_context(dev);
  257. DRM_DEBUG("\n");
  258. dev_priv->counter++;
  259. if (dev_priv->counter > 0x7FFFFFFFUL)
  260. dev_priv->counter = 1;
  261. if (master_priv->sarea_priv)
  262. master_priv->sarea_priv->last_enqueue = dev_priv->counter;
  263. BEGIN_LP_RING(4);
  264. OUT_RING(MI_STORE_DWORD_INDEX);
  265. OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
  266. OUT_RING(dev_priv->counter);
  267. OUT_RING(MI_USER_INTERRUPT);
  268. ADVANCE_LP_RING();
  269. return dev_priv->counter;
  270. }
  271. void i915_user_irq_get(struct drm_device *dev)
  272. {
  273. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  274. unsigned long irqflags;
  275. spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
  276. if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1))
  277. i915_enable_irq(dev_priv, I915_USER_INTERRUPT);
  278. spin_unlock_irqrestore(&dev_priv->user_irq_lock, irqflags);
  279. }
  280. void i915_user_irq_put(struct drm_device *dev)
  281. {
  282. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  283. unsigned long irqflags;
  284. spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
  285. BUG_ON(dev->irq_enabled && dev_priv->user_irq_refcount <= 0);
  286. if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0))
  287. i915_disable_irq(dev_priv, I915_USER_INTERRUPT);
  288. spin_unlock_irqrestore(&dev_priv->user_irq_lock, irqflags);
  289. }
  290. static int i915_wait_irq(struct drm_device * dev, int irq_nr)
  291. {
  292. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  293. struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
  294. int ret = 0;
  295. DRM_DEBUG("irq_nr=%d breadcrumb=%d\n", irq_nr,
  296. READ_BREADCRUMB(dev_priv));
  297. if (READ_BREADCRUMB(dev_priv) >= irq_nr) {
  298. if (master_priv->sarea_priv)
  299. master_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
  300. return 0;
  301. }
  302. if (master_priv->sarea_priv)
  303. master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
  304. i915_user_irq_get(dev);
  305. DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ,
  306. READ_BREADCRUMB(dev_priv) >= irq_nr);
  307. i915_user_irq_put(dev);
  308. if (ret == -EBUSY) {
  309. DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
  310. READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
  311. }
  312. return ret;
  313. }
  314. /* Needs the lock as it touches the ring.
  315. */
  316. int i915_irq_emit(struct drm_device *dev, void *data,
  317. struct drm_file *file_priv)
  318. {
  319. drm_i915_private_t *dev_priv = dev->dev_private;
  320. drm_i915_irq_emit_t *emit = data;
  321. int result;
  322. RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
  323. if (!dev_priv) {
  324. DRM_ERROR("called with no initialization\n");
  325. return -EINVAL;
  326. }
  327. mutex_lock(&dev->struct_mutex);
  328. result = i915_emit_irq(dev);
  329. mutex_unlock(&dev->struct_mutex);
  330. if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {
  331. DRM_ERROR("copy_to_user\n");
  332. return -EFAULT;
  333. }
  334. return 0;
  335. }
  336. /* Doesn't need the hardware lock.
  337. */
  338. int i915_irq_wait(struct drm_device *dev, void *data,
  339. struct drm_file *file_priv)
  340. {
  341. drm_i915_private_t *dev_priv = dev->dev_private;
  342. drm_i915_irq_wait_t *irqwait = data;
  343. if (!dev_priv) {
  344. DRM_ERROR("called with no initialization\n");
  345. return -EINVAL;
  346. }
  347. return i915_wait_irq(dev, irqwait->irq_seq);
  348. }
  349. /* Called from drm generic code, passed 'crtc' which
  350. * we use as a pipe index
  351. */
  352. int i915_enable_vblank(struct drm_device *dev, int pipe)
  353. {
  354. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  355. unsigned long irqflags;
  356. int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
  357. u32 pipeconf;
  358. pipeconf = I915_READ(pipeconf_reg);
  359. if (!(pipeconf & PIPEACONF_ENABLE))
  360. return -EINVAL;
  361. spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
  362. if (IS_I965G(dev))
  363. i915_enable_pipestat(dev_priv, pipe,
  364. PIPE_START_VBLANK_INTERRUPT_ENABLE);
  365. else
  366. i915_enable_pipestat(dev_priv, pipe,
  367. PIPE_VBLANK_INTERRUPT_ENABLE);
  368. spin_unlock_irqrestore(&dev_priv->user_irq_lock, irqflags);
  369. return 0;
  370. }
  371. /* Called from drm generic code, passed 'crtc' which
  372. * we use as a pipe index
  373. */
  374. void i915_disable_vblank(struct drm_device *dev, int pipe)
  375. {
  376. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  377. unsigned long irqflags;
  378. spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
  379. i915_disable_pipestat(dev_priv, pipe,
  380. PIPE_VBLANK_INTERRUPT_ENABLE |
  381. PIPE_START_VBLANK_INTERRUPT_ENABLE);
  382. spin_unlock_irqrestore(&dev_priv->user_irq_lock, irqflags);
  383. }
  384. void i915_enable_interrupt (struct drm_device *dev)
  385. {
  386. struct drm_i915_private *dev_priv = dev->dev_private;
  387. opregion_enable_asle(dev);
  388. dev_priv->irq_enabled = 1;
  389. }
  390. /* Set the vblank monitor pipe
  391. */
  392. int i915_vblank_pipe_set(struct drm_device *dev, void *data,
  393. struct drm_file *file_priv)
  394. {
  395. drm_i915_private_t *dev_priv = dev->dev_private;
  396. if (!dev_priv) {
  397. DRM_ERROR("called with no initialization\n");
  398. return -EINVAL;
  399. }
  400. return 0;
  401. }
  402. int i915_vblank_pipe_get(struct drm_device *dev, void *data,
  403. struct drm_file *file_priv)
  404. {
  405. drm_i915_private_t *dev_priv = dev->dev_private;
  406. drm_i915_vblank_pipe_t *pipe = data;
  407. if (!dev_priv) {
  408. DRM_ERROR("called with no initialization\n");
  409. return -EINVAL;
  410. }
  411. pipe->pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B;
  412. return 0;
  413. }
  414. /**
  415. * Schedule buffer swap at given vertical blank.
  416. */
  417. int i915_vblank_swap(struct drm_device *dev, void *data,
  418. struct drm_file *file_priv)
  419. {
  420. /* The delayed swap mechanism was fundamentally racy, and has been
  421. * removed. The model was that the client requested a delayed flip/swap
  422. * from the kernel, then waited for vblank before continuing to perform
  423. * rendering. The problem was that the kernel might wake the client
  424. * up before it dispatched the vblank swap (since the lock has to be
  425. * held while touching the ringbuffer), in which case the client would
  426. * clear and start the next frame before the swap occurred, and
  427. * flicker would occur in addition to likely missing the vblank.
  428. *
  429. * In the absence of this ioctl, userland falls back to a correct path
  430. * of waiting for a vblank, then dispatching the swap on its own.
  431. * Context switching to userland and back is plenty fast enough for
  432. * meeting the requirements of vblank swapping.
  433. */
  434. return -EINVAL;
  435. }
  436. /* drm_dma.h hooks
  437. */
  438. void i915_driver_irq_preinstall(struct drm_device * dev)
  439. {
  440. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  441. atomic_set(&dev_priv->irq_received, 0);
  442. I915_WRITE(HWSTAM, 0xeffe);
  443. I915_WRITE(PIPEASTAT, 0);
  444. I915_WRITE(PIPEBSTAT, 0);
  445. I915_WRITE(IMR, 0xffffffff);
  446. I915_WRITE(IER, 0x0);
  447. (void) I915_READ(IER);
  448. }
  449. int i915_driver_irq_postinstall(struct drm_device *dev)
  450. {
  451. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  452. dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B;
  453. dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
  454. /* Unmask the interrupts that we always want on. */
  455. dev_priv->irq_mask_reg = ~I915_INTERRUPT_ENABLE_FIX;
  456. dev_priv->pipestat[0] = 0;
  457. dev_priv->pipestat[1] = 0;
  458. /* Disable pipe interrupt enables, clear pending pipe status */
  459. I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff);
  460. I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff);
  461. /* Clear pending interrupt status */
  462. I915_WRITE(IIR, I915_READ(IIR));
  463. I915_WRITE(IER, I915_INTERRUPT_ENABLE_MASK);
  464. I915_WRITE(IMR, dev_priv->irq_mask_reg);
  465. (void) I915_READ(IER);
  466. opregion_enable_asle(dev);
  467. DRM_INIT_WAITQUEUE(&dev_priv->irq_queue);
  468. return 0;
  469. }
  470. void i915_driver_irq_uninstall(struct drm_device * dev)
  471. {
  472. drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
  473. if (!dev_priv)
  474. return;
  475. dev_priv->vblank_pipe = 0;
  476. I915_WRITE(HWSTAM, 0xffffffff);
  477. I915_WRITE(PIPEASTAT, 0);
  478. I915_WRITE(PIPEBSTAT, 0);
  479. I915_WRITE(IMR, 0xffffffff);
  480. I915_WRITE(IER, 0x0);
  481. I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff);
  482. I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff);
  483. I915_WRITE(IIR, I915_READ(IIR));
  484. }