nv04_graph.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. /*
  2. * Copyright 2007 Stephane Marchesin
  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. static uint32_t nv04_graph_ctx_regs[] = {
  29. 0x0040053c,
  30. 0x00400544,
  31. 0x00400540,
  32. 0x00400548,
  33. NV04_PGRAPH_CTX_SWITCH1,
  34. NV04_PGRAPH_CTX_SWITCH2,
  35. NV04_PGRAPH_CTX_SWITCH3,
  36. NV04_PGRAPH_CTX_SWITCH4,
  37. NV04_PGRAPH_CTX_CACHE1,
  38. NV04_PGRAPH_CTX_CACHE2,
  39. NV04_PGRAPH_CTX_CACHE3,
  40. NV04_PGRAPH_CTX_CACHE4,
  41. 0x00400184,
  42. 0x004001a4,
  43. 0x004001c4,
  44. 0x004001e4,
  45. 0x00400188,
  46. 0x004001a8,
  47. 0x004001c8,
  48. 0x004001e8,
  49. 0x0040018c,
  50. 0x004001ac,
  51. 0x004001cc,
  52. 0x004001ec,
  53. 0x00400190,
  54. 0x004001b0,
  55. 0x004001d0,
  56. 0x004001f0,
  57. 0x00400194,
  58. 0x004001b4,
  59. 0x004001d4,
  60. 0x004001f4,
  61. 0x00400198,
  62. 0x004001b8,
  63. 0x004001d8,
  64. 0x004001f8,
  65. 0x0040019c,
  66. 0x004001bc,
  67. 0x004001dc,
  68. 0x004001fc,
  69. 0x00400174,
  70. NV04_PGRAPH_DMA_START_0,
  71. NV04_PGRAPH_DMA_START_1,
  72. NV04_PGRAPH_DMA_LENGTH,
  73. NV04_PGRAPH_DMA_MISC,
  74. NV04_PGRAPH_DMA_PITCH,
  75. NV04_PGRAPH_BOFFSET0,
  76. NV04_PGRAPH_BBASE0,
  77. NV04_PGRAPH_BLIMIT0,
  78. NV04_PGRAPH_BOFFSET1,
  79. NV04_PGRAPH_BBASE1,
  80. NV04_PGRAPH_BLIMIT1,
  81. NV04_PGRAPH_BOFFSET2,
  82. NV04_PGRAPH_BBASE2,
  83. NV04_PGRAPH_BLIMIT2,
  84. NV04_PGRAPH_BOFFSET3,
  85. NV04_PGRAPH_BBASE3,
  86. NV04_PGRAPH_BLIMIT3,
  87. NV04_PGRAPH_BOFFSET4,
  88. NV04_PGRAPH_BBASE4,
  89. NV04_PGRAPH_BLIMIT4,
  90. NV04_PGRAPH_BOFFSET5,
  91. NV04_PGRAPH_BBASE5,
  92. NV04_PGRAPH_BLIMIT5,
  93. NV04_PGRAPH_BPITCH0,
  94. NV04_PGRAPH_BPITCH1,
  95. NV04_PGRAPH_BPITCH2,
  96. NV04_PGRAPH_BPITCH3,
  97. NV04_PGRAPH_BPITCH4,
  98. NV04_PGRAPH_SURFACE,
  99. NV04_PGRAPH_STATE,
  100. NV04_PGRAPH_BSWIZZLE2,
  101. NV04_PGRAPH_BSWIZZLE5,
  102. NV04_PGRAPH_BPIXEL,
  103. NV04_PGRAPH_NOTIFY,
  104. NV04_PGRAPH_PATT_COLOR0,
  105. NV04_PGRAPH_PATT_COLOR1,
  106. NV04_PGRAPH_PATT_COLORRAM+0x00,
  107. NV04_PGRAPH_PATT_COLORRAM+0x04,
  108. NV04_PGRAPH_PATT_COLORRAM+0x08,
  109. NV04_PGRAPH_PATT_COLORRAM+0x0c,
  110. NV04_PGRAPH_PATT_COLORRAM+0x10,
  111. NV04_PGRAPH_PATT_COLORRAM+0x14,
  112. NV04_PGRAPH_PATT_COLORRAM+0x18,
  113. NV04_PGRAPH_PATT_COLORRAM+0x1c,
  114. NV04_PGRAPH_PATT_COLORRAM+0x20,
  115. NV04_PGRAPH_PATT_COLORRAM+0x24,
  116. NV04_PGRAPH_PATT_COLORRAM+0x28,
  117. NV04_PGRAPH_PATT_COLORRAM+0x2c,
  118. NV04_PGRAPH_PATT_COLORRAM+0x30,
  119. NV04_PGRAPH_PATT_COLORRAM+0x34,
  120. NV04_PGRAPH_PATT_COLORRAM+0x38,
  121. NV04_PGRAPH_PATT_COLORRAM+0x3c,
  122. NV04_PGRAPH_PATT_COLORRAM+0x40,
  123. NV04_PGRAPH_PATT_COLORRAM+0x44,
  124. NV04_PGRAPH_PATT_COLORRAM+0x48,
  125. NV04_PGRAPH_PATT_COLORRAM+0x4c,
  126. NV04_PGRAPH_PATT_COLORRAM+0x50,
  127. NV04_PGRAPH_PATT_COLORRAM+0x54,
  128. NV04_PGRAPH_PATT_COLORRAM+0x58,
  129. NV04_PGRAPH_PATT_COLORRAM+0x5c,
  130. NV04_PGRAPH_PATT_COLORRAM+0x60,
  131. NV04_PGRAPH_PATT_COLORRAM+0x64,
  132. NV04_PGRAPH_PATT_COLORRAM+0x68,
  133. NV04_PGRAPH_PATT_COLORRAM+0x6c,
  134. NV04_PGRAPH_PATT_COLORRAM+0x70,
  135. NV04_PGRAPH_PATT_COLORRAM+0x74,
  136. NV04_PGRAPH_PATT_COLORRAM+0x78,
  137. NV04_PGRAPH_PATT_COLORRAM+0x7c,
  138. NV04_PGRAPH_PATT_COLORRAM+0x80,
  139. NV04_PGRAPH_PATT_COLORRAM+0x84,
  140. NV04_PGRAPH_PATT_COLORRAM+0x88,
  141. NV04_PGRAPH_PATT_COLORRAM+0x8c,
  142. NV04_PGRAPH_PATT_COLORRAM+0x90,
  143. NV04_PGRAPH_PATT_COLORRAM+0x94,
  144. NV04_PGRAPH_PATT_COLORRAM+0x98,
  145. NV04_PGRAPH_PATT_COLORRAM+0x9c,
  146. NV04_PGRAPH_PATT_COLORRAM+0xa0,
  147. NV04_PGRAPH_PATT_COLORRAM+0xa4,
  148. NV04_PGRAPH_PATT_COLORRAM+0xa8,
  149. NV04_PGRAPH_PATT_COLORRAM+0xac,
  150. NV04_PGRAPH_PATT_COLORRAM+0xb0,
  151. NV04_PGRAPH_PATT_COLORRAM+0xb4,
  152. NV04_PGRAPH_PATT_COLORRAM+0xb8,
  153. NV04_PGRAPH_PATT_COLORRAM+0xbc,
  154. NV04_PGRAPH_PATT_COLORRAM+0xc0,
  155. NV04_PGRAPH_PATT_COLORRAM+0xc4,
  156. NV04_PGRAPH_PATT_COLORRAM+0xc8,
  157. NV04_PGRAPH_PATT_COLORRAM+0xcc,
  158. NV04_PGRAPH_PATT_COLORRAM+0xd0,
  159. NV04_PGRAPH_PATT_COLORRAM+0xd4,
  160. NV04_PGRAPH_PATT_COLORRAM+0xd8,
  161. NV04_PGRAPH_PATT_COLORRAM+0xdc,
  162. NV04_PGRAPH_PATT_COLORRAM+0xe0,
  163. NV04_PGRAPH_PATT_COLORRAM+0xe4,
  164. NV04_PGRAPH_PATT_COLORRAM+0xe8,
  165. NV04_PGRAPH_PATT_COLORRAM+0xec,
  166. NV04_PGRAPH_PATT_COLORRAM+0xf0,
  167. NV04_PGRAPH_PATT_COLORRAM+0xf4,
  168. NV04_PGRAPH_PATT_COLORRAM+0xf8,
  169. NV04_PGRAPH_PATT_COLORRAM+0xfc,
  170. NV04_PGRAPH_PATTERN,
  171. 0x0040080c,
  172. NV04_PGRAPH_PATTERN_SHAPE,
  173. 0x00400600,
  174. NV04_PGRAPH_ROP3,
  175. NV04_PGRAPH_CHROMA,
  176. NV04_PGRAPH_BETA_AND,
  177. NV04_PGRAPH_BETA_PREMULT,
  178. NV04_PGRAPH_CONTROL0,
  179. NV04_PGRAPH_CONTROL1,
  180. NV04_PGRAPH_CONTROL2,
  181. NV04_PGRAPH_BLEND,
  182. NV04_PGRAPH_STORED_FMT,
  183. NV04_PGRAPH_SOURCE_COLOR,
  184. 0x00400560,
  185. 0x00400568,
  186. 0x00400564,
  187. 0x0040056c,
  188. 0x00400400,
  189. 0x00400480,
  190. 0x00400404,
  191. 0x00400484,
  192. 0x00400408,
  193. 0x00400488,
  194. 0x0040040c,
  195. 0x0040048c,
  196. 0x00400410,
  197. 0x00400490,
  198. 0x00400414,
  199. 0x00400494,
  200. 0x00400418,
  201. 0x00400498,
  202. 0x0040041c,
  203. 0x0040049c,
  204. 0x00400420,
  205. 0x004004a0,
  206. 0x00400424,
  207. 0x004004a4,
  208. 0x00400428,
  209. 0x004004a8,
  210. 0x0040042c,
  211. 0x004004ac,
  212. 0x00400430,
  213. 0x004004b0,
  214. 0x00400434,
  215. 0x004004b4,
  216. 0x00400438,
  217. 0x004004b8,
  218. 0x0040043c,
  219. 0x004004bc,
  220. 0x00400440,
  221. 0x004004c0,
  222. 0x00400444,
  223. 0x004004c4,
  224. 0x00400448,
  225. 0x004004c8,
  226. 0x0040044c,
  227. 0x004004cc,
  228. 0x00400450,
  229. 0x004004d0,
  230. 0x00400454,
  231. 0x004004d4,
  232. 0x00400458,
  233. 0x004004d8,
  234. 0x0040045c,
  235. 0x004004dc,
  236. 0x00400460,
  237. 0x004004e0,
  238. 0x00400464,
  239. 0x004004e4,
  240. 0x00400468,
  241. 0x004004e8,
  242. 0x0040046c,
  243. 0x004004ec,
  244. 0x00400470,
  245. 0x004004f0,
  246. 0x00400474,
  247. 0x004004f4,
  248. 0x00400478,
  249. 0x004004f8,
  250. 0x0040047c,
  251. 0x004004fc,
  252. 0x00400534,
  253. 0x00400538,
  254. 0x00400514,
  255. 0x00400518,
  256. 0x0040051c,
  257. 0x00400520,
  258. 0x00400524,
  259. 0x00400528,
  260. 0x0040052c,
  261. 0x00400530,
  262. 0x00400d00,
  263. 0x00400d40,
  264. 0x00400d80,
  265. 0x00400d04,
  266. 0x00400d44,
  267. 0x00400d84,
  268. 0x00400d08,
  269. 0x00400d48,
  270. 0x00400d88,
  271. 0x00400d0c,
  272. 0x00400d4c,
  273. 0x00400d8c,
  274. 0x00400d10,
  275. 0x00400d50,
  276. 0x00400d90,
  277. 0x00400d14,
  278. 0x00400d54,
  279. 0x00400d94,
  280. 0x00400d18,
  281. 0x00400d58,
  282. 0x00400d98,
  283. 0x00400d1c,
  284. 0x00400d5c,
  285. 0x00400d9c,
  286. 0x00400d20,
  287. 0x00400d60,
  288. 0x00400da0,
  289. 0x00400d24,
  290. 0x00400d64,
  291. 0x00400da4,
  292. 0x00400d28,
  293. 0x00400d68,
  294. 0x00400da8,
  295. 0x00400d2c,
  296. 0x00400d6c,
  297. 0x00400dac,
  298. 0x00400d30,
  299. 0x00400d70,
  300. 0x00400db0,
  301. 0x00400d34,
  302. 0x00400d74,
  303. 0x00400db4,
  304. 0x00400d38,
  305. 0x00400d78,
  306. 0x00400db8,
  307. 0x00400d3c,
  308. 0x00400d7c,
  309. 0x00400dbc,
  310. 0x00400590,
  311. 0x00400594,
  312. 0x00400598,
  313. 0x0040059c,
  314. 0x004005a8,
  315. 0x004005ac,
  316. 0x004005b0,
  317. 0x004005b4,
  318. 0x004005c0,
  319. 0x004005c4,
  320. 0x004005c8,
  321. 0x004005cc,
  322. 0x004005d0,
  323. 0x004005d4,
  324. 0x004005d8,
  325. 0x004005dc,
  326. 0x004005e0,
  327. NV04_PGRAPH_PASSTHRU_0,
  328. NV04_PGRAPH_PASSTHRU_1,
  329. NV04_PGRAPH_PASSTHRU_2,
  330. NV04_PGRAPH_DVD_COLORFMT,
  331. NV04_PGRAPH_SCALED_FORMAT,
  332. NV04_PGRAPH_MISC24_0,
  333. NV04_PGRAPH_MISC24_1,
  334. NV04_PGRAPH_MISC24_2,
  335. 0x00400500,
  336. 0x00400504,
  337. NV04_PGRAPH_VALID1,
  338. NV04_PGRAPH_VALID2,
  339. NV04_PGRAPH_DEBUG_3
  340. };
  341. struct graph_state {
  342. uint32_t nv04[ARRAY_SIZE(nv04_graph_ctx_regs)];
  343. };
  344. struct nouveau_channel *
  345. nv04_graph_channel(struct drm_device *dev)
  346. {
  347. struct drm_nouveau_private *dev_priv = dev->dev_private;
  348. int chid = dev_priv->engine.fifo.channels;
  349. if (nv_rd32(dev, NV04_PGRAPH_CTX_CONTROL) & 0x00010000)
  350. chid = nv_rd32(dev, NV04_PGRAPH_CTX_USER) >> 24;
  351. if (chid >= dev_priv->engine.fifo.channels)
  352. return NULL;
  353. return dev_priv->fifos[chid];
  354. }
  355. void
  356. nv04_graph_context_switch(struct drm_device *dev)
  357. {
  358. struct drm_nouveau_private *dev_priv = dev->dev_private;
  359. struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
  360. struct nouveau_channel *chan = NULL;
  361. int chid;
  362. pgraph->fifo_access(dev, false);
  363. nouveau_wait_for_idle(dev);
  364. /* If previous context is valid, we need to save it */
  365. pgraph->unload_context(dev);
  366. /* Load context for next channel */
  367. chid = dev_priv->engine.fifo.channel_id(dev);
  368. chan = dev_priv->fifos[chid];
  369. if (chan)
  370. nv04_graph_load_context(chan);
  371. pgraph->fifo_access(dev, true);
  372. }
  373. static uint32_t *ctx_reg(struct graph_state *ctx, uint32_t reg)
  374. {
  375. int i;
  376. for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++) {
  377. if (nv04_graph_ctx_regs[i] == reg)
  378. return &ctx->nv04[i];
  379. }
  380. return NULL;
  381. }
  382. int nv04_graph_create_context(struct nouveau_channel *chan)
  383. {
  384. struct graph_state *pgraph_ctx;
  385. NV_DEBUG(chan->dev, "nv04_graph_context_create %d\n", chan->id);
  386. chan->pgraph_ctx = pgraph_ctx = kzalloc(sizeof(*pgraph_ctx),
  387. GFP_KERNEL);
  388. if (pgraph_ctx == NULL)
  389. return -ENOMEM;
  390. *ctx_reg(pgraph_ctx, NV04_PGRAPH_DEBUG_3) = 0xfad4ff31;
  391. return 0;
  392. }
  393. void nv04_graph_destroy_context(struct nouveau_channel *chan)
  394. {
  395. struct graph_state *pgraph_ctx = chan->pgraph_ctx;
  396. kfree(pgraph_ctx);
  397. chan->pgraph_ctx = NULL;
  398. }
  399. int nv04_graph_load_context(struct nouveau_channel *chan)
  400. {
  401. struct drm_device *dev = chan->dev;
  402. struct graph_state *pgraph_ctx = chan->pgraph_ctx;
  403. uint32_t tmp;
  404. int i;
  405. for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++)
  406. nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]);
  407. nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100);
  408. tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
  409. nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp | chan->id << 24);
  410. tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2);
  411. nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff);
  412. return 0;
  413. }
  414. int
  415. nv04_graph_unload_context(struct drm_device *dev)
  416. {
  417. struct drm_nouveau_private *dev_priv = dev->dev_private;
  418. struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
  419. struct nouveau_channel *chan = NULL;
  420. struct graph_state *ctx;
  421. uint32_t tmp;
  422. int i;
  423. chan = pgraph->channel(dev);
  424. if (!chan)
  425. return 0;
  426. ctx = chan->pgraph_ctx;
  427. for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++)
  428. ctx->nv04[i] = nv_rd32(dev, nv04_graph_ctx_regs[i]);
  429. nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10000000);
  430. tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
  431. tmp |= (dev_priv->engine.fifo.channels - 1) << 24;
  432. nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp);
  433. return 0;
  434. }
  435. int nv04_graph_init(struct drm_device *dev)
  436. {
  437. struct drm_nouveau_private *dev_priv = dev->dev_private;
  438. uint32_t tmp;
  439. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) &
  440. ~NV_PMC_ENABLE_PGRAPH);
  441. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) |
  442. NV_PMC_ENABLE_PGRAPH);
  443. /* Enable PGRAPH interrupts */
  444. nv_wr32(dev, NV03_PGRAPH_INTR, 0xFFFFFFFF);
  445. nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF);
  446. nv_wr32(dev, NV04_PGRAPH_VALID1, 0);
  447. nv_wr32(dev, NV04_PGRAPH_VALID2, 0);
  448. /*nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0x000001FF);
  449. nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0x001FFFFF);*/
  450. nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0x1231c000);
  451. /*1231C000 blob, 001 haiku*/
  452. //*V_WRITE(NV04_PGRAPH_DEBUG_1, 0xf2d91100);*/
  453. nv_wr32(dev, NV04_PGRAPH_DEBUG_1, 0x72111100);
  454. /*0x72111100 blob , 01 haiku*/
  455. /*nv_wr32(dev, NV04_PGRAPH_DEBUG_2, 0x11d5f870);*/
  456. nv_wr32(dev, NV04_PGRAPH_DEBUG_2, 0x11d5f071);
  457. /*haiku same*/
  458. /*nv_wr32(dev, NV04_PGRAPH_DEBUG_3, 0xfad4ff31);*/
  459. nv_wr32(dev, NV04_PGRAPH_DEBUG_3, 0xf0d4ff31);
  460. /*haiku and blob 10d4*/
  461. nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF);
  462. nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100);
  463. tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
  464. tmp |= (dev_priv->engine.fifo.channels - 1) << 24;
  465. nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp);
  466. /* These don't belong here, they're part of a per-channel context */
  467. nv_wr32(dev, NV04_PGRAPH_PATTERN_SHAPE, 0x00000000);
  468. nv_wr32(dev, NV04_PGRAPH_BETA_AND , 0xFFFFFFFF);
  469. return 0;
  470. }
  471. void nv04_graph_takedown(struct drm_device *dev)
  472. {
  473. }
  474. void
  475. nv04_graph_fifo_access(struct drm_device *dev, bool enabled)
  476. {
  477. if (enabled)
  478. nv_wr32(dev, NV04_PGRAPH_FIFO,
  479. nv_rd32(dev, NV04_PGRAPH_FIFO) | 1);
  480. else
  481. nv_wr32(dev, NV04_PGRAPH_FIFO,
  482. nv_rd32(dev, NV04_PGRAPH_FIFO) & ~1);
  483. }
  484. static int
  485. nv04_graph_mthd_set_ref(struct nouveau_channel *chan, int grclass,
  486. int mthd, uint32_t data)
  487. {
  488. atomic_set(&chan->fence.last_sequence_irq, data);
  489. return 0;
  490. }
  491. /*
  492. * Software methods, why they are needed, and how they all work:
  493. *
  494. * NV04 and NV05 keep most of the state in PGRAPH context itself, but some
  495. * 2d engine settings are kept inside the grobjs themselves. The grobjs are
  496. * 3 words long on both. grobj format on NV04 is:
  497. *
  498. * word 0:
  499. * - bits 0-7: class
  500. * - bit 12: color key active
  501. * - bit 13: clip rect active
  502. * - bit 14: if set, destination surface is swizzled and taken from buffer 5
  503. * [set by NV04_SWIZZLED_SURFACE], otherwise it's linear and taken
  504. * from buffer 0 [set by NV04_CONTEXT_SURFACES_2D or
  505. * NV03_CONTEXT_SURFACE_DST].
  506. * - bits 15-17: 2d operation [aka patch config]
  507. * - bit 24: patch valid [enables rendering using this object]
  508. * - bit 25: surf3d valid [for tex_tri and multitex_tri only]
  509. * word 1:
  510. * - bits 0-1: mono format
  511. * - bits 8-13: color format
  512. * - bits 16-31: DMA_NOTIFY instance
  513. * word 2:
  514. * - bits 0-15: DMA_A instance
  515. * - bits 16-31: DMA_B instance
  516. *
  517. * On NV05 it's:
  518. *
  519. * word 0:
  520. * - bits 0-7: class
  521. * - bit 12: color key active
  522. * - bit 13: clip rect active
  523. * - bit 14: if set, destination surface is swizzled and taken from buffer 5
  524. * [set by NV04_SWIZZLED_SURFACE], otherwise it's linear and taken
  525. * from buffer 0 [set by NV04_CONTEXT_SURFACES_2D or
  526. * NV03_CONTEXT_SURFACE_DST].
  527. * - bits 15-17: 2d operation [aka patch config]
  528. * - bits 20-22: dither mode
  529. * - bit 24: patch valid [enables rendering using this object]
  530. * - bit 25: surface_dst/surface_color/surf2d/surf3d valid
  531. * - bit 26: surface_src/surface_zeta valid
  532. * - bit 27: pattern valid
  533. * - bit 28: rop valid
  534. * - bit 29: beta1 valid
  535. * - bit 30: beta4 valid
  536. * word 1:
  537. * - bits 0-1: mono format
  538. * - bits 8-13: color format
  539. * - bits 16-31: DMA_NOTIFY instance
  540. * word 2:
  541. * - bits 0-15: DMA_A instance
  542. * - bits 16-31: DMA_B instance
  543. *
  544. * NV05 will set/unset the relevant valid bits when you poke the relevant
  545. * object-binding methods with object of the proper type, or with the NULL
  546. * type. It'll only allow rendering using the grobj if all needed objects
  547. * are bound. The needed set of objects depends on selected operation: for
  548. * example rop object is needed by ROP_AND, but not by SRCCOPY_AND.
  549. *
  550. * NV04 doesn't have these methods implemented at all, and doesn't have the
  551. * relevant bits in grobj. Instead, it'll allow rendering whenever bit 24
  552. * is set. So we have to emulate them in software, internally keeping the
  553. * same bits as NV05 does. Since grobjs are aligned to 16 bytes on nv04,
  554. * but the last word isn't actually used for anything, we abuse it for this
  555. * purpose.
  556. *
  557. * Actually, NV05 can optionally check bit 24 too, but we disable this since
  558. * there's no use for it.
  559. *
  560. * For unknown reasons, NV04 implements surf3d binding in hardware as an
  561. * exception. Also for unknown reasons, NV04 doesn't implement the clipping
  562. * methods on the surf3d object, so we have to emulate them too.
  563. */
  564. static void
  565. nv04_graph_set_ctx1(struct nouveau_channel *chan, uint32_t mask, uint32_t value)
  566. {
  567. struct drm_device *dev = chan->dev;
  568. uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4;
  569. int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7;
  570. uint32_t tmp;
  571. tmp = nv_ri32(dev, instance);
  572. tmp &= ~mask;
  573. tmp |= value;
  574. nv_wi32(dev, instance, tmp);
  575. nv_wr32(dev, NV04_PGRAPH_CTX_SWITCH1, tmp);
  576. nv_wr32(dev, NV04_PGRAPH_CTX_CACHE1 + (subc<<2), tmp);
  577. }
  578. static void
  579. nv04_graph_set_ctx_val(struct nouveau_channel *chan, uint32_t mask, uint32_t value)
  580. {
  581. struct drm_device *dev = chan->dev;
  582. uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4;
  583. uint32_t tmp, ctx1;
  584. int class, op, valid = 1;
  585. ctx1 = nv_ri32(dev, instance);
  586. class = ctx1 & 0xff;
  587. op = (ctx1 >> 15) & 7;
  588. tmp = nv_ri32(dev, instance + 0xc);
  589. tmp &= ~mask;
  590. tmp |= value;
  591. nv_wi32(dev, instance + 0xc, tmp);
  592. /* check for valid surf2d/surf_dst/surf_color */
  593. if (!(tmp & 0x02000000))
  594. valid = 0;
  595. /* check for valid surf_src/surf_zeta */
  596. if ((class == 0x1f || class == 0x48) && !(tmp & 0x04000000))
  597. valid = 0;
  598. switch (op) {
  599. /* SRCCOPY_AND, SRCCOPY: no extra objects required */
  600. case 0:
  601. case 3:
  602. break;
  603. /* ROP_AND: requires pattern and rop */
  604. case 1:
  605. if (!(tmp & 0x18000000))
  606. valid = 0;
  607. break;
  608. /* BLEND_AND: requires beta1 */
  609. case 2:
  610. if (!(tmp & 0x20000000))
  611. valid = 0;
  612. break;
  613. /* SRCCOPY_PREMULT, BLEND_PREMULT: beta4 required */
  614. case 4:
  615. case 5:
  616. if (!(tmp & 0x40000000))
  617. valid = 0;
  618. break;
  619. }
  620. nv04_graph_set_ctx1(chan, 0x01000000, valid << 24);
  621. }
  622. static int
  623. nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass,
  624. int mthd, uint32_t data)
  625. {
  626. if (data > 5)
  627. return 1;
  628. /* Old versions of the objects only accept first three operations. */
  629. if (data > 2 && grclass < 0x40)
  630. return 1;
  631. nv04_graph_set_ctx1(chan, 0x00038000, data << 15);
  632. /* changing operation changes set of objects needed for validation */
  633. nv04_graph_set_ctx_val(chan, 0, 0);
  634. return 0;
  635. }
  636. static int
  637. nv04_graph_mthd_surf3d_clip_h(struct nouveau_channel *chan, int grclass,
  638. int mthd, uint32_t data)
  639. {
  640. uint32_t min = data & 0xffff, max;
  641. uint32_t w = data >> 16;
  642. if (min & 0x8000)
  643. /* too large */
  644. return 1;
  645. if (w & 0x8000)
  646. /* yes, it accepts negative for some reason. */
  647. w |= 0xffff0000;
  648. max = min + w;
  649. max &= 0x3ffff;
  650. nv_wr32(chan->dev, 0x40053c, min);
  651. nv_wr32(chan->dev, 0x400544, max);
  652. return 0;
  653. }
  654. static int
  655. nv04_graph_mthd_surf3d_clip_v(struct nouveau_channel *chan, int grclass,
  656. int mthd, uint32_t data)
  657. {
  658. uint32_t min = data & 0xffff, max;
  659. uint32_t w = data >> 16;
  660. if (min & 0x8000)
  661. /* too large */
  662. return 1;
  663. if (w & 0x8000)
  664. /* yes, it accepts negative for some reason. */
  665. w |= 0xffff0000;
  666. max = min + w;
  667. max &= 0x3ffff;
  668. nv_wr32(chan->dev, 0x400540, min);
  669. nv_wr32(chan->dev, 0x400548, max);
  670. return 0;
  671. }
  672. static int
  673. nv04_graph_mthd_bind_surf2d(struct nouveau_channel *chan, int grclass,
  674. int mthd, uint32_t data)
  675. {
  676. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  677. case 0x30:
  678. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  679. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  680. return 0;
  681. case 0x42:
  682. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  683. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  684. return 0;
  685. }
  686. return 1;
  687. }
  688. static int
  689. nv04_graph_mthd_bind_surf2d_swzsurf(struct nouveau_channel *chan, int grclass,
  690. int mthd, uint32_t data)
  691. {
  692. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  693. case 0x30:
  694. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  695. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  696. return 0;
  697. case 0x42:
  698. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  699. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  700. return 0;
  701. case 0x52:
  702. nv04_graph_set_ctx1(chan, 0x00004000, 0x00004000);
  703. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  704. return 0;
  705. }
  706. return 1;
  707. }
  708. static int
  709. nv04_graph_mthd_bind_nv01_patt(struct nouveau_channel *chan, int grclass,
  710. int mthd, uint32_t data)
  711. {
  712. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  713. case 0x30:
  714. nv04_graph_set_ctx_val(chan, 0x08000000, 0);
  715. return 0;
  716. case 0x18:
  717. nv04_graph_set_ctx_val(chan, 0x08000000, 0x08000000);
  718. return 0;
  719. }
  720. return 1;
  721. }
  722. static int
  723. nv04_graph_mthd_bind_nv04_patt(struct nouveau_channel *chan, int grclass,
  724. int mthd, uint32_t data)
  725. {
  726. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  727. case 0x30:
  728. nv04_graph_set_ctx_val(chan, 0x08000000, 0);
  729. return 0;
  730. case 0x44:
  731. nv04_graph_set_ctx_val(chan, 0x08000000, 0x08000000);
  732. return 0;
  733. }
  734. return 1;
  735. }
  736. static int
  737. nv04_graph_mthd_bind_rop(struct nouveau_channel *chan, int grclass,
  738. int mthd, uint32_t data)
  739. {
  740. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  741. case 0x30:
  742. nv04_graph_set_ctx_val(chan, 0x10000000, 0);
  743. return 0;
  744. case 0x43:
  745. nv04_graph_set_ctx_val(chan, 0x10000000, 0x10000000);
  746. return 0;
  747. }
  748. return 1;
  749. }
  750. static int
  751. nv04_graph_mthd_bind_beta1(struct nouveau_channel *chan, int grclass,
  752. int mthd, uint32_t data)
  753. {
  754. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  755. case 0x30:
  756. nv04_graph_set_ctx_val(chan, 0x20000000, 0);
  757. return 0;
  758. case 0x12:
  759. nv04_graph_set_ctx_val(chan, 0x20000000, 0x20000000);
  760. return 0;
  761. }
  762. return 1;
  763. }
  764. static int
  765. nv04_graph_mthd_bind_beta4(struct nouveau_channel *chan, int grclass,
  766. int mthd, uint32_t data)
  767. {
  768. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  769. case 0x30:
  770. nv04_graph_set_ctx_val(chan, 0x40000000, 0);
  771. return 0;
  772. case 0x72:
  773. nv04_graph_set_ctx_val(chan, 0x40000000, 0x40000000);
  774. return 0;
  775. }
  776. return 1;
  777. }
  778. static int
  779. nv04_graph_mthd_bind_surf_dst(struct nouveau_channel *chan, int grclass,
  780. int mthd, uint32_t data)
  781. {
  782. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  783. case 0x30:
  784. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  785. return 0;
  786. case 0x58:
  787. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  788. return 0;
  789. }
  790. return 1;
  791. }
  792. static int
  793. nv04_graph_mthd_bind_surf_src(struct nouveau_channel *chan, int grclass,
  794. int mthd, uint32_t data)
  795. {
  796. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  797. case 0x30:
  798. nv04_graph_set_ctx_val(chan, 0x04000000, 0);
  799. return 0;
  800. case 0x59:
  801. nv04_graph_set_ctx_val(chan, 0x04000000, 0x04000000);
  802. return 0;
  803. }
  804. return 1;
  805. }
  806. static int
  807. nv04_graph_mthd_bind_surf_color(struct nouveau_channel *chan, int grclass,
  808. int mthd, uint32_t data)
  809. {
  810. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  811. case 0x30:
  812. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  813. return 0;
  814. case 0x5a:
  815. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  816. return 0;
  817. }
  818. return 1;
  819. }
  820. static int
  821. nv04_graph_mthd_bind_surf_zeta(struct nouveau_channel *chan, int grclass,
  822. int mthd, uint32_t data)
  823. {
  824. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  825. case 0x30:
  826. nv04_graph_set_ctx_val(chan, 0x04000000, 0);
  827. return 0;
  828. case 0x5b:
  829. nv04_graph_set_ctx_val(chan, 0x04000000, 0x04000000);
  830. return 0;
  831. }
  832. return 1;
  833. }
  834. static int
  835. nv04_graph_mthd_bind_clip(struct nouveau_channel *chan, int grclass,
  836. int mthd, uint32_t data)
  837. {
  838. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  839. case 0x30:
  840. nv04_graph_set_ctx1(chan, 0x2000, 0);
  841. return 0;
  842. case 0x19:
  843. nv04_graph_set_ctx1(chan, 0x2000, 0x2000);
  844. return 0;
  845. }
  846. return 1;
  847. }
  848. static int
  849. nv04_graph_mthd_bind_chroma(struct nouveau_channel *chan, int grclass,
  850. int mthd, uint32_t data)
  851. {
  852. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  853. case 0x30:
  854. nv04_graph_set_ctx1(chan, 0x1000, 0);
  855. return 0;
  856. /* Yes, for some reason even the old versions of objects
  857. * accept 0x57 and not 0x17. Consistency be damned.
  858. */
  859. case 0x57:
  860. nv04_graph_set_ctx1(chan, 0x1000, 0x1000);
  861. return 0;
  862. }
  863. return 1;
  864. }
  865. static struct nouveau_pgraph_object_method nv04_graph_mthds_sw[] = {
  866. { 0x0150, nv04_graph_mthd_set_ref },
  867. {}
  868. };
  869. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_gdirect[] = {
  870. { 0x0184, nv04_graph_mthd_bind_nv01_patt },
  871. { 0x0188, nv04_graph_mthd_bind_rop },
  872. { 0x018c, nv04_graph_mthd_bind_beta1 },
  873. { 0x0190, nv04_graph_mthd_bind_surf_dst },
  874. { 0x02fc, nv04_graph_mthd_set_operation },
  875. {},
  876. };
  877. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_gdirect[] = {
  878. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  879. { 0x018c, nv04_graph_mthd_bind_rop },
  880. { 0x0190, nv04_graph_mthd_bind_beta1 },
  881. { 0x0194, nv04_graph_mthd_bind_beta4 },
  882. { 0x0198, nv04_graph_mthd_bind_surf2d },
  883. { 0x02fc, nv04_graph_mthd_set_operation },
  884. {},
  885. };
  886. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_imageblit[] = {
  887. { 0x0184, nv04_graph_mthd_bind_chroma },
  888. { 0x0188, nv04_graph_mthd_bind_clip },
  889. { 0x018c, nv04_graph_mthd_bind_nv01_patt },
  890. { 0x0190, nv04_graph_mthd_bind_rop },
  891. { 0x0194, nv04_graph_mthd_bind_beta1 },
  892. { 0x0198, nv04_graph_mthd_bind_surf_dst },
  893. { 0x019c, nv04_graph_mthd_bind_surf_src },
  894. { 0x02fc, nv04_graph_mthd_set_operation },
  895. {},
  896. };
  897. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_imageblit_ifc[] = {
  898. { 0x0184, nv04_graph_mthd_bind_chroma },
  899. { 0x0188, nv04_graph_mthd_bind_clip },
  900. { 0x018c, nv04_graph_mthd_bind_nv04_patt },
  901. { 0x0190, nv04_graph_mthd_bind_rop },
  902. { 0x0194, nv04_graph_mthd_bind_beta1 },
  903. { 0x0198, nv04_graph_mthd_bind_beta4 },
  904. { 0x019c, nv04_graph_mthd_bind_surf2d },
  905. { 0x02fc, nv04_graph_mthd_set_operation },
  906. {},
  907. };
  908. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_iifc[] = {
  909. { 0x0188, nv04_graph_mthd_bind_chroma },
  910. { 0x018c, nv04_graph_mthd_bind_clip },
  911. { 0x0190, nv04_graph_mthd_bind_nv04_patt },
  912. { 0x0194, nv04_graph_mthd_bind_rop },
  913. { 0x0198, nv04_graph_mthd_bind_beta1 },
  914. { 0x019c, nv04_graph_mthd_bind_beta4 },
  915. { 0x01a0, nv04_graph_mthd_bind_surf2d_swzsurf },
  916. { 0x03e4, nv04_graph_mthd_set_operation },
  917. {},
  918. };
  919. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_ifc[] = {
  920. { 0x0184, nv04_graph_mthd_bind_chroma },
  921. { 0x0188, nv04_graph_mthd_bind_clip },
  922. { 0x018c, nv04_graph_mthd_bind_nv01_patt },
  923. { 0x0190, nv04_graph_mthd_bind_rop },
  924. { 0x0194, nv04_graph_mthd_bind_beta1 },
  925. { 0x0198, nv04_graph_mthd_bind_surf_dst },
  926. { 0x02fc, nv04_graph_mthd_set_operation },
  927. {},
  928. };
  929. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_sifc[] = {
  930. { 0x0184, nv04_graph_mthd_bind_chroma },
  931. { 0x0188, nv04_graph_mthd_bind_nv01_patt },
  932. { 0x018c, nv04_graph_mthd_bind_rop },
  933. { 0x0190, nv04_graph_mthd_bind_beta1 },
  934. { 0x0194, nv04_graph_mthd_bind_surf_dst },
  935. { 0x02fc, nv04_graph_mthd_set_operation },
  936. {},
  937. };
  938. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_sifc[] = {
  939. { 0x0184, nv04_graph_mthd_bind_chroma },
  940. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  941. { 0x018c, nv04_graph_mthd_bind_rop },
  942. { 0x0190, nv04_graph_mthd_bind_beta1 },
  943. { 0x0194, nv04_graph_mthd_bind_beta4 },
  944. { 0x0198, nv04_graph_mthd_bind_surf2d },
  945. { 0x02fc, nv04_graph_mthd_set_operation },
  946. {},
  947. };
  948. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_sifm[] = {
  949. { 0x0188, nv04_graph_mthd_bind_nv01_patt },
  950. { 0x018c, nv04_graph_mthd_bind_rop },
  951. { 0x0190, nv04_graph_mthd_bind_beta1 },
  952. { 0x0194, nv04_graph_mthd_bind_surf_dst },
  953. { 0x0304, nv04_graph_mthd_set_operation },
  954. {},
  955. };
  956. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_sifm[] = {
  957. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  958. { 0x018c, nv04_graph_mthd_bind_rop },
  959. { 0x0190, nv04_graph_mthd_bind_beta1 },
  960. { 0x0194, nv04_graph_mthd_bind_beta4 },
  961. { 0x0198, nv04_graph_mthd_bind_surf2d_swzsurf },
  962. { 0x0304, nv04_graph_mthd_set_operation },
  963. {},
  964. };
  965. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_shape[] = {
  966. { 0x0184, nv04_graph_mthd_bind_clip },
  967. { 0x0188, nv04_graph_mthd_bind_nv01_patt },
  968. { 0x018c, nv04_graph_mthd_bind_rop },
  969. { 0x0190, nv04_graph_mthd_bind_beta1 },
  970. { 0x0194, nv04_graph_mthd_bind_surf_dst },
  971. { 0x02fc, nv04_graph_mthd_set_operation },
  972. {},
  973. };
  974. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_shape[] = {
  975. { 0x0184, nv04_graph_mthd_bind_clip },
  976. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  977. { 0x018c, nv04_graph_mthd_bind_rop },
  978. { 0x0190, nv04_graph_mthd_bind_beta1 },
  979. { 0x0194, nv04_graph_mthd_bind_beta4 },
  980. { 0x0198, nv04_graph_mthd_bind_surf2d },
  981. { 0x02fc, nv04_graph_mthd_set_operation },
  982. {},
  983. };
  984. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_tex_tri[] = {
  985. { 0x0188, nv04_graph_mthd_bind_clip },
  986. { 0x018c, nv04_graph_mthd_bind_surf_color },
  987. { 0x0190, nv04_graph_mthd_bind_surf_zeta },
  988. {},
  989. };
  990. static struct nouveau_pgraph_object_method nv04_graph_mthds_surf3d[] = {
  991. { 0x02f8, nv04_graph_mthd_surf3d_clip_h },
  992. { 0x02fc, nv04_graph_mthd_surf3d_clip_v },
  993. {},
  994. };
  995. struct nouveau_pgraph_object_class nv04_graph_grclass[] = {
  996. { 0x0038, false, NULL }, /* dvd subpicture */
  997. { 0x0039, false, NULL }, /* m2mf */
  998. { 0x004b, false, nv04_graph_mthds_nv03_gdirect }, /* nv03 gdirect */
  999. { 0x004a, false, nv04_graph_mthds_nv04_gdirect }, /* nv04 gdirect */
  1000. { 0x001f, false, nv04_graph_mthds_nv01_imageblit }, /* nv01 imageblit */
  1001. { 0x005f, false, nv04_graph_mthds_nv04_imageblit_ifc }, /* nv04 imageblit */
  1002. { 0x0060, false, nv04_graph_mthds_nv04_iifc }, /* nv04 iifc */
  1003. { 0x0064, false, NULL }, /* nv05 iifc */
  1004. { 0x0021, false, nv04_graph_mthds_nv01_ifc }, /* nv01 ifc */
  1005. { 0x0061, false, nv04_graph_mthds_nv04_imageblit_ifc }, /* nv04 ifc */
  1006. { 0x0065, false, NULL }, /* nv05 ifc */
  1007. { 0x0036, false, nv04_graph_mthds_nv03_sifc }, /* nv03 sifc */
  1008. { 0x0076, false, nv04_graph_mthds_nv04_sifc }, /* nv04 sifc */
  1009. { 0x0066, false, NULL }, /* nv05 sifc */
  1010. { 0x0037, false, nv04_graph_mthds_nv03_sifm }, /* nv03 sifm */
  1011. { 0x0077, false, nv04_graph_mthds_nv04_sifm }, /* nv04 sifm */
  1012. { 0x0030, false, NULL }, /* null */
  1013. { 0x0042, false, NULL }, /* surf2d */
  1014. { 0x0043, false, NULL }, /* rop */
  1015. { 0x0012, false, NULL }, /* beta1 */
  1016. { 0x0072, false, NULL }, /* beta4 */
  1017. { 0x0019, false, NULL }, /* cliprect */
  1018. { 0x0018, false, NULL }, /* nv01 pattern */
  1019. { 0x0044, false, NULL }, /* nv04 pattern */
  1020. { 0x0052, false, NULL }, /* swzsurf */
  1021. { 0x0053, false, nv04_graph_mthds_surf3d }, /* surf3d */
  1022. { 0x0048, false, nv04_graph_mthds_nv03_tex_tri }, /* nv03 tex_tri */
  1023. { 0x0054, false, NULL }, /* tex_tri */
  1024. { 0x0055, false, NULL }, /* multitex_tri */
  1025. { 0x0017, false, NULL }, /* nv01 chroma */
  1026. { 0x0057, false, NULL }, /* nv04 chroma */
  1027. { 0x0058, false, NULL }, /* surf_dst */
  1028. { 0x0059, false, NULL }, /* surf_src */
  1029. { 0x005a, false, NULL }, /* surf_color */
  1030. { 0x005b, false, NULL }, /* surf_zeta */
  1031. { 0x001c, false, nv04_graph_mthds_nv01_shape }, /* nv01 line */
  1032. { 0x005c, false, nv04_graph_mthds_nv04_shape }, /* nv04 line */
  1033. { 0x001d, false, nv04_graph_mthds_nv01_shape }, /* nv01 tri */
  1034. { 0x005d, false, nv04_graph_mthds_nv04_shape }, /* nv04 tri */
  1035. { 0x001e, false, nv04_graph_mthds_nv01_shape }, /* nv01 rect */
  1036. { 0x005e, false, nv04_graph_mthds_nv04_shape }, /* nv04 rect */
  1037. { 0x506e, true, nv04_graph_mthds_sw },
  1038. {}
  1039. };