nv10_graph.c 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  1. /*
  2. * Copyright 2007 Matthieu CASTET <castet.matthieu@free.fr>
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the next
  13. * paragraph) shall be included in all copies or substantial portions of the
  14. * Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22. * DEALINGS IN THE SOFTWARE.
  23. */
  24. #include "drmP.h"
  25. #include "drm.h"
  26. #include "nouveau_drm.h"
  27. #include "nouveau_drv.h"
  28. #define NV10_FIFO_NUMBER 32
  29. struct pipe_state {
  30. uint32_t pipe_0x0000[0x040/4];
  31. uint32_t pipe_0x0040[0x010/4];
  32. uint32_t pipe_0x0200[0x0c0/4];
  33. uint32_t pipe_0x4400[0x080/4];
  34. uint32_t pipe_0x6400[0x3b0/4];
  35. uint32_t pipe_0x6800[0x2f0/4];
  36. uint32_t pipe_0x6c00[0x030/4];
  37. uint32_t pipe_0x7000[0x130/4];
  38. uint32_t pipe_0x7400[0x0c0/4];
  39. uint32_t pipe_0x7800[0x0c0/4];
  40. };
  41. static int nv10_graph_ctx_regs[] = {
  42. NV10_PGRAPH_CTX_SWITCH1,
  43. NV10_PGRAPH_CTX_SWITCH2,
  44. NV10_PGRAPH_CTX_SWITCH3,
  45. NV10_PGRAPH_CTX_SWITCH4,
  46. NV10_PGRAPH_CTX_SWITCH5,
  47. NV10_PGRAPH_CTX_CACHE1, /* 8 values from 0x400160 to 0x40017c */
  48. NV10_PGRAPH_CTX_CACHE2, /* 8 values from 0x400180 to 0x40019c */
  49. NV10_PGRAPH_CTX_CACHE3, /* 8 values from 0x4001a0 to 0x4001bc */
  50. NV10_PGRAPH_CTX_CACHE4, /* 8 values from 0x4001c0 to 0x4001dc */
  51. NV10_PGRAPH_CTX_CACHE5, /* 8 values from 0x4001e0 to 0x4001fc */
  52. 0x00400164,
  53. 0x00400184,
  54. 0x004001a4,
  55. 0x004001c4,
  56. 0x004001e4,
  57. 0x00400168,
  58. 0x00400188,
  59. 0x004001a8,
  60. 0x004001c8,
  61. 0x004001e8,
  62. 0x0040016c,
  63. 0x0040018c,
  64. 0x004001ac,
  65. 0x004001cc,
  66. 0x004001ec,
  67. 0x00400170,
  68. 0x00400190,
  69. 0x004001b0,
  70. 0x004001d0,
  71. 0x004001f0,
  72. 0x00400174,
  73. 0x00400194,
  74. 0x004001b4,
  75. 0x004001d4,
  76. 0x004001f4,
  77. 0x00400178,
  78. 0x00400198,
  79. 0x004001b8,
  80. 0x004001d8,
  81. 0x004001f8,
  82. 0x0040017c,
  83. 0x0040019c,
  84. 0x004001bc,
  85. 0x004001dc,
  86. 0x004001fc,
  87. NV10_PGRAPH_CTX_USER,
  88. NV04_PGRAPH_DMA_START_0,
  89. NV04_PGRAPH_DMA_START_1,
  90. NV04_PGRAPH_DMA_LENGTH,
  91. NV04_PGRAPH_DMA_MISC,
  92. NV10_PGRAPH_DMA_PITCH,
  93. NV04_PGRAPH_BOFFSET0,
  94. NV04_PGRAPH_BBASE0,
  95. NV04_PGRAPH_BLIMIT0,
  96. NV04_PGRAPH_BOFFSET1,
  97. NV04_PGRAPH_BBASE1,
  98. NV04_PGRAPH_BLIMIT1,
  99. NV04_PGRAPH_BOFFSET2,
  100. NV04_PGRAPH_BBASE2,
  101. NV04_PGRAPH_BLIMIT2,
  102. NV04_PGRAPH_BOFFSET3,
  103. NV04_PGRAPH_BBASE3,
  104. NV04_PGRAPH_BLIMIT3,
  105. NV04_PGRAPH_BOFFSET4,
  106. NV04_PGRAPH_BBASE4,
  107. NV04_PGRAPH_BLIMIT4,
  108. NV04_PGRAPH_BOFFSET5,
  109. NV04_PGRAPH_BBASE5,
  110. NV04_PGRAPH_BLIMIT5,
  111. NV04_PGRAPH_BPITCH0,
  112. NV04_PGRAPH_BPITCH1,
  113. NV04_PGRAPH_BPITCH2,
  114. NV04_PGRAPH_BPITCH3,
  115. NV04_PGRAPH_BPITCH4,
  116. NV10_PGRAPH_SURFACE,
  117. NV10_PGRAPH_STATE,
  118. NV04_PGRAPH_BSWIZZLE2,
  119. NV04_PGRAPH_BSWIZZLE5,
  120. NV04_PGRAPH_BPIXEL,
  121. NV10_PGRAPH_NOTIFY,
  122. NV04_PGRAPH_PATT_COLOR0,
  123. NV04_PGRAPH_PATT_COLOR1,
  124. NV04_PGRAPH_PATT_COLORRAM, /* 64 values from 0x400900 to 0x4009fc */
  125. 0x00400904,
  126. 0x00400908,
  127. 0x0040090c,
  128. 0x00400910,
  129. 0x00400914,
  130. 0x00400918,
  131. 0x0040091c,
  132. 0x00400920,
  133. 0x00400924,
  134. 0x00400928,
  135. 0x0040092c,
  136. 0x00400930,
  137. 0x00400934,
  138. 0x00400938,
  139. 0x0040093c,
  140. 0x00400940,
  141. 0x00400944,
  142. 0x00400948,
  143. 0x0040094c,
  144. 0x00400950,
  145. 0x00400954,
  146. 0x00400958,
  147. 0x0040095c,
  148. 0x00400960,
  149. 0x00400964,
  150. 0x00400968,
  151. 0x0040096c,
  152. 0x00400970,
  153. 0x00400974,
  154. 0x00400978,
  155. 0x0040097c,
  156. 0x00400980,
  157. 0x00400984,
  158. 0x00400988,
  159. 0x0040098c,
  160. 0x00400990,
  161. 0x00400994,
  162. 0x00400998,
  163. 0x0040099c,
  164. 0x004009a0,
  165. 0x004009a4,
  166. 0x004009a8,
  167. 0x004009ac,
  168. 0x004009b0,
  169. 0x004009b4,
  170. 0x004009b8,
  171. 0x004009bc,
  172. 0x004009c0,
  173. 0x004009c4,
  174. 0x004009c8,
  175. 0x004009cc,
  176. 0x004009d0,
  177. 0x004009d4,
  178. 0x004009d8,
  179. 0x004009dc,
  180. 0x004009e0,
  181. 0x004009e4,
  182. 0x004009e8,
  183. 0x004009ec,
  184. 0x004009f0,
  185. 0x004009f4,
  186. 0x004009f8,
  187. 0x004009fc,
  188. NV04_PGRAPH_PATTERN, /* 2 values from 0x400808 to 0x40080c */
  189. 0x0040080c,
  190. NV04_PGRAPH_PATTERN_SHAPE,
  191. NV03_PGRAPH_MONO_COLOR0,
  192. NV04_PGRAPH_ROP3,
  193. NV04_PGRAPH_CHROMA,
  194. NV04_PGRAPH_BETA_AND,
  195. NV04_PGRAPH_BETA_PREMULT,
  196. 0x00400e70,
  197. 0x00400e74,
  198. 0x00400e78,
  199. 0x00400e7c,
  200. 0x00400e80,
  201. 0x00400e84,
  202. 0x00400e88,
  203. 0x00400e8c,
  204. 0x00400ea0,
  205. 0x00400ea4,
  206. 0x00400ea8,
  207. 0x00400e90,
  208. 0x00400e94,
  209. 0x00400e98,
  210. 0x00400e9c,
  211. NV10_PGRAPH_WINDOWCLIP_HORIZONTAL, /* 8 values from 0x400f00-0x400f1c */
  212. NV10_PGRAPH_WINDOWCLIP_VERTICAL, /* 8 values from 0x400f20-0x400f3c */
  213. 0x00400f04,
  214. 0x00400f24,
  215. 0x00400f08,
  216. 0x00400f28,
  217. 0x00400f0c,
  218. 0x00400f2c,
  219. 0x00400f10,
  220. 0x00400f30,
  221. 0x00400f14,
  222. 0x00400f34,
  223. 0x00400f18,
  224. 0x00400f38,
  225. 0x00400f1c,
  226. 0x00400f3c,
  227. NV10_PGRAPH_XFMODE0,
  228. NV10_PGRAPH_XFMODE1,
  229. NV10_PGRAPH_GLOBALSTATE0,
  230. NV10_PGRAPH_GLOBALSTATE1,
  231. NV04_PGRAPH_STORED_FMT,
  232. NV04_PGRAPH_SOURCE_COLOR,
  233. NV03_PGRAPH_ABS_X_RAM, /* 32 values from 0x400400 to 0x40047c */
  234. NV03_PGRAPH_ABS_Y_RAM, /* 32 values from 0x400480 to 0x4004fc */
  235. 0x00400404,
  236. 0x00400484,
  237. 0x00400408,
  238. 0x00400488,
  239. 0x0040040c,
  240. 0x0040048c,
  241. 0x00400410,
  242. 0x00400490,
  243. 0x00400414,
  244. 0x00400494,
  245. 0x00400418,
  246. 0x00400498,
  247. 0x0040041c,
  248. 0x0040049c,
  249. 0x00400420,
  250. 0x004004a0,
  251. 0x00400424,
  252. 0x004004a4,
  253. 0x00400428,
  254. 0x004004a8,
  255. 0x0040042c,
  256. 0x004004ac,
  257. 0x00400430,
  258. 0x004004b0,
  259. 0x00400434,
  260. 0x004004b4,
  261. 0x00400438,
  262. 0x004004b8,
  263. 0x0040043c,
  264. 0x004004bc,
  265. 0x00400440,
  266. 0x004004c0,
  267. 0x00400444,
  268. 0x004004c4,
  269. 0x00400448,
  270. 0x004004c8,
  271. 0x0040044c,
  272. 0x004004cc,
  273. 0x00400450,
  274. 0x004004d0,
  275. 0x00400454,
  276. 0x004004d4,
  277. 0x00400458,
  278. 0x004004d8,
  279. 0x0040045c,
  280. 0x004004dc,
  281. 0x00400460,
  282. 0x004004e0,
  283. 0x00400464,
  284. 0x004004e4,
  285. 0x00400468,
  286. 0x004004e8,
  287. 0x0040046c,
  288. 0x004004ec,
  289. 0x00400470,
  290. 0x004004f0,
  291. 0x00400474,
  292. 0x004004f4,
  293. 0x00400478,
  294. 0x004004f8,
  295. 0x0040047c,
  296. 0x004004fc,
  297. NV03_PGRAPH_ABS_UCLIP_XMIN,
  298. NV03_PGRAPH_ABS_UCLIP_XMAX,
  299. NV03_PGRAPH_ABS_UCLIP_YMIN,
  300. NV03_PGRAPH_ABS_UCLIP_YMAX,
  301. 0x00400550,
  302. 0x00400558,
  303. 0x00400554,
  304. 0x0040055c,
  305. NV03_PGRAPH_ABS_UCLIPA_XMIN,
  306. NV03_PGRAPH_ABS_UCLIPA_XMAX,
  307. NV03_PGRAPH_ABS_UCLIPA_YMIN,
  308. NV03_PGRAPH_ABS_UCLIPA_YMAX,
  309. NV03_PGRAPH_ABS_ICLIP_XMAX,
  310. NV03_PGRAPH_ABS_ICLIP_YMAX,
  311. NV03_PGRAPH_XY_LOGIC_MISC0,
  312. NV03_PGRAPH_XY_LOGIC_MISC1,
  313. NV03_PGRAPH_XY_LOGIC_MISC2,
  314. NV03_PGRAPH_XY_LOGIC_MISC3,
  315. NV03_PGRAPH_CLIPX_0,
  316. NV03_PGRAPH_CLIPX_1,
  317. NV03_PGRAPH_CLIPY_0,
  318. NV03_PGRAPH_CLIPY_1,
  319. NV10_PGRAPH_COMBINER0_IN_ALPHA,
  320. NV10_PGRAPH_COMBINER1_IN_ALPHA,
  321. NV10_PGRAPH_COMBINER0_IN_RGB,
  322. NV10_PGRAPH_COMBINER1_IN_RGB,
  323. NV10_PGRAPH_COMBINER_COLOR0,
  324. NV10_PGRAPH_COMBINER_COLOR1,
  325. NV10_PGRAPH_COMBINER0_OUT_ALPHA,
  326. NV10_PGRAPH_COMBINER1_OUT_ALPHA,
  327. NV10_PGRAPH_COMBINER0_OUT_RGB,
  328. NV10_PGRAPH_COMBINER1_OUT_RGB,
  329. NV10_PGRAPH_COMBINER_FINAL0,
  330. NV10_PGRAPH_COMBINER_FINAL1,
  331. 0x00400e00,
  332. 0x00400e04,
  333. 0x00400e08,
  334. 0x00400e0c,
  335. 0x00400e10,
  336. 0x00400e14,
  337. 0x00400e18,
  338. 0x00400e1c,
  339. 0x00400e20,
  340. 0x00400e24,
  341. 0x00400e28,
  342. 0x00400e2c,
  343. 0x00400e30,
  344. 0x00400e34,
  345. 0x00400e38,
  346. 0x00400e3c,
  347. NV04_PGRAPH_PASSTHRU_0,
  348. NV04_PGRAPH_PASSTHRU_1,
  349. NV04_PGRAPH_PASSTHRU_2,
  350. NV10_PGRAPH_DIMX_TEXTURE,
  351. NV10_PGRAPH_WDIMX_TEXTURE,
  352. NV10_PGRAPH_DVD_COLORFMT,
  353. NV10_PGRAPH_SCALED_FORMAT,
  354. NV04_PGRAPH_MISC24_0,
  355. NV04_PGRAPH_MISC24_1,
  356. NV04_PGRAPH_MISC24_2,
  357. NV03_PGRAPH_X_MISC,
  358. NV03_PGRAPH_Y_MISC,
  359. NV04_PGRAPH_VALID1,
  360. NV04_PGRAPH_VALID2,
  361. };
  362. static int nv17_graph_ctx_regs[] = {
  363. NV10_PGRAPH_DEBUG_4,
  364. 0x004006b0,
  365. 0x00400eac,
  366. 0x00400eb0,
  367. 0x00400eb4,
  368. 0x00400eb8,
  369. 0x00400ebc,
  370. 0x00400ec0,
  371. 0x00400ec4,
  372. 0x00400ec8,
  373. 0x00400ecc,
  374. 0x00400ed0,
  375. 0x00400ed4,
  376. 0x00400ed8,
  377. 0x00400edc,
  378. 0x00400ee0,
  379. 0x00400a00,
  380. 0x00400a04,
  381. };
  382. struct graph_state {
  383. int nv10[ARRAY_SIZE(nv10_graph_ctx_regs)];
  384. int nv17[ARRAY_SIZE(nv17_graph_ctx_regs)];
  385. struct pipe_state pipe_state;
  386. uint32_t lma_window[4];
  387. };
  388. #define PIPE_SAVE(dev, state, addr) \
  389. do { \
  390. int __i; \
  391. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \
  392. for (__i = 0; __i < ARRAY_SIZE(state); __i++) \
  393. state[__i] = nv_rd32(dev, NV10_PGRAPH_PIPE_DATA); \
  394. } while (0)
  395. #define PIPE_RESTORE(dev, state, addr) \
  396. do { \
  397. int __i; \
  398. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \
  399. for (__i = 0; __i < ARRAY_SIZE(state); __i++) \
  400. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, state[__i]); \
  401. } while (0)
  402. static void nv10_graph_save_pipe(struct nouveau_channel *chan)
  403. {
  404. struct drm_device *dev = chan->dev;
  405. struct graph_state *pgraph_ctx = chan->pgraph_ctx;
  406. struct pipe_state *pipe = &pgraph_ctx->pipe_state;
  407. PIPE_SAVE(dev, pipe->pipe_0x4400, 0x4400);
  408. PIPE_SAVE(dev, pipe->pipe_0x0200, 0x0200);
  409. PIPE_SAVE(dev, pipe->pipe_0x6400, 0x6400);
  410. PIPE_SAVE(dev, pipe->pipe_0x6800, 0x6800);
  411. PIPE_SAVE(dev, pipe->pipe_0x6c00, 0x6c00);
  412. PIPE_SAVE(dev, pipe->pipe_0x7000, 0x7000);
  413. PIPE_SAVE(dev, pipe->pipe_0x7400, 0x7400);
  414. PIPE_SAVE(dev, pipe->pipe_0x7800, 0x7800);
  415. PIPE_SAVE(dev, pipe->pipe_0x0040, 0x0040);
  416. PIPE_SAVE(dev, pipe->pipe_0x0000, 0x0000);
  417. }
  418. static void nv10_graph_load_pipe(struct nouveau_channel *chan)
  419. {
  420. struct drm_device *dev = chan->dev;
  421. struct graph_state *pgraph_ctx = chan->pgraph_ctx;
  422. struct pipe_state *pipe = &pgraph_ctx->pipe_state;
  423. uint32_t xfmode0, xfmode1;
  424. int i;
  425. nouveau_wait_for_idle(dev);
  426. /* XXX check haiku comments */
  427. xfmode0 = nv_rd32(dev, NV10_PGRAPH_XFMODE0);
  428. xfmode1 = nv_rd32(dev, NV10_PGRAPH_XFMODE1);
  429. nv_wr32(dev, NV10_PGRAPH_XFMODE0, 0x10000000);
  430. nv_wr32(dev, NV10_PGRAPH_XFMODE1, 0x00000000);
  431. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x000064c0);
  432. for (i = 0; i < 4; i++)
  433. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000);
  434. for (i = 0; i < 4; i++)
  435. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
  436. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006ab0);
  437. for (i = 0; i < 3; i++)
  438. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000);
  439. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006a80);
  440. for (i = 0; i < 3; i++)
  441. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
  442. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00000040);
  443. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008);
  444. PIPE_RESTORE(dev, pipe->pipe_0x0200, 0x0200);
  445. nouveau_wait_for_idle(dev);
  446. /* restore XFMODE */
  447. nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0);
  448. nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1);
  449. PIPE_RESTORE(dev, pipe->pipe_0x6400, 0x6400);
  450. PIPE_RESTORE(dev, pipe->pipe_0x6800, 0x6800);
  451. PIPE_RESTORE(dev, pipe->pipe_0x6c00, 0x6c00);
  452. PIPE_RESTORE(dev, pipe->pipe_0x7000, 0x7000);
  453. PIPE_RESTORE(dev, pipe->pipe_0x7400, 0x7400);
  454. PIPE_RESTORE(dev, pipe->pipe_0x7800, 0x7800);
  455. PIPE_RESTORE(dev, pipe->pipe_0x4400, 0x4400);
  456. PIPE_RESTORE(dev, pipe->pipe_0x0000, 0x0000);
  457. PIPE_RESTORE(dev, pipe->pipe_0x0040, 0x0040);
  458. nouveau_wait_for_idle(dev);
  459. }
  460. static void nv10_graph_create_pipe(struct nouveau_channel *chan)
  461. {
  462. struct drm_device *dev = chan->dev;
  463. struct graph_state *pgraph_ctx = chan->pgraph_ctx;
  464. struct pipe_state *fifo_pipe_state = &pgraph_ctx->pipe_state;
  465. uint32_t *fifo_pipe_state_addr;
  466. int i;
  467. #define PIPE_INIT(addr) \
  468. do { \
  469. fifo_pipe_state_addr = fifo_pipe_state->pipe_##addr; \
  470. } while (0)
  471. #define PIPE_INIT_END(addr) \
  472. do { \
  473. uint32_t *__end_addr = fifo_pipe_state->pipe_##addr + \
  474. ARRAY_SIZE(fifo_pipe_state->pipe_##addr); \
  475. if (fifo_pipe_state_addr != __end_addr) \
  476. NV_ERROR(dev, "incomplete pipe init for 0x%x : %p/%p\n", \
  477. addr, fifo_pipe_state_addr, __end_addr); \
  478. } while (0)
  479. #define NV_WRITE_PIPE_INIT(value) *(fifo_pipe_state_addr++) = value
  480. PIPE_INIT(0x0200);
  481. for (i = 0; i < 48; i++)
  482. NV_WRITE_PIPE_INIT(0x00000000);
  483. PIPE_INIT_END(0x0200);
  484. PIPE_INIT(0x6400);
  485. for (i = 0; i < 211; i++)
  486. NV_WRITE_PIPE_INIT(0x00000000);
  487. NV_WRITE_PIPE_INIT(0x3f800000);
  488. NV_WRITE_PIPE_INIT(0x40000000);
  489. NV_WRITE_PIPE_INIT(0x40000000);
  490. NV_WRITE_PIPE_INIT(0x40000000);
  491. NV_WRITE_PIPE_INIT(0x40000000);
  492. NV_WRITE_PIPE_INIT(0x00000000);
  493. NV_WRITE_PIPE_INIT(0x00000000);
  494. NV_WRITE_PIPE_INIT(0x3f800000);
  495. NV_WRITE_PIPE_INIT(0x00000000);
  496. NV_WRITE_PIPE_INIT(0x3f000000);
  497. NV_WRITE_PIPE_INIT(0x3f000000);
  498. NV_WRITE_PIPE_INIT(0x00000000);
  499. NV_WRITE_PIPE_INIT(0x00000000);
  500. NV_WRITE_PIPE_INIT(0x00000000);
  501. NV_WRITE_PIPE_INIT(0x00000000);
  502. NV_WRITE_PIPE_INIT(0x3f800000);
  503. NV_WRITE_PIPE_INIT(0x00000000);
  504. NV_WRITE_PIPE_INIT(0x00000000);
  505. NV_WRITE_PIPE_INIT(0x00000000);
  506. NV_WRITE_PIPE_INIT(0x00000000);
  507. NV_WRITE_PIPE_INIT(0x00000000);
  508. NV_WRITE_PIPE_INIT(0x3f800000);
  509. NV_WRITE_PIPE_INIT(0x3f800000);
  510. NV_WRITE_PIPE_INIT(0x3f800000);
  511. NV_WRITE_PIPE_INIT(0x3f800000);
  512. PIPE_INIT_END(0x6400);
  513. PIPE_INIT(0x6800);
  514. for (i = 0; i < 162; i++)
  515. NV_WRITE_PIPE_INIT(0x00000000);
  516. NV_WRITE_PIPE_INIT(0x3f800000);
  517. for (i = 0; i < 25; i++)
  518. NV_WRITE_PIPE_INIT(0x00000000);
  519. PIPE_INIT_END(0x6800);
  520. PIPE_INIT(0x6c00);
  521. NV_WRITE_PIPE_INIT(0x00000000);
  522. NV_WRITE_PIPE_INIT(0x00000000);
  523. NV_WRITE_PIPE_INIT(0x00000000);
  524. NV_WRITE_PIPE_INIT(0x00000000);
  525. NV_WRITE_PIPE_INIT(0xbf800000);
  526. NV_WRITE_PIPE_INIT(0x00000000);
  527. NV_WRITE_PIPE_INIT(0x00000000);
  528. NV_WRITE_PIPE_INIT(0x00000000);
  529. NV_WRITE_PIPE_INIT(0x00000000);
  530. NV_WRITE_PIPE_INIT(0x00000000);
  531. NV_WRITE_PIPE_INIT(0x00000000);
  532. NV_WRITE_PIPE_INIT(0x00000000);
  533. PIPE_INIT_END(0x6c00);
  534. PIPE_INIT(0x7000);
  535. NV_WRITE_PIPE_INIT(0x00000000);
  536. NV_WRITE_PIPE_INIT(0x00000000);
  537. NV_WRITE_PIPE_INIT(0x00000000);
  538. NV_WRITE_PIPE_INIT(0x00000000);
  539. NV_WRITE_PIPE_INIT(0x00000000);
  540. NV_WRITE_PIPE_INIT(0x00000000);
  541. NV_WRITE_PIPE_INIT(0x00000000);
  542. NV_WRITE_PIPE_INIT(0x00000000);
  543. NV_WRITE_PIPE_INIT(0x00000000);
  544. NV_WRITE_PIPE_INIT(0x00000000);
  545. NV_WRITE_PIPE_INIT(0x00000000);
  546. NV_WRITE_PIPE_INIT(0x00000000);
  547. NV_WRITE_PIPE_INIT(0x7149f2ca);
  548. NV_WRITE_PIPE_INIT(0x00000000);
  549. NV_WRITE_PIPE_INIT(0x00000000);
  550. NV_WRITE_PIPE_INIT(0x00000000);
  551. NV_WRITE_PIPE_INIT(0x7149f2ca);
  552. NV_WRITE_PIPE_INIT(0x00000000);
  553. NV_WRITE_PIPE_INIT(0x00000000);
  554. NV_WRITE_PIPE_INIT(0x00000000);
  555. NV_WRITE_PIPE_INIT(0x7149f2ca);
  556. NV_WRITE_PIPE_INIT(0x00000000);
  557. NV_WRITE_PIPE_INIT(0x00000000);
  558. NV_WRITE_PIPE_INIT(0x00000000);
  559. NV_WRITE_PIPE_INIT(0x7149f2ca);
  560. NV_WRITE_PIPE_INIT(0x00000000);
  561. NV_WRITE_PIPE_INIT(0x00000000);
  562. NV_WRITE_PIPE_INIT(0x00000000);
  563. NV_WRITE_PIPE_INIT(0x7149f2ca);
  564. NV_WRITE_PIPE_INIT(0x00000000);
  565. NV_WRITE_PIPE_INIT(0x00000000);
  566. NV_WRITE_PIPE_INIT(0x00000000);
  567. NV_WRITE_PIPE_INIT(0x7149f2ca);
  568. NV_WRITE_PIPE_INIT(0x00000000);
  569. NV_WRITE_PIPE_INIT(0x00000000);
  570. NV_WRITE_PIPE_INIT(0x00000000);
  571. NV_WRITE_PIPE_INIT(0x7149f2ca);
  572. NV_WRITE_PIPE_INIT(0x00000000);
  573. NV_WRITE_PIPE_INIT(0x00000000);
  574. NV_WRITE_PIPE_INIT(0x00000000);
  575. NV_WRITE_PIPE_INIT(0x7149f2ca);
  576. for (i = 0; i < 35; i++)
  577. NV_WRITE_PIPE_INIT(0x00000000);
  578. PIPE_INIT_END(0x7000);
  579. PIPE_INIT(0x7400);
  580. for (i = 0; i < 48; i++)
  581. NV_WRITE_PIPE_INIT(0x00000000);
  582. PIPE_INIT_END(0x7400);
  583. PIPE_INIT(0x7800);
  584. for (i = 0; i < 48; i++)
  585. NV_WRITE_PIPE_INIT(0x00000000);
  586. PIPE_INIT_END(0x7800);
  587. PIPE_INIT(0x4400);
  588. for (i = 0; i < 32; i++)
  589. NV_WRITE_PIPE_INIT(0x00000000);
  590. PIPE_INIT_END(0x4400);
  591. PIPE_INIT(0x0000);
  592. for (i = 0; i < 16; i++)
  593. NV_WRITE_PIPE_INIT(0x00000000);
  594. PIPE_INIT_END(0x0000);
  595. PIPE_INIT(0x0040);
  596. for (i = 0; i < 4; i++)
  597. NV_WRITE_PIPE_INIT(0x00000000);
  598. PIPE_INIT_END(0x0040);
  599. #undef PIPE_INIT
  600. #undef PIPE_INIT_END
  601. #undef NV_WRITE_PIPE_INIT
  602. }
  603. static int nv10_graph_ctx_regs_find_offset(struct drm_device *dev, int reg)
  604. {
  605. int i;
  606. for (i = 0; i < ARRAY_SIZE(nv10_graph_ctx_regs); i++) {
  607. if (nv10_graph_ctx_regs[i] == reg)
  608. return i;
  609. }
  610. NV_ERROR(dev, "unknow offset nv10_ctx_regs %d\n", reg);
  611. return -1;
  612. }
  613. static int nv17_graph_ctx_regs_find_offset(struct drm_device *dev, int reg)
  614. {
  615. int i;
  616. for (i = 0; i < ARRAY_SIZE(nv17_graph_ctx_regs); i++) {
  617. if (nv17_graph_ctx_regs[i] == reg)
  618. return i;
  619. }
  620. NV_ERROR(dev, "unknow offset nv17_ctx_regs %d\n", reg);
  621. return -1;
  622. }
  623. int nv10_graph_load_context(struct nouveau_channel *chan)
  624. {
  625. struct drm_device *dev = chan->dev;
  626. struct drm_nouveau_private *dev_priv = dev->dev_private;
  627. struct graph_state *pgraph_ctx = chan->pgraph_ctx;
  628. uint32_t tmp;
  629. int i;
  630. for (i = 0; i < ARRAY_SIZE(nv10_graph_ctx_regs); i++)
  631. nv_wr32(dev, nv10_graph_ctx_regs[i], pgraph_ctx->nv10[i]);
  632. if (dev_priv->chipset >= 0x17) {
  633. for (i = 0; i < ARRAY_SIZE(nv17_graph_ctx_regs); i++)
  634. nv_wr32(dev, nv17_graph_ctx_regs[i],
  635. pgraph_ctx->nv17[i]);
  636. }
  637. nv10_graph_load_pipe(chan);
  638. nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10010100);
  639. tmp = nv_rd32(dev, NV10_PGRAPH_CTX_USER);
  640. nv_wr32(dev, NV10_PGRAPH_CTX_USER, (tmp & 0xffffff) | chan->id << 24);
  641. tmp = nv_rd32(dev, NV10_PGRAPH_FFINTFC_ST2);
  642. nv_wr32(dev, NV10_PGRAPH_FFINTFC_ST2, tmp & 0xcfffffff);
  643. return 0;
  644. }
  645. int
  646. nv10_graph_unload_context(struct drm_device *dev)
  647. {
  648. struct drm_nouveau_private *dev_priv = dev->dev_private;
  649. struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
  650. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  651. struct nouveau_channel *chan;
  652. struct graph_state *ctx;
  653. uint32_t tmp;
  654. int i;
  655. chan = pgraph->channel(dev);
  656. if (!chan)
  657. return 0;
  658. ctx = chan->pgraph_ctx;
  659. for (i = 0; i < ARRAY_SIZE(nv10_graph_ctx_regs); i++)
  660. ctx->nv10[i] = nv_rd32(dev, nv10_graph_ctx_regs[i]);
  661. if (dev_priv->chipset >= 0x17) {
  662. for (i = 0; i < ARRAY_SIZE(nv17_graph_ctx_regs); i++)
  663. ctx->nv17[i] = nv_rd32(dev, nv17_graph_ctx_regs[i]);
  664. }
  665. nv10_graph_save_pipe(chan);
  666. nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000000);
  667. tmp = nv_rd32(dev, NV10_PGRAPH_CTX_USER) & 0x00ffffff;
  668. tmp |= (pfifo->channels - 1) << 24;
  669. nv_wr32(dev, NV10_PGRAPH_CTX_USER, tmp);
  670. return 0;
  671. }
  672. void
  673. nv10_graph_context_switch(struct drm_device *dev)
  674. {
  675. struct drm_nouveau_private *dev_priv = dev->dev_private;
  676. struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
  677. struct nouveau_channel *chan = NULL;
  678. int chid;
  679. pgraph->fifo_access(dev, false);
  680. nouveau_wait_for_idle(dev);
  681. /* If previous context is valid, we need to save it */
  682. nv10_graph_unload_context(dev);
  683. /* Load context for next channel */
  684. chid = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 20) & 0x1f;
  685. chan = dev_priv->fifos[chid];
  686. if (chan)
  687. nv10_graph_load_context(chan);
  688. pgraph->fifo_access(dev, true);
  689. }
  690. #define NV_WRITE_CTX(reg, val) do { \
  691. int offset = nv10_graph_ctx_regs_find_offset(dev, reg); \
  692. if (offset > 0) \
  693. pgraph_ctx->nv10[offset] = val; \
  694. } while (0)
  695. #define NV17_WRITE_CTX(reg, val) do { \
  696. int offset = nv17_graph_ctx_regs_find_offset(dev, reg); \
  697. if (offset > 0) \
  698. pgraph_ctx->nv17[offset] = val; \
  699. } while (0)
  700. struct nouveau_channel *
  701. nv10_graph_channel(struct drm_device *dev)
  702. {
  703. struct drm_nouveau_private *dev_priv = dev->dev_private;
  704. int chid = dev_priv->engine.fifo.channels;
  705. if (nv_rd32(dev, NV10_PGRAPH_CTX_CONTROL) & 0x00010000)
  706. chid = nv_rd32(dev, NV10_PGRAPH_CTX_USER) >> 24;
  707. if (chid >= dev_priv->engine.fifo.channels)
  708. return NULL;
  709. return dev_priv->fifos[chid];
  710. }
  711. int nv10_graph_create_context(struct nouveau_channel *chan)
  712. {
  713. struct drm_device *dev = chan->dev;
  714. struct drm_nouveau_private *dev_priv = dev->dev_private;
  715. struct graph_state *pgraph_ctx;
  716. NV_DEBUG(dev, "nv10_graph_context_create %d\n", chan->id);
  717. chan->pgraph_ctx = pgraph_ctx = kzalloc(sizeof(*pgraph_ctx),
  718. GFP_KERNEL);
  719. if (pgraph_ctx == NULL)
  720. return -ENOMEM;
  721. NV_WRITE_CTX(0x00400e88, 0x08000000);
  722. NV_WRITE_CTX(0x00400e9c, 0x4b7fffff);
  723. NV_WRITE_CTX(NV03_PGRAPH_XY_LOGIC_MISC0, 0x0001ffff);
  724. NV_WRITE_CTX(0x00400e10, 0x00001000);
  725. NV_WRITE_CTX(0x00400e14, 0x00001000);
  726. NV_WRITE_CTX(0x00400e30, 0x00080008);
  727. NV_WRITE_CTX(0x00400e34, 0x00080008);
  728. if (dev_priv->chipset >= 0x17) {
  729. /* is it really needed ??? */
  730. NV17_WRITE_CTX(NV10_PGRAPH_DEBUG_4,
  731. nv_rd32(dev, NV10_PGRAPH_DEBUG_4));
  732. NV17_WRITE_CTX(0x004006b0, nv_rd32(dev, 0x004006b0));
  733. NV17_WRITE_CTX(0x00400eac, 0x0fff0000);
  734. NV17_WRITE_CTX(0x00400eb0, 0x0fff0000);
  735. NV17_WRITE_CTX(0x00400ec0, 0x00000080);
  736. NV17_WRITE_CTX(0x00400ed0, 0x00000080);
  737. }
  738. NV_WRITE_CTX(NV10_PGRAPH_CTX_USER, chan->id << 24);
  739. nv10_graph_create_pipe(chan);
  740. return 0;
  741. }
  742. void nv10_graph_destroy_context(struct nouveau_channel *chan)
  743. {
  744. struct graph_state *pgraph_ctx = chan->pgraph_ctx;
  745. kfree(pgraph_ctx);
  746. chan->pgraph_ctx = NULL;
  747. }
  748. void
  749. nv10_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
  750. uint32_t size, uint32_t pitch)
  751. {
  752. uint32_t limit = max(1u, addr + size) - 1;
  753. if (pitch)
  754. addr |= 1 << 31;
  755. nv_wr32(dev, NV10_PGRAPH_TLIMIT(i), limit);
  756. nv_wr32(dev, NV10_PGRAPH_TSIZE(i), pitch);
  757. nv_wr32(dev, NV10_PGRAPH_TILE(i), addr);
  758. }
  759. int nv10_graph_init(struct drm_device *dev)
  760. {
  761. struct drm_nouveau_private *dev_priv = dev->dev_private;
  762. uint32_t tmp;
  763. int i;
  764. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) &
  765. ~NV_PMC_ENABLE_PGRAPH);
  766. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) |
  767. NV_PMC_ENABLE_PGRAPH);
  768. nv_wr32(dev, NV03_PGRAPH_INTR , 0xFFFFFFFF);
  769. nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF);
  770. nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0xFFFFFFFF);
  771. nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0x00000000);
  772. nv_wr32(dev, NV04_PGRAPH_DEBUG_1, 0x00118700);
  773. /* nv_wr32(dev, NV04_PGRAPH_DEBUG_2, 0x24E00810); */ /* 0x25f92ad9 */
  774. nv_wr32(dev, NV04_PGRAPH_DEBUG_2, 0x25f92ad9);
  775. nv_wr32(dev, NV04_PGRAPH_DEBUG_3, 0x55DE0830 |
  776. (1<<29) |
  777. (1<<31));
  778. if (dev_priv->chipset >= 0x17) {
  779. nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x1f000000);
  780. nv_wr32(dev, 0x400a10, 0x3ff3fb6);
  781. nv_wr32(dev, 0x400838, 0x2f8684);
  782. nv_wr32(dev, 0x40083c, 0x115f3f);
  783. nv_wr32(dev, 0x004006b0, 0x40000020);
  784. } else
  785. nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x00000000);
  786. /* Turn all the tiling regions off. */
  787. for (i = 0; i < NV10_PFB_TILE__SIZE; i++)
  788. nv10_graph_set_region_tiling(dev, i, 0, 0, 0);
  789. nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000);
  790. nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000);
  791. nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH3, 0x00000000);
  792. nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH4, 0x00000000);
  793. nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF);
  794. tmp = nv_rd32(dev, NV10_PGRAPH_CTX_USER) & 0x00ffffff;
  795. tmp |= (dev_priv->engine.fifo.channels - 1) << 24;
  796. nv_wr32(dev, NV10_PGRAPH_CTX_USER, tmp);
  797. nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000100);
  798. nv_wr32(dev, NV10_PGRAPH_FFINTFC_ST2, 0x08000000);
  799. return 0;
  800. }
  801. void nv10_graph_takedown(struct drm_device *dev)
  802. {
  803. }
  804. static int
  805. nv17_graph_mthd_lma_window(struct nouveau_channel *chan, int grclass,
  806. int mthd, uint32_t data)
  807. {
  808. struct drm_device *dev = chan->dev;
  809. struct graph_state *ctx = chan->pgraph_ctx;
  810. struct pipe_state *pipe = &ctx->pipe_state;
  811. struct drm_nouveau_private *dev_priv = dev->dev_private;
  812. struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
  813. uint32_t pipe_0x0040[1], pipe_0x64c0[8], pipe_0x6a80[3], pipe_0x6ab0[3];
  814. uint32_t xfmode0, xfmode1;
  815. int i;
  816. ctx->lma_window[(mthd - 0x1638) / 4] = data;
  817. if (mthd != 0x1644)
  818. return 0;
  819. nouveau_wait_for_idle(dev);
  820. PIPE_SAVE(dev, pipe_0x0040, 0x0040);
  821. PIPE_SAVE(dev, pipe->pipe_0x0200, 0x0200);
  822. PIPE_RESTORE(dev, ctx->lma_window, 0x6790);
  823. nouveau_wait_for_idle(dev);
  824. xfmode0 = nv_rd32(dev, NV10_PGRAPH_XFMODE0);
  825. xfmode1 = nv_rd32(dev, NV10_PGRAPH_XFMODE1);
  826. PIPE_SAVE(dev, pipe->pipe_0x4400, 0x4400);
  827. PIPE_SAVE(dev, pipe_0x64c0, 0x64c0);
  828. PIPE_SAVE(dev, pipe_0x6ab0, 0x6ab0);
  829. PIPE_SAVE(dev, pipe_0x6a80, 0x6a80);
  830. nouveau_wait_for_idle(dev);
  831. nv_wr32(dev, NV10_PGRAPH_XFMODE0, 0x10000000);
  832. nv_wr32(dev, NV10_PGRAPH_XFMODE1, 0x00000000);
  833. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x000064c0);
  834. for (i = 0; i < 4; i++)
  835. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000);
  836. for (i = 0; i < 4; i++)
  837. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
  838. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006ab0);
  839. for (i = 0; i < 3; i++)
  840. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000);
  841. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006a80);
  842. for (i = 0; i < 3; i++)
  843. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
  844. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00000040);
  845. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008);
  846. PIPE_RESTORE(dev, pipe->pipe_0x0200, 0x0200);
  847. nouveau_wait_for_idle(dev);
  848. PIPE_RESTORE(dev, pipe_0x0040, 0x0040);
  849. nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0);
  850. nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1);
  851. PIPE_RESTORE(dev, pipe_0x64c0, 0x64c0);
  852. PIPE_RESTORE(dev, pipe_0x6ab0, 0x6ab0);
  853. PIPE_RESTORE(dev, pipe_0x6a80, 0x6a80);
  854. PIPE_RESTORE(dev, pipe->pipe_0x4400, 0x4400);
  855. nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x000000c0);
  856. nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
  857. nouveau_wait_for_idle(dev);
  858. pgraph->fifo_access(dev, true);
  859. return 0;
  860. }
  861. static int
  862. nv17_graph_mthd_lma_enable(struct nouveau_channel *chan, int grclass,
  863. int mthd, uint32_t data)
  864. {
  865. struct drm_device *dev = chan->dev;
  866. struct drm_nouveau_private *dev_priv = dev->dev_private;
  867. struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
  868. nouveau_wait_for_idle(dev);
  869. nv_wr32(dev, NV10_PGRAPH_DEBUG_4,
  870. nv_rd32(dev, NV10_PGRAPH_DEBUG_4) | 0x1 << 8);
  871. nv_wr32(dev, 0x004006b0,
  872. nv_rd32(dev, 0x004006b0) | 0x8 << 24);
  873. pgraph->fifo_access(dev, true);
  874. return 0;
  875. }
  876. static struct nouveau_pgraph_object_method nv17_graph_celsius_mthds[] = {
  877. { 0x1638, nv17_graph_mthd_lma_window },
  878. { 0x163c, nv17_graph_mthd_lma_window },
  879. { 0x1640, nv17_graph_mthd_lma_window },
  880. { 0x1644, nv17_graph_mthd_lma_window },
  881. { 0x1658, nv17_graph_mthd_lma_enable },
  882. {}
  883. };
  884. struct nouveau_pgraph_object_class nv10_graph_grclass[] = {
  885. { 0x0030, false, NULL }, /* null */
  886. { 0x0039, false, NULL }, /* m2mf */
  887. { 0x004a, false, NULL }, /* gdirect */
  888. { 0x005f, false, NULL }, /* imageblit */
  889. { 0x009f, false, NULL }, /* imageblit (nv12) */
  890. { 0x008a, false, NULL }, /* ifc */
  891. { 0x0089, false, NULL }, /* sifm */
  892. { 0x0062, false, NULL }, /* surf2d */
  893. { 0x0043, false, NULL }, /* rop */
  894. { 0x0012, false, NULL }, /* beta1 */
  895. { 0x0072, false, NULL }, /* beta4 */
  896. { 0x0019, false, NULL }, /* cliprect */
  897. { 0x0044, false, NULL }, /* pattern */
  898. { 0x0052, false, NULL }, /* swzsurf */
  899. { 0x0093, false, NULL }, /* surf3d */
  900. { 0x0094, false, NULL }, /* tex_tri */
  901. { 0x0095, false, NULL }, /* multitex_tri */
  902. { 0x0056, false, NULL }, /* celcius (nv10) */
  903. { 0x0096, false, NULL }, /* celcius (nv11) */
  904. { 0x0099, false, nv17_graph_celsius_mthds }, /* celcius (nv17) */
  905. {}
  906. };