nv50_display.c 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. /*
  2. * Copyright (C) 2008 Maarten Maathuis.
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the
  14. * next paragraph) shall be included in all copies or substantial
  15. * portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
  21. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. */
  26. #define NOUVEAU_DMA_DEBUG (nouveau_reg_debug & NOUVEAU_REG_DEBUG_EVO)
  27. #include "nv50_display.h"
  28. #include "nouveau_crtc.h"
  29. #include "nouveau_encoder.h"
  30. #include "nouveau_connector.h"
  31. #include "nouveau_fb.h"
  32. #include "nouveau_fbcon.h"
  33. #include "nouveau_ramht.h"
  34. #include "nouveau_software.h"
  35. #include "drm_crtc_helper.h"
  36. static void nv50_display_isr(struct drm_device *);
  37. static void nv50_display_bh(unsigned long);
  38. static inline int
  39. nv50_sor_nr(struct drm_device *dev)
  40. {
  41. struct drm_nouveau_private *dev_priv = dev->dev_private;
  42. if (dev_priv->chipset < 0x90 ||
  43. dev_priv->chipset == 0x92 ||
  44. dev_priv->chipset == 0xa0)
  45. return 2;
  46. return 4;
  47. }
  48. u32
  49. nv50_display_active_crtcs(struct drm_device *dev)
  50. {
  51. struct drm_nouveau_private *dev_priv = dev->dev_private;
  52. u32 mask = 0;
  53. int i;
  54. if (dev_priv->chipset < 0x90 ||
  55. dev_priv->chipset == 0x92 ||
  56. dev_priv->chipset == 0xa0) {
  57. for (i = 0; i < 2; i++)
  58. mask |= nv_rd32(dev, NV50_PDISPLAY_SOR_MODE_CTRL_C(i));
  59. } else {
  60. for (i = 0; i < 4; i++)
  61. mask |= nv_rd32(dev, NV90_PDISPLAY_SOR_MODE_CTRL_C(i));
  62. }
  63. for (i = 0; i < 3; i++)
  64. mask |= nv_rd32(dev, NV50_PDISPLAY_DAC_MODE_CTRL_C(i));
  65. return mask & 3;
  66. }
  67. static int
  68. evo_icmd(struct drm_device *dev, int ch, u32 mthd, u32 data)
  69. {
  70. int ret = 0;
  71. nv_mask(dev, 0x610300 + (ch * 0x08), 0x00000001, 0x00000001);
  72. nv_wr32(dev, 0x610304 + (ch * 0x08), data);
  73. nv_wr32(dev, 0x610300 + (ch * 0x08), 0x80000001 | mthd);
  74. if (!nv_wait(dev, 0x610300 + (ch * 0x08), 0x80000000, 0x00000000))
  75. ret = -EBUSY;
  76. if (ret || (nouveau_reg_debug & NOUVEAU_REG_DEBUG_EVO))
  77. NV_INFO(dev, "EvoPIO: %d 0x%04x 0x%08x\n", ch, mthd, data);
  78. nv_mask(dev, 0x610300 + (ch * 0x08), 0x00000001, 0x00000000);
  79. return ret;
  80. }
  81. int
  82. nv50_display_early_init(struct drm_device *dev)
  83. {
  84. u32 ctrl = nv_rd32(dev, 0x610200);
  85. int i;
  86. /* check if master evo channel is already active, a good a sign as any
  87. * that the display engine is in a weird state (hibernate/kexec), if
  88. * it is, do our best to reset the display engine...
  89. */
  90. if ((ctrl & 0x00000003) == 0x00000003) {
  91. NV_INFO(dev, "PDISP: EVO(0) 0x%08x, resetting...\n", ctrl);
  92. /* deactivate both heads first, PDISP will disappear forever
  93. * (well, until you power cycle) on some boards as soon as
  94. * PMC_ENABLE is hit unless they are..
  95. */
  96. for (i = 0; i < 2; i++) {
  97. evo_icmd(dev, 0, 0x0880 + (i * 0x400), 0x05000000);
  98. evo_icmd(dev, 0, 0x089c + (i * 0x400), 0);
  99. evo_icmd(dev, 0, 0x0840 + (i * 0x400), 0);
  100. evo_icmd(dev, 0, 0x0844 + (i * 0x400), 0);
  101. evo_icmd(dev, 0, 0x085c + (i * 0x400), 0);
  102. evo_icmd(dev, 0, 0x0874 + (i * 0x400), 0);
  103. }
  104. evo_icmd(dev, 0, 0x0080, 0);
  105. /* reset PDISP */
  106. nv_mask(dev, 0x000200, 0x40000000, 0x00000000);
  107. nv_mask(dev, 0x000200, 0x40000000, 0x40000000);
  108. }
  109. return 0;
  110. }
  111. void
  112. nv50_display_late_takedown(struct drm_device *dev)
  113. {
  114. }
  115. int
  116. nv50_display_sync(struct drm_device *dev)
  117. {
  118. struct drm_nouveau_private *dev_priv = dev->dev_private;
  119. struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer;
  120. struct nv50_display *disp = nv50_display(dev);
  121. struct nouveau_channel *evo = disp->master;
  122. u64 start;
  123. int ret;
  124. ret = RING_SPACE(evo, 6);
  125. if (ret == 0) {
  126. BEGIN_NV04(evo, 0, 0x0084, 1);
  127. OUT_RING (evo, 0x80000000);
  128. BEGIN_NV04(evo, 0, 0x0080, 1);
  129. OUT_RING (evo, 0);
  130. BEGIN_NV04(evo, 0, 0x0084, 1);
  131. OUT_RING (evo, 0x00000000);
  132. nv_wo32(disp->ntfy, 0x000, 0x00000000);
  133. FIRE_RING (evo);
  134. start = ptimer->read(dev);
  135. do {
  136. if (nv_ro32(disp->ntfy, 0x000))
  137. return 0;
  138. } while (ptimer->read(dev) - start < 2000000000ULL);
  139. }
  140. return -EBUSY;
  141. }
  142. int
  143. nv50_display_init(struct drm_device *dev)
  144. {
  145. struct nouveau_channel *evo;
  146. int ret, i;
  147. u32 val;
  148. NV_DEBUG_KMS(dev, "\n");
  149. nv_wr32(dev, 0x00610184, nv_rd32(dev, 0x00614004));
  150. /*
  151. * I think the 0x006101XX range is some kind of main control area
  152. * that enables things.
  153. */
  154. /* CRTC? */
  155. for (i = 0; i < 2; i++) {
  156. val = nv_rd32(dev, 0x00616100 + (i * 0x800));
  157. nv_wr32(dev, 0x00610190 + (i * 0x10), val);
  158. val = nv_rd32(dev, 0x00616104 + (i * 0x800));
  159. nv_wr32(dev, 0x00610194 + (i * 0x10), val);
  160. val = nv_rd32(dev, 0x00616108 + (i * 0x800));
  161. nv_wr32(dev, 0x00610198 + (i * 0x10), val);
  162. val = nv_rd32(dev, 0x0061610c + (i * 0x800));
  163. nv_wr32(dev, 0x0061019c + (i * 0x10), val);
  164. }
  165. /* DAC */
  166. for (i = 0; i < 3; i++) {
  167. val = nv_rd32(dev, 0x0061a000 + (i * 0x800));
  168. nv_wr32(dev, 0x006101d0 + (i * 0x04), val);
  169. }
  170. /* SOR */
  171. for (i = 0; i < nv50_sor_nr(dev); i++) {
  172. val = nv_rd32(dev, 0x0061c000 + (i * 0x800));
  173. nv_wr32(dev, 0x006101e0 + (i * 0x04), val);
  174. }
  175. /* EXT */
  176. for (i = 0; i < 3; i++) {
  177. val = nv_rd32(dev, 0x0061e000 + (i * 0x800));
  178. nv_wr32(dev, 0x006101f0 + (i * 0x04), val);
  179. }
  180. for (i = 0; i < 3; i++) {
  181. nv_wr32(dev, NV50_PDISPLAY_DAC_DPMS_CTRL(i), 0x00550000 |
  182. NV50_PDISPLAY_DAC_DPMS_CTRL_PENDING);
  183. nv_wr32(dev, NV50_PDISPLAY_DAC_CLK_CTRL1(i), 0x00000001);
  184. }
  185. /* The precise purpose is unknown, i suspect it has something to do
  186. * with text mode.
  187. */
  188. if (nv_rd32(dev, NV50_PDISPLAY_INTR_1) & 0x100) {
  189. nv_wr32(dev, NV50_PDISPLAY_INTR_1, 0x100);
  190. nv_wr32(dev, 0x006194e8, nv_rd32(dev, 0x006194e8) & ~1);
  191. if (!nv_wait(dev, 0x006194e8, 2, 0)) {
  192. NV_ERROR(dev, "timeout: (0x6194e8 & 2) != 0\n");
  193. NV_ERROR(dev, "0x6194e8 = 0x%08x\n",
  194. nv_rd32(dev, 0x6194e8));
  195. return -EBUSY;
  196. }
  197. }
  198. for (i = 0; i < 2; i++) {
  199. nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i), 0x2000);
  200. if (!nv_wait(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i),
  201. NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS, 0)) {
  202. NV_ERROR(dev, "timeout: CURSOR_CTRL2_STATUS == 0\n");
  203. NV_ERROR(dev, "CURSOR_CTRL2 = 0x%08x\n",
  204. nv_rd32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i)));
  205. return -EBUSY;
  206. }
  207. nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i),
  208. NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_ON);
  209. if (!nv_wait(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i),
  210. NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS,
  211. NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS_ACTIVE)) {
  212. NV_ERROR(dev, "timeout: "
  213. "CURSOR_CTRL2_STATUS_ACTIVE(%d)\n", i);
  214. NV_ERROR(dev, "CURSOR_CTRL2(%d) = 0x%08x\n", i,
  215. nv_rd32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i)));
  216. return -EBUSY;
  217. }
  218. }
  219. nv_wr32(dev, NV50_PDISPLAY_PIO_CTRL, 0x00000000);
  220. nv_mask(dev, NV50_PDISPLAY_INTR_0, 0x00000000, 0x00000000);
  221. nv_wr32(dev, NV50_PDISPLAY_INTR_EN_0, 0x00000000);
  222. nv_mask(dev, NV50_PDISPLAY_INTR_1, 0x00000000, 0x00000000);
  223. nv_wr32(dev, NV50_PDISPLAY_INTR_EN_1,
  224. NV50_PDISPLAY_INTR_EN_1_CLK_UNK10 |
  225. NV50_PDISPLAY_INTR_EN_1_CLK_UNK20 |
  226. NV50_PDISPLAY_INTR_EN_1_CLK_UNK40);
  227. ret = nv50_evo_init(dev);
  228. if (ret)
  229. return ret;
  230. evo = nv50_display(dev)->master;
  231. nv_wr32(dev, NV50_PDISPLAY_OBJECTS, (evo->ramin->vinst >> 8) | 9);
  232. ret = RING_SPACE(evo, 3);
  233. if (ret)
  234. return ret;
  235. BEGIN_NV04(evo, 0, NV50_EVO_UNK84, 2);
  236. OUT_RING (evo, NV50_EVO_UNK84_NOTIFY_DISABLED);
  237. OUT_RING (evo, NvEvoSync);
  238. return nv50_display_sync(dev);
  239. }
  240. void
  241. nv50_display_fini(struct drm_device *dev)
  242. {
  243. struct nv50_display *disp = nv50_display(dev);
  244. struct nouveau_channel *evo = disp->master;
  245. struct drm_crtc *drm_crtc;
  246. int ret, i;
  247. NV_DEBUG_KMS(dev, "\n");
  248. list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) {
  249. struct nouveau_crtc *crtc = nouveau_crtc(drm_crtc);
  250. nv50_crtc_blank(crtc, true);
  251. }
  252. ret = RING_SPACE(evo, 2);
  253. if (ret == 0) {
  254. BEGIN_NV04(evo, 0, NV50_EVO_UPDATE, 1);
  255. OUT_RING(evo, 0);
  256. }
  257. FIRE_RING(evo);
  258. /* Almost like ack'ing a vblank interrupt, maybe in the spirit of
  259. * cleaning up?
  260. */
  261. list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) {
  262. struct nouveau_crtc *crtc = nouveau_crtc(drm_crtc);
  263. uint32_t mask = NV50_PDISPLAY_INTR_1_VBLANK_CRTC_(crtc->index);
  264. if (!crtc->base.enabled)
  265. continue;
  266. nv_wr32(dev, NV50_PDISPLAY_INTR_1, mask);
  267. if (!nv_wait(dev, NV50_PDISPLAY_INTR_1, mask, mask)) {
  268. NV_ERROR(dev, "timeout: (0x610024 & 0x%08x) == "
  269. "0x%08x\n", mask, mask);
  270. NV_ERROR(dev, "0x610024 = 0x%08x\n",
  271. nv_rd32(dev, NV50_PDISPLAY_INTR_1));
  272. }
  273. }
  274. for (i = 0; i < 2; i++) {
  275. nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i), 0);
  276. if (!nv_wait(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i),
  277. NV50_PDISPLAY_CURSOR_CURSOR_CTRL2_STATUS, 0)) {
  278. NV_ERROR(dev, "timeout: CURSOR_CTRL2_STATUS == 0\n");
  279. NV_ERROR(dev, "CURSOR_CTRL2 = 0x%08x\n",
  280. nv_rd32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(i)));
  281. }
  282. }
  283. nv50_evo_fini(dev);
  284. for (i = 0; i < 3; i++) {
  285. if (!nv_wait(dev, NV50_PDISPLAY_SOR_DPMS_STATE(i),
  286. NV50_PDISPLAY_SOR_DPMS_STATE_WAIT, 0)) {
  287. NV_ERROR(dev, "timeout: SOR_DPMS_STATE_WAIT(%d) == 0\n", i);
  288. NV_ERROR(dev, "SOR_DPMS_STATE(%d) = 0x%08x\n", i,
  289. nv_rd32(dev, NV50_PDISPLAY_SOR_DPMS_STATE(i)));
  290. }
  291. }
  292. /* disable interrupts. */
  293. nv_wr32(dev, NV50_PDISPLAY_INTR_EN_1, 0x00000000);
  294. }
  295. int
  296. nv50_display_create(struct drm_device *dev)
  297. {
  298. struct drm_nouveau_private *dev_priv = dev->dev_private;
  299. struct dcb_table *dcb = &dev_priv->vbios.dcb;
  300. struct drm_connector *connector, *ct;
  301. struct nv50_display *priv;
  302. int ret, i;
  303. NV_DEBUG_KMS(dev, "\n");
  304. priv = kzalloc(sizeof(*priv), GFP_KERNEL);
  305. if (!priv)
  306. return -ENOMEM;
  307. dev_priv->engine.display.priv = priv;
  308. /* Create CRTC objects */
  309. for (i = 0; i < 2; i++) {
  310. ret = nv50_crtc_create(dev, i);
  311. if (ret)
  312. return ret;
  313. }
  314. /* We setup the encoders from the BIOS table */
  315. for (i = 0 ; i < dcb->entries; i++) {
  316. struct dcb_entry *entry = &dcb->entry[i];
  317. if (entry->location != DCB_LOC_ON_CHIP) {
  318. NV_WARN(dev, "Off-chip encoder %d/%d unsupported\n",
  319. entry->type, ffs(entry->or) - 1);
  320. continue;
  321. }
  322. connector = nouveau_connector_create(dev, entry->connector);
  323. if (IS_ERR(connector))
  324. continue;
  325. switch (entry->type) {
  326. case OUTPUT_TMDS:
  327. case OUTPUT_LVDS:
  328. case OUTPUT_DP:
  329. nv50_sor_create(connector, entry);
  330. break;
  331. case OUTPUT_ANALOG:
  332. nv50_dac_create(connector, entry);
  333. break;
  334. default:
  335. NV_WARN(dev, "DCB encoder %d unknown\n", entry->type);
  336. continue;
  337. }
  338. }
  339. list_for_each_entry_safe(connector, ct,
  340. &dev->mode_config.connector_list, head) {
  341. if (!connector->encoder_ids[0]) {
  342. NV_WARN(dev, "%s has no encoders, removing\n",
  343. drm_get_connector_name(connector));
  344. connector->funcs->destroy(connector);
  345. }
  346. }
  347. tasklet_init(&priv->tasklet, nv50_display_bh, (unsigned long)dev);
  348. nouveau_irq_register(dev, 26, nv50_display_isr);
  349. ret = nv50_evo_create(dev);
  350. if (ret) {
  351. nv50_display_destroy(dev);
  352. return ret;
  353. }
  354. return 0;
  355. }
  356. void
  357. nv50_display_destroy(struct drm_device *dev)
  358. {
  359. struct nv50_display *disp = nv50_display(dev);
  360. NV_DEBUG_KMS(dev, "\n");
  361. nv50_evo_destroy(dev);
  362. nouveau_irq_unregister(dev, 26);
  363. kfree(disp);
  364. }
  365. void
  366. nv50_display_flip_stop(struct drm_crtc *crtc)
  367. {
  368. struct nv50_display *disp = nv50_display(crtc->dev);
  369. struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
  370. struct nv50_display_crtc *dispc = &disp->crtc[nv_crtc->index];
  371. struct nouveau_channel *evo = dispc->sync;
  372. int ret;
  373. ret = RING_SPACE(evo, 8);
  374. if (ret) {
  375. WARN_ON(1);
  376. return;
  377. }
  378. BEGIN_NV04(evo, 0, 0x0084, 1);
  379. OUT_RING (evo, 0x00000000);
  380. BEGIN_NV04(evo, 0, 0x0094, 1);
  381. OUT_RING (evo, 0x00000000);
  382. BEGIN_NV04(evo, 0, 0x00c0, 1);
  383. OUT_RING (evo, 0x00000000);
  384. BEGIN_NV04(evo, 0, 0x0080, 1);
  385. OUT_RING (evo, 0x00000000);
  386. FIRE_RING (evo);
  387. }
  388. int
  389. nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
  390. struct nouveau_channel *chan)
  391. {
  392. struct drm_nouveau_private *dev_priv = crtc->dev->dev_private;
  393. struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
  394. struct nv50_display *disp = nv50_display(crtc->dev);
  395. struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
  396. struct nv50_display_crtc *dispc = &disp->crtc[nv_crtc->index];
  397. struct nouveau_channel *evo = dispc->sync;
  398. int ret;
  399. ret = RING_SPACE(evo, chan ? 25 : 27);
  400. if (unlikely(ret))
  401. return ret;
  402. /* synchronise with the rendering channel, if necessary */
  403. if (likely(chan)) {
  404. ret = RING_SPACE(chan, 10);
  405. if (ret) {
  406. WIND_RING(evo);
  407. return ret;
  408. }
  409. if (dev_priv->chipset < 0xc0) {
  410. BEGIN_NV04(chan, 0, 0x0060, 2);
  411. OUT_RING (chan, NvEvoSema0 + nv_crtc->index);
  412. OUT_RING (chan, dispc->sem.offset);
  413. BEGIN_NV04(chan, 0, 0x006c, 1);
  414. OUT_RING (chan, 0xf00d0000 | dispc->sem.value);
  415. BEGIN_NV04(chan, 0, 0x0064, 2);
  416. OUT_RING (chan, dispc->sem.offset ^ 0x10);
  417. OUT_RING (chan, 0x74b1e000);
  418. BEGIN_NV04(chan, 0, 0x0060, 1);
  419. if (dev_priv->chipset < 0x84)
  420. OUT_RING (chan, NvSema);
  421. else
  422. OUT_RING (chan, chan->vram_handle);
  423. } else {
  424. u64 offset = nvc0_software_crtc(chan, nv_crtc->index);
  425. offset += dispc->sem.offset;
  426. BEGIN_NVC0(chan, 0, 0x0010, 4);
  427. OUT_RING (chan, upper_32_bits(offset));
  428. OUT_RING (chan, lower_32_bits(offset));
  429. OUT_RING (chan, 0xf00d0000 | dispc->sem.value);
  430. OUT_RING (chan, 0x1002);
  431. BEGIN_NVC0(chan, 0, 0x0010, 4);
  432. OUT_RING (chan, upper_32_bits(offset));
  433. OUT_RING (chan, lower_32_bits(offset ^ 0x10));
  434. OUT_RING (chan, 0x74b1e000);
  435. OUT_RING (chan, 0x1001);
  436. }
  437. FIRE_RING (chan);
  438. } else {
  439. nouveau_bo_wr32(dispc->sem.bo, dispc->sem.offset / 4,
  440. 0xf00d0000 | dispc->sem.value);
  441. }
  442. /* queue the flip on the crtc's "display sync" channel */
  443. BEGIN_NV04(evo, 0, 0x0100, 1);
  444. OUT_RING (evo, 0xfffe0000);
  445. if (chan) {
  446. BEGIN_NV04(evo, 0, 0x0084, 1);
  447. OUT_RING (evo, 0x00000100);
  448. } else {
  449. BEGIN_NV04(evo, 0, 0x0084, 1);
  450. OUT_RING (evo, 0x00000010);
  451. /* allows gamma somehow, PDISP will bitch at you if
  452. * you don't wait for vblank before changing this..
  453. */
  454. BEGIN_NV04(evo, 0, 0x00e0, 1);
  455. OUT_RING (evo, 0x40000000);
  456. }
  457. BEGIN_NV04(evo, 0, 0x0088, 4);
  458. OUT_RING (evo, dispc->sem.offset);
  459. OUT_RING (evo, 0xf00d0000 | dispc->sem.value);
  460. OUT_RING (evo, 0x74b1e000);
  461. OUT_RING (evo, NvEvoSync);
  462. BEGIN_NV04(evo, 0, 0x00a0, 2);
  463. OUT_RING (evo, 0x00000000);
  464. OUT_RING (evo, 0x00000000);
  465. BEGIN_NV04(evo, 0, 0x00c0, 1);
  466. OUT_RING (evo, nv_fb->r_dma);
  467. BEGIN_NV04(evo, 0, 0x0110, 2);
  468. OUT_RING (evo, 0x00000000);
  469. OUT_RING (evo, 0x00000000);
  470. BEGIN_NV04(evo, 0, 0x0800, 5);
  471. OUT_RING (evo, nv_fb->nvbo->bo.offset >> 8);
  472. OUT_RING (evo, 0);
  473. OUT_RING (evo, (fb->height << 16) | fb->width);
  474. OUT_RING (evo, nv_fb->r_pitch);
  475. OUT_RING (evo, nv_fb->r_format);
  476. BEGIN_NV04(evo, 0, 0x0080, 1);
  477. OUT_RING (evo, 0x00000000);
  478. FIRE_RING (evo);
  479. dispc->sem.offset ^= 0x10;
  480. dispc->sem.value++;
  481. return 0;
  482. }
  483. static u16
  484. nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcb,
  485. u32 mc, int pxclk)
  486. {
  487. struct drm_nouveau_private *dev_priv = dev->dev_private;
  488. struct nouveau_connector *nv_connector = NULL;
  489. struct drm_encoder *encoder;
  490. struct nvbios *bios = &dev_priv->vbios;
  491. u32 script = 0, or;
  492. list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
  493. struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
  494. if (nv_encoder->dcb != dcb)
  495. continue;
  496. nv_connector = nouveau_encoder_connector_get(nv_encoder);
  497. break;
  498. }
  499. or = ffs(dcb->or) - 1;
  500. switch (dcb->type) {
  501. case OUTPUT_LVDS:
  502. script = (mc >> 8) & 0xf;
  503. if (bios->fp_no_ddc) {
  504. if (bios->fp.dual_link)
  505. script |= 0x0100;
  506. if (bios->fp.if_is_24bit)
  507. script |= 0x0200;
  508. } else {
  509. /* determine number of lvds links */
  510. if (nv_connector && nv_connector->edid &&
  511. nv_connector->type == DCB_CONNECTOR_LVDS_SPWG) {
  512. /* http://www.spwg.org */
  513. if (((u8 *)nv_connector->edid)[121] == 2)
  514. script |= 0x0100;
  515. } else
  516. if (pxclk >= bios->fp.duallink_transition_clk) {
  517. script |= 0x0100;
  518. }
  519. /* determine panel depth */
  520. if (script & 0x0100) {
  521. if (bios->fp.strapless_is_24bit & 2)
  522. script |= 0x0200;
  523. } else {
  524. if (bios->fp.strapless_is_24bit & 1)
  525. script |= 0x0200;
  526. }
  527. if (nv_connector && nv_connector->edid &&
  528. (nv_connector->edid->revision >= 4) &&
  529. (nv_connector->edid->input & 0x70) >= 0x20)
  530. script |= 0x0200;
  531. }
  532. if (nouveau_uscript_lvds >= 0) {
  533. NV_INFO(dev, "override script 0x%04x with 0x%04x "
  534. "for output LVDS-%d\n", script,
  535. nouveau_uscript_lvds, or);
  536. script = nouveau_uscript_lvds;
  537. }
  538. break;
  539. case OUTPUT_TMDS:
  540. script = (mc >> 8) & 0xf;
  541. if (pxclk >= 165000)
  542. script |= 0x0100;
  543. if (nouveau_uscript_tmds >= 0) {
  544. NV_INFO(dev, "override script 0x%04x with 0x%04x "
  545. "for output TMDS-%d\n", script,
  546. nouveau_uscript_tmds, or);
  547. script = nouveau_uscript_tmds;
  548. }
  549. break;
  550. case OUTPUT_DP:
  551. script = (mc >> 8) & 0xf;
  552. break;
  553. case OUTPUT_ANALOG:
  554. script = 0xff;
  555. break;
  556. default:
  557. NV_ERROR(dev, "modeset on unsupported output type!\n");
  558. break;
  559. }
  560. return script;
  561. }
  562. static void
  563. nv50_display_vblank_crtc_handler(struct drm_device *dev, int crtc)
  564. {
  565. struct drm_nouveau_private *dev_priv = dev->dev_private;
  566. struct nouveau_software_priv *psw = nv_engine(dev, NVOBJ_ENGINE_SW);
  567. struct nouveau_software_chan *pch, *tmp;
  568. list_for_each_entry_safe(pch, tmp, &psw->vblank, vblank.list) {
  569. if (pch->vblank.head != crtc)
  570. continue;
  571. spin_lock(&psw->peephole_lock);
  572. nv_wr32(dev, 0x001704, pch->vblank.channel);
  573. nv_wr32(dev, 0x001710, 0x80000000 | pch->vblank.ctxdma);
  574. if (dev_priv->chipset == 0x50) {
  575. nv_wr32(dev, 0x001570, pch->vblank.offset);
  576. nv_wr32(dev, 0x001574, pch->vblank.value);
  577. } else {
  578. nv_wr32(dev, 0x060010, pch->vblank.offset);
  579. nv_wr32(dev, 0x060014, pch->vblank.value);
  580. }
  581. spin_unlock(&psw->peephole_lock);
  582. list_del(&pch->vblank.list);
  583. drm_vblank_put(dev, crtc);
  584. }
  585. drm_handle_vblank(dev, crtc);
  586. }
  587. static void
  588. nv50_display_vblank_handler(struct drm_device *dev, uint32_t intr)
  589. {
  590. if (intr & NV50_PDISPLAY_INTR_1_VBLANK_CRTC_0)
  591. nv50_display_vblank_crtc_handler(dev, 0);
  592. if (intr & NV50_PDISPLAY_INTR_1_VBLANK_CRTC_1)
  593. nv50_display_vblank_crtc_handler(dev, 1);
  594. nv_wr32(dev, NV50_PDISPLAY_INTR_1, NV50_PDISPLAY_INTR_1_VBLANK_CRTC);
  595. }
  596. static void
  597. nv50_display_unk10_handler(struct drm_device *dev)
  598. {
  599. struct drm_nouveau_private *dev_priv = dev->dev_private;
  600. struct nv50_display *disp = nv50_display(dev);
  601. u32 unk30 = nv_rd32(dev, 0x610030), mc;
  602. int i, crtc, or = 0, type = OUTPUT_ANY;
  603. NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30);
  604. disp->irq.dcb = NULL;
  605. nv_wr32(dev, 0x619494, nv_rd32(dev, 0x619494) & ~8);
  606. /* Determine which CRTC we're dealing with, only 1 ever will be
  607. * signalled at the same time with the current nouveau code.
  608. */
  609. crtc = ffs((unk30 & 0x00000060) >> 5) - 1;
  610. if (crtc < 0)
  611. goto ack;
  612. /* Nothing needs to be done for the encoder */
  613. crtc = ffs((unk30 & 0x00000180) >> 7) - 1;
  614. if (crtc < 0)
  615. goto ack;
  616. /* Find which encoder was connected to the CRTC */
  617. for (i = 0; type == OUTPUT_ANY && i < 3; i++) {
  618. mc = nv_rd32(dev, NV50_PDISPLAY_DAC_MODE_CTRL_C(i));
  619. NV_DEBUG_KMS(dev, "DAC-%d mc: 0x%08x\n", i, mc);
  620. if (!(mc & (1 << crtc)))
  621. continue;
  622. switch ((mc & 0x00000f00) >> 8) {
  623. case 0: type = OUTPUT_ANALOG; break;
  624. case 1: type = OUTPUT_TV; break;
  625. default:
  626. NV_ERROR(dev, "invalid mc, DAC-%d: 0x%08x\n", i, mc);
  627. goto ack;
  628. }
  629. or = i;
  630. }
  631. for (i = 0; type == OUTPUT_ANY && i < nv50_sor_nr(dev); i++) {
  632. if (dev_priv->chipset < 0x90 ||
  633. dev_priv->chipset == 0x92 ||
  634. dev_priv->chipset == 0xa0)
  635. mc = nv_rd32(dev, NV50_PDISPLAY_SOR_MODE_CTRL_C(i));
  636. else
  637. mc = nv_rd32(dev, NV90_PDISPLAY_SOR_MODE_CTRL_C(i));
  638. NV_DEBUG_KMS(dev, "SOR-%d mc: 0x%08x\n", i, mc);
  639. if (!(mc & (1 << crtc)))
  640. continue;
  641. switch ((mc & 0x00000f00) >> 8) {
  642. case 0: type = OUTPUT_LVDS; break;
  643. case 1: type = OUTPUT_TMDS; break;
  644. case 2: type = OUTPUT_TMDS; break;
  645. case 5: type = OUTPUT_TMDS; break;
  646. case 8: type = OUTPUT_DP; break;
  647. case 9: type = OUTPUT_DP; break;
  648. default:
  649. NV_ERROR(dev, "invalid mc, SOR-%d: 0x%08x\n", i, mc);
  650. goto ack;
  651. }
  652. or = i;
  653. }
  654. /* There was no encoder to disable */
  655. if (type == OUTPUT_ANY)
  656. goto ack;
  657. /* Disable the encoder */
  658. for (i = 0; i < dev_priv->vbios.dcb.entries; i++) {
  659. struct dcb_entry *dcb = &dev_priv->vbios.dcb.entry[i];
  660. if (dcb->type == type && (dcb->or & (1 << or))) {
  661. nouveau_bios_run_display_table(dev, 0, -1, dcb, -1);
  662. disp->irq.dcb = dcb;
  663. goto ack;
  664. }
  665. }
  666. NV_ERROR(dev, "no dcb for %d %d 0x%08x\n", or, type, mc);
  667. ack:
  668. nv_wr32(dev, NV50_PDISPLAY_INTR_1, NV50_PDISPLAY_INTR_1_CLK_UNK10);
  669. nv_wr32(dev, 0x610030, 0x80000000);
  670. }
  671. static void
  672. nv50_display_unk20_handler(struct drm_device *dev)
  673. {
  674. struct drm_nouveau_private *dev_priv = dev->dev_private;
  675. struct nv50_display *disp = nv50_display(dev);
  676. u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0;
  677. struct dcb_entry *dcb;
  678. int i, crtc, or = 0, type = OUTPUT_ANY;
  679. NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30);
  680. dcb = disp->irq.dcb;
  681. if (dcb) {
  682. nouveau_bios_run_display_table(dev, 0, -2, dcb, -1);
  683. disp->irq.dcb = NULL;
  684. }
  685. /* CRTC clock change requested? */
  686. crtc = ffs((unk30 & 0x00000600) >> 9) - 1;
  687. if (crtc >= 0) {
  688. pclk = nv_rd32(dev, NV50_PDISPLAY_CRTC_P(crtc, CLOCK));
  689. pclk &= 0x003fffff;
  690. if (pclk)
  691. nv50_crtc_set_clock(dev, crtc, pclk);
  692. tmp = nv_rd32(dev, NV50_PDISPLAY_CRTC_CLK_CTRL2(crtc));
  693. tmp &= ~0x000000f;
  694. nv_wr32(dev, NV50_PDISPLAY_CRTC_CLK_CTRL2(crtc), tmp);
  695. }
  696. /* Nothing needs to be done for the encoder */
  697. crtc = ffs((unk30 & 0x00000180) >> 7) - 1;
  698. if (crtc < 0)
  699. goto ack;
  700. pclk = nv_rd32(dev, NV50_PDISPLAY_CRTC_P(crtc, CLOCK)) & 0x003fffff;
  701. /* Find which encoder is connected to the CRTC */
  702. for (i = 0; type == OUTPUT_ANY && i < 3; i++) {
  703. mc = nv_rd32(dev, NV50_PDISPLAY_DAC_MODE_CTRL_P(i));
  704. NV_DEBUG_KMS(dev, "DAC-%d mc: 0x%08x\n", i, mc);
  705. if (!(mc & (1 << crtc)))
  706. continue;
  707. switch ((mc & 0x00000f00) >> 8) {
  708. case 0: type = OUTPUT_ANALOG; break;
  709. case 1: type = OUTPUT_TV; break;
  710. default:
  711. NV_ERROR(dev, "invalid mc, DAC-%d: 0x%08x\n", i, mc);
  712. goto ack;
  713. }
  714. or = i;
  715. }
  716. for (i = 0; type == OUTPUT_ANY && i < nv50_sor_nr(dev); i++) {
  717. if (dev_priv->chipset < 0x90 ||
  718. dev_priv->chipset == 0x92 ||
  719. dev_priv->chipset == 0xa0)
  720. mc = nv_rd32(dev, NV50_PDISPLAY_SOR_MODE_CTRL_P(i));
  721. else
  722. mc = nv_rd32(dev, NV90_PDISPLAY_SOR_MODE_CTRL_P(i));
  723. NV_DEBUG_KMS(dev, "SOR-%d mc: 0x%08x\n", i, mc);
  724. if (!(mc & (1 << crtc)))
  725. continue;
  726. switch ((mc & 0x00000f00) >> 8) {
  727. case 0: type = OUTPUT_LVDS; break;
  728. case 1: type = OUTPUT_TMDS; break;
  729. case 2: type = OUTPUT_TMDS; break;
  730. case 5: type = OUTPUT_TMDS; break;
  731. case 8: type = OUTPUT_DP; break;
  732. case 9: type = OUTPUT_DP; break;
  733. default:
  734. NV_ERROR(dev, "invalid mc, SOR-%d: 0x%08x\n", i, mc);
  735. goto ack;
  736. }
  737. or = i;
  738. }
  739. if (type == OUTPUT_ANY)
  740. goto ack;
  741. /* Enable the encoder */
  742. for (i = 0; i < dev_priv->vbios.dcb.entries; i++) {
  743. dcb = &dev_priv->vbios.dcb.entry[i];
  744. if (dcb->type == type && (dcb->or & (1 << or)))
  745. break;
  746. }
  747. if (i == dev_priv->vbios.dcb.entries) {
  748. NV_ERROR(dev, "no dcb for %d %d 0x%08x\n", or, type, mc);
  749. goto ack;
  750. }
  751. script = nv50_display_script_select(dev, dcb, mc, pclk);
  752. nouveau_bios_run_display_table(dev, script, pclk, dcb, -1);
  753. if (type == OUTPUT_DP) {
  754. int link = !(dcb->dpconf.sor.link & 1);
  755. if ((mc & 0x000f0000) == 0x00020000)
  756. nv50_sor_dp_calc_tu(dev, or, link, pclk, 18);
  757. else
  758. nv50_sor_dp_calc_tu(dev, or, link, pclk, 24);
  759. }
  760. if (dcb->type != OUTPUT_ANALOG) {
  761. tmp = nv_rd32(dev, NV50_PDISPLAY_SOR_CLK_CTRL2(or));
  762. tmp &= ~0x00000f0f;
  763. if (script & 0x0100)
  764. tmp |= 0x00000101;
  765. nv_wr32(dev, NV50_PDISPLAY_SOR_CLK_CTRL2(or), tmp);
  766. } else {
  767. nv_wr32(dev, NV50_PDISPLAY_DAC_CLK_CTRL2(or), 0);
  768. }
  769. disp->irq.dcb = dcb;
  770. disp->irq.pclk = pclk;
  771. disp->irq.script = script;
  772. ack:
  773. nv_wr32(dev, NV50_PDISPLAY_INTR_1, NV50_PDISPLAY_INTR_1_CLK_UNK20);
  774. nv_wr32(dev, 0x610030, 0x80000000);
  775. }
  776. /* If programming a TMDS output on a SOR that can also be configured for
  777. * DisplayPort, make sure NV50_SOR_DP_CTRL_ENABLE is forced off.
  778. *
  779. * It looks like the VBIOS TMDS scripts make an attempt at this, however,
  780. * the VBIOS scripts on at least one board I have only switch it off on
  781. * link 0, causing a blank display if the output has previously been
  782. * programmed for DisplayPort.
  783. */
  784. static void
  785. nv50_display_unk40_dp_set_tmds(struct drm_device *dev, struct dcb_entry *dcb)
  786. {
  787. int or = ffs(dcb->or) - 1, link = !(dcb->dpconf.sor.link & 1);
  788. struct drm_encoder *encoder;
  789. u32 tmp;
  790. if (dcb->type != OUTPUT_TMDS)
  791. return;
  792. list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
  793. struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
  794. if (nv_encoder->dcb->type == OUTPUT_DP &&
  795. nv_encoder->dcb->or & (1 << or)) {
  796. tmp = nv_rd32(dev, NV50_SOR_DP_CTRL(or, link));
  797. tmp &= ~NV50_SOR_DP_CTRL_ENABLED;
  798. nv_wr32(dev, NV50_SOR_DP_CTRL(or, link), tmp);
  799. break;
  800. }
  801. }
  802. }
  803. static void
  804. nv50_display_unk40_handler(struct drm_device *dev)
  805. {
  806. struct nv50_display *disp = nv50_display(dev);
  807. struct dcb_entry *dcb = disp->irq.dcb;
  808. u16 script = disp->irq.script;
  809. u32 unk30 = nv_rd32(dev, 0x610030), pclk = disp->irq.pclk;
  810. NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30);
  811. disp->irq.dcb = NULL;
  812. if (!dcb)
  813. goto ack;
  814. nouveau_bios_run_display_table(dev, script, -pclk, dcb, -1);
  815. nv50_display_unk40_dp_set_tmds(dev, dcb);
  816. ack:
  817. nv_wr32(dev, NV50_PDISPLAY_INTR_1, NV50_PDISPLAY_INTR_1_CLK_UNK40);
  818. nv_wr32(dev, 0x610030, 0x80000000);
  819. nv_wr32(dev, 0x619494, nv_rd32(dev, 0x619494) | 8);
  820. }
  821. static void
  822. nv50_display_bh(unsigned long data)
  823. {
  824. struct drm_device *dev = (struct drm_device *)data;
  825. for (;;) {
  826. uint32_t intr0 = nv_rd32(dev, NV50_PDISPLAY_INTR_0);
  827. uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1);
  828. NV_DEBUG_KMS(dev, "PDISPLAY_INTR_BH 0x%08x 0x%08x\n", intr0, intr1);
  829. if (intr1 & NV50_PDISPLAY_INTR_1_CLK_UNK10)
  830. nv50_display_unk10_handler(dev);
  831. else
  832. if (intr1 & NV50_PDISPLAY_INTR_1_CLK_UNK20)
  833. nv50_display_unk20_handler(dev);
  834. else
  835. if (intr1 & NV50_PDISPLAY_INTR_1_CLK_UNK40)
  836. nv50_display_unk40_handler(dev);
  837. else
  838. break;
  839. }
  840. nv_wr32(dev, NV03_PMC_INTR_EN_0, 1);
  841. }
  842. static void
  843. nv50_display_error_handler(struct drm_device *dev)
  844. {
  845. u32 channels = (nv_rd32(dev, NV50_PDISPLAY_INTR_0) & 0x001f0000) >> 16;
  846. u32 addr, data;
  847. int chid;
  848. for (chid = 0; chid < 5; chid++) {
  849. if (!(channels & (1 << chid)))
  850. continue;
  851. nv_wr32(dev, NV50_PDISPLAY_INTR_0, 0x00010000 << chid);
  852. addr = nv_rd32(dev, NV50_PDISPLAY_TRAPPED_ADDR(chid));
  853. data = nv_rd32(dev, NV50_PDISPLAY_TRAPPED_DATA(chid));
  854. NV_ERROR(dev, "EvoCh %d Mthd 0x%04x Data 0x%08x "
  855. "(0x%04x 0x%02x)\n", chid,
  856. addr & 0xffc, data, addr >> 16, (addr >> 12) & 0xf);
  857. nv_wr32(dev, NV50_PDISPLAY_TRAPPED_ADDR(chid), 0x90000000);
  858. }
  859. }
  860. static void
  861. nv50_display_isr(struct drm_device *dev)
  862. {
  863. struct nv50_display *disp = nv50_display(dev);
  864. uint32_t delayed = 0;
  865. while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
  866. uint32_t intr0 = nv_rd32(dev, NV50_PDISPLAY_INTR_0);
  867. uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1);
  868. uint32_t clock;
  869. NV_DEBUG_KMS(dev, "PDISPLAY_INTR 0x%08x 0x%08x\n", intr0, intr1);
  870. if (!intr0 && !(intr1 & ~delayed))
  871. break;
  872. if (intr0 & 0x001f0000) {
  873. nv50_display_error_handler(dev);
  874. intr0 &= ~0x001f0000;
  875. }
  876. if (intr1 & NV50_PDISPLAY_INTR_1_VBLANK_CRTC) {
  877. nv50_display_vblank_handler(dev, intr1);
  878. intr1 &= ~NV50_PDISPLAY_INTR_1_VBLANK_CRTC;
  879. }
  880. clock = (intr1 & (NV50_PDISPLAY_INTR_1_CLK_UNK10 |
  881. NV50_PDISPLAY_INTR_1_CLK_UNK20 |
  882. NV50_PDISPLAY_INTR_1_CLK_UNK40));
  883. if (clock) {
  884. nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
  885. tasklet_schedule(&disp->tasklet);
  886. delayed |= clock;
  887. intr1 &= ~clock;
  888. }
  889. if (intr0) {
  890. NV_ERROR(dev, "unknown PDISPLAY_INTR_0: 0x%08x\n", intr0);
  891. nv_wr32(dev, NV50_PDISPLAY_INTR_0, intr0);
  892. }
  893. if (intr1) {
  894. NV_ERROR(dev,
  895. "unknown PDISPLAY_INTR_1: 0x%08x\n", intr1);
  896. nv_wr32(dev, NV50_PDISPLAY_INTR_1, intr1);
  897. }
  898. }
  899. }