nv04_graph.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  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. int 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. chan->fence.last_sequence_irq = data;
  489. nouveau_fence_handler(chan->dev, chan->id);
  490. return 0;
  491. }
  492. /*
  493. * Software methods, why they are needed, and how they all work:
  494. *
  495. * NV04 and NV05 keep most of the state in PGRAPH context itself, but some
  496. * 2d engine settings are kept inside the grobjs themselves. The grobjs are
  497. * 3 words long on both. grobj format on NV04 is:
  498. *
  499. * word 0:
  500. * - bits 0-7: class
  501. * - bit 12: color key active
  502. * - bit 13: clip rect active
  503. * - bit 14: if set, destination surface is swizzled and taken from buffer 5
  504. * [set by NV04_SWIZZLED_SURFACE], otherwise it's linear and taken
  505. * from buffer 0 [set by NV04_CONTEXT_SURFACES_2D or
  506. * NV03_CONTEXT_SURFACE_DST].
  507. * - bits 15-17: 2d operation [aka patch config]
  508. * - bit 24: patch valid [enables rendering using this object]
  509. * - bit 25: surf3d valid [for tex_tri and multitex_tri only]
  510. * word 1:
  511. * - bits 0-1: mono format
  512. * - bits 8-13: color format
  513. * - bits 16-31: DMA_NOTIFY instance
  514. * word 2:
  515. * - bits 0-15: DMA_A instance
  516. * - bits 16-31: DMA_B instance
  517. *
  518. * On NV05 it's:
  519. *
  520. * word 0:
  521. * - bits 0-7: class
  522. * - bit 12: color key active
  523. * - bit 13: clip rect active
  524. * - bit 14: if set, destination surface is swizzled and taken from buffer 5
  525. * [set by NV04_SWIZZLED_SURFACE], otherwise it's linear and taken
  526. * from buffer 0 [set by NV04_CONTEXT_SURFACES_2D or
  527. * NV03_CONTEXT_SURFACE_DST].
  528. * - bits 15-17: 2d operation [aka patch config]
  529. * - bits 20-22: dither mode
  530. * - bit 24: patch valid [enables rendering using this object]
  531. * - bit 25: surface_dst/surface_color/surf2d/surf3d valid
  532. * - bit 26: surface_src/surface_zeta valid
  533. * - bit 27: pattern valid
  534. * - bit 28: rop valid
  535. * - bit 29: beta1 valid
  536. * - bit 30: beta4 valid
  537. * word 1:
  538. * - bits 0-1: mono format
  539. * - bits 8-13: color format
  540. * - bits 16-31: DMA_NOTIFY instance
  541. * word 2:
  542. * - bits 0-15: DMA_A instance
  543. * - bits 16-31: DMA_B instance
  544. *
  545. * NV05 will set/unset the relevant valid bits when you poke the relevant
  546. * object-binding methods with object of the proper type, or with the NULL
  547. * type. It'll only allow rendering using the grobj if all needed objects
  548. * are bound. The needed set of objects depends on selected operation: for
  549. * example rop object is needed by ROP_AND, but not by SRCCOPY_AND.
  550. *
  551. * NV04 doesn't have these methods implemented at all, and doesn't have the
  552. * relevant bits in grobj. Instead, it'll allow rendering whenever bit 24
  553. * is set. So we have to emulate them in software, internally keeping the
  554. * same bits as NV05 does. Since grobjs are aligned to 16 bytes on nv04,
  555. * but the last word isn't actually used for anything, we abuse it for this
  556. * purpose.
  557. *
  558. * Actually, NV05 can optionally check bit 24 too, but we disable this since
  559. * there's no use for it.
  560. *
  561. * For unknown reasons, NV04 implements surf3d binding in hardware as an
  562. * exception. Also for unknown reasons, NV04 doesn't implement the clipping
  563. * methods on the surf3d object, so we have to emulate them too.
  564. */
  565. static void
  566. nv04_graph_set_ctx1(struct nouveau_channel *chan, uint32_t mask, uint32_t value)
  567. {
  568. struct drm_device *dev = chan->dev;
  569. uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4;
  570. int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7;
  571. uint32_t tmp;
  572. tmp = nv_ri32(dev, instance);
  573. tmp &= ~mask;
  574. tmp |= value;
  575. nv_wi32(dev, instance, tmp);
  576. nv_wr32(dev, NV04_PGRAPH_CTX_SWITCH1, tmp);
  577. nv_wr32(dev, NV04_PGRAPH_CTX_CACHE1 + (subc<<2), tmp);
  578. }
  579. static void
  580. nv04_graph_set_ctx_val(struct nouveau_channel *chan, uint32_t mask, uint32_t value)
  581. {
  582. struct drm_device *dev = chan->dev;
  583. uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4;
  584. uint32_t tmp, ctx1;
  585. int class, op, valid = 1;
  586. ctx1 = nv_ri32(dev, instance);
  587. class = ctx1 & 0xff;
  588. op = (ctx1 >> 15) & 7;
  589. tmp = nv_ri32(dev, instance + 0xc);
  590. tmp &= ~mask;
  591. tmp |= value;
  592. nv_wi32(dev, instance + 0xc, tmp);
  593. /* check for valid surf2d/surf_dst/surf_color */
  594. if (!(tmp & 0x02000000))
  595. valid = 0;
  596. /* check for valid surf_src/surf_zeta */
  597. if ((class == 0x1f || class == 0x48) && !(tmp & 0x04000000))
  598. valid = 0;
  599. switch (op) {
  600. /* SRCCOPY_AND, SRCCOPY: no extra objects required */
  601. case 0:
  602. case 3:
  603. break;
  604. /* ROP_AND: requires pattern and rop */
  605. case 1:
  606. if (!(tmp & 0x18000000))
  607. valid = 0;
  608. break;
  609. /* BLEND_AND: requires beta1 */
  610. case 2:
  611. if (!(tmp & 0x20000000))
  612. valid = 0;
  613. break;
  614. /* SRCCOPY_PREMULT, BLEND_PREMULT: beta4 required */
  615. case 4:
  616. case 5:
  617. if (!(tmp & 0x40000000))
  618. valid = 0;
  619. break;
  620. }
  621. nv04_graph_set_ctx1(chan, 0x01000000, valid << 24);
  622. }
  623. static int
  624. nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass,
  625. int mthd, uint32_t data)
  626. {
  627. if (data > 5)
  628. return 1;
  629. /* Old versions of the objects only accept first three operations. */
  630. if (data > 2 && grclass < 0x40)
  631. return 1;
  632. nv04_graph_set_ctx1(chan, 0x00038000, data << 15);
  633. /* changing operation changes set of objects needed for validation */
  634. nv04_graph_set_ctx_val(chan, 0, 0);
  635. return 0;
  636. }
  637. static int
  638. nv04_graph_mthd_surf3d_clip_h(struct nouveau_channel *chan, int grclass,
  639. int mthd, uint32_t data)
  640. {
  641. uint32_t min = data & 0xffff, max;
  642. uint32_t w = data >> 16;
  643. if (min & 0x8000)
  644. /* too large */
  645. return 1;
  646. if (w & 0x8000)
  647. /* yes, it accepts negative for some reason. */
  648. w |= 0xffff0000;
  649. max = min + w;
  650. max &= 0x3ffff;
  651. nv_wr32(chan->dev, 0x40053c, min);
  652. nv_wr32(chan->dev, 0x400544, max);
  653. return 0;
  654. }
  655. static int
  656. nv04_graph_mthd_surf3d_clip_v(struct nouveau_channel *chan, int grclass,
  657. int mthd, uint32_t data)
  658. {
  659. uint32_t min = data & 0xffff, max;
  660. uint32_t w = data >> 16;
  661. if (min & 0x8000)
  662. /* too large */
  663. return 1;
  664. if (w & 0x8000)
  665. /* yes, it accepts negative for some reason. */
  666. w |= 0xffff0000;
  667. max = min + w;
  668. max &= 0x3ffff;
  669. nv_wr32(chan->dev, 0x400540, min);
  670. nv_wr32(chan->dev, 0x400548, max);
  671. return 0;
  672. }
  673. static int
  674. nv04_graph_mthd_bind_surf2d(struct nouveau_channel *chan, int grclass,
  675. int mthd, uint32_t data)
  676. {
  677. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  678. case 0x30:
  679. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  680. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  681. return 0;
  682. case 0x42:
  683. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  684. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  685. return 0;
  686. }
  687. return 1;
  688. }
  689. static int
  690. nv04_graph_mthd_bind_surf2d_swzsurf(struct nouveau_channel *chan, int grclass,
  691. int mthd, uint32_t data)
  692. {
  693. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  694. case 0x30:
  695. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  696. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  697. return 0;
  698. case 0x42:
  699. nv04_graph_set_ctx1(chan, 0x00004000, 0);
  700. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  701. return 0;
  702. case 0x52:
  703. nv04_graph_set_ctx1(chan, 0x00004000, 0x00004000);
  704. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  705. return 0;
  706. }
  707. return 1;
  708. }
  709. static int
  710. nv04_graph_mthd_bind_nv01_patt(struct nouveau_channel *chan, int grclass,
  711. int mthd, uint32_t data)
  712. {
  713. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  714. case 0x30:
  715. nv04_graph_set_ctx_val(chan, 0x08000000, 0);
  716. return 0;
  717. case 0x18:
  718. nv04_graph_set_ctx_val(chan, 0x08000000, 0x08000000);
  719. return 0;
  720. }
  721. return 1;
  722. }
  723. static int
  724. nv04_graph_mthd_bind_nv04_patt(struct nouveau_channel *chan, int grclass,
  725. int mthd, uint32_t data)
  726. {
  727. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  728. case 0x30:
  729. nv04_graph_set_ctx_val(chan, 0x08000000, 0);
  730. return 0;
  731. case 0x44:
  732. nv04_graph_set_ctx_val(chan, 0x08000000, 0x08000000);
  733. return 0;
  734. }
  735. return 1;
  736. }
  737. static int
  738. nv04_graph_mthd_bind_rop(struct nouveau_channel *chan, int grclass,
  739. int mthd, uint32_t data)
  740. {
  741. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  742. case 0x30:
  743. nv04_graph_set_ctx_val(chan, 0x10000000, 0);
  744. return 0;
  745. case 0x43:
  746. nv04_graph_set_ctx_val(chan, 0x10000000, 0x10000000);
  747. return 0;
  748. }
  749. return 1;
  750. }
  751. static int
  752. nv04_graph_mthd_bind_beta1(struct nouveau_channel *chan, int grclass,
  753. int mthd, uint32_t data)
  754. {
  755. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  756. case 0x30:
  757. nv04_graph_set_ctx_val(chan, 0x20000000, 0);
  758. return 0;
  759. case 0x12:
  760. nv04_graph_set_ctx_val(chan, 0x20000000, 0x20000000);
  761. return 0;
  762. }
  763. return 1;
  764. }
  765. static int
  766. nv04_graph_mthd_bind_beta4(struct nouveau_channel *chan, int grclass,
  767. int mthd, uint32_t data)
  768. {
  769. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  770. case 0x30:
  771. nv04_graph_set_ctx_val(chan, 0x40000000, 0);
  772. return 0;
  773. case 0x72:
  774. nv04_graph_set_ctx_val(chan, 0x40000000, 0x40000000);
  775. return 0;
  776. }
  777. return 1;
  778. }
  779. static int
  780. nv04_graph_mthd_bind_surf_dst(struct nouveau_channel *chan, int grclass,
  781. int mthd, uint32_t data)
  782. {
  783. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  784. case 0x30:
  785. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  786. return 0;
  787. case 0x58:
  788. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  789. return 0;
  790. }
  791. return 1;
  792. }
  793. static int
  794. nv04_graph_mthd_bind_surf_src(struct nouveau_channel *chan, int grclass,
  795. int mthd, uint32_t data)
  796. {
  797. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  798. case 0x30:
  799. nv04_graph_set_ctx_val(chan, 0x04000000, 0);
  800. return 0;
  801. case 0x59:
  802. nv04_graph_set_ctx_val(chan, 0x04000000, 0x04000000);
  803. return 0;
  804. }
  805. return 1;
  806. }
  807. static int
  808. nv04_graph_mthd_bind_surf_color(struct nouveau_channel *chan, int grclass,
  809. int mthd, uint32_t data)
  810. {
  811. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  812. case 0x30:
  813. nv04_graph_set_ctx_val(chan, 0x02000000, 0);
  814. return 0;
  815. case 0x5a:
  816. nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
  817. return 0;
  818. }
  819. return 1;
  820. }
  821. static int
  822. nv04_graph_mthd_bind_surf_zeta(struct nouveau_channel *chan, int grclass,
  823. int mthd, uint32_t data)
  824. {
  825. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  826. case 0x30:
  827. nv04_graph_set_ctx_val(chan, 0x04000000, 0);
  828. return 0;
  829. case 0x5b:
  830. nv04_graph_set_ctx_val(chan, 0x04000000, 0x04000000);
  831. return 0;
  832. }
  833. return 1;
  834. }
  835. static int
  836. nv04_graph_mthd_bind_clip(struct nouveau_channel *chan, int grclass,
  837. int mthd, uint32_t data)
  838. {
  839. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  840. case 0x30:
  841. nv04_graph_set_ctx1(chan, 0x2000, 0);
  842. return 0;
  843. case 0x19:
  844. nv04_graph_set_ctx1(chan, 0x2000, 0x2000);
  845. return 0;
  846. }
  847. return 1;
  848. }
  849. static int
  850. nv04_graph_mthd_bind_chroma(struct nouveau_channel *chan, int grclass,
  851. int mthd, uint32_t data)
  852. {
  853. switch (nv_ri32(chan->dev, data << 4) & 0xff) {
  854. case 0x30:
  855. nv04_graph_set_ctx1(chan, 0x1000, 0);
  856. return 0;
  857. /* Yes, for some reason even the old versions of objects
  858. * accept 0x57 and not 0x17. Consistency be damned.
  859. */
  860. case 0x57:
  861. nv04_graph_set_ctx1(chan, 0x1000, 0x1000);
  862. return 0;
  863. }
  864. return 1;
  865. }
  866. static struct nouveau_pgraph_object_method nv04_graph_mthds_sw[] = {
  867. { 0x0150, nv04_graph_mthd_set_ref },
  868. {}
  869. };
  870. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_gdirect[] = {
  871. { 0x0184, nv04_graph_mthd_bind_nv01_patt },
  872. { 0x0188, nv04_graph_mthd_bind_rop },
  873. { 0x018c, nv04_graph_mthd_bind_beta1 },
  874. { 0x0190, nv04_graph_mthd_bind_surf_dst },
  875. { 0x02fc, nv04_graph_mthd_set_operation },
  876. {},
  877. };
  878. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_gdirect[] = {
  879. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  880. { 0x018c, nv04_graph_mthd_bind_rop },
  881. { 0x0190, nv04_graph_mthd_bind_beta1 },
  882. { 0x0194, nv04_graph_mthd_bind_beta4 },
  883. { 0x0198, nv04_graph_mthd_bind_surf2d },
  884. { 0x02fc, nv04_graph_mthd_set_operation },
  885. {},
  886. };
  887. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_imageblit[] = {
  888. { 0x0184, nv04_graph_mthd_bind_chroma },
  889. { 0x0188, nv04_graph_mthd_bind_clip },
  890. { 0x018c, nv04_graph_mthd_bind_nv01_patt },
  891. { 0x0190, nv04_graph_mthd_bind_rop },
  892. { 0x0194, nv04_graph_mthd_bind_beta1 },
  893. { 0x0198, nv04_graph_mthd_bind_surf_dst },
  894. { 0x019c, nv04_graph_mthd_bind_surf_src },
  895. { 0x02fc, nv04_graph_mthd_set_operation },
  896. {},
  897. };
  898. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_imageblit_ifc[] = {
  899. { 0x0184, nv04_graph_mthd_bind_chroma },
  900. { 0x0188, nv04_graph_mthd_bind_clip },
  901. { 0x018c, nv04_graph_mthd_bind_nv04_patt },
  902. { 0x0190, nv04_graph_mthd_bind_rop },
  903. { 0x0194, nv04_graph_mthd_bind_beta1 },
  904. { 0x0198, nv04_graph_mthd_bind_beta4 },
  905. { 0x019c, nv04_graph_mthd_bind_surf2d },
  906. { 0x02fc, nv04_graph_mthd_set_operation },
  907. {},
  908. };
  909. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_iifc[] = {
  910. { 0x0188, nv04_graph_mthd_bind_chroma },
  911. { 0x018c, nv04_graph_mthd_bind_clip },
  912. { 0x0190, nv04_graph_mthd_bind_nv04_patt },
  913. { 0x0194, nv04_graph_mthd_bind_rop },
  914. { 0x0198, nv04_graph_mthd_bind_beta1 },
  915. { 0x019c, nv04_graph_mthd_bind_beta4 },
  916. { 0x01a0, nv04_graph_mthd_bind_surf2d_swzsurf },
  917. { 0x03e4, nv04_graph_mthd_set_operation },
  918. {},
  919. };
  920. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_ifc[] = {
  921. { 0x0184, nv04_graph_mthd_bind_chroma },
  922. { 0x0188, nv04_graph_mthd_bind_clip },
  923. { 0x018c, nv04_graph_mthd_bind_nv01_patt },
  924. { 0x0190, nv04_graph_mthd_bind_rop },
  925. { 0x0194, nv04_graph_mthd_bind_beta1 },
  926. { 0x0198, nv04_graph_mthd_bind_surf_dst },
  927. { 0x02fc, nv04_graph_mthd_set_operation },
  928. {},
  929. };
  930. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_sifc[] = {
  931. { 0x0184, nv04_graph_mthd_bind_chroma },
  932. { 0x0188, nv04_graph_mthd_bind_nv01_patt },
  933. { 0x018c, nv04_graph_mthd_bind_rop },
  934. { 0x0190, nv04_graph_mthd_bind_beta1 },
  935. { 0x0194, nv04_graph_mthd_bind_surf_dst },
  936. { 0x02fc, nv04_graph_mthd_set_operation },
  937. {},
  938. };
  939. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_sifc[] = {
  940. { 0x0184, nv04_graph_mthd_bind_chroma },
  941. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  942. { 0x018c, nv04_graph_mthd_bind_rop },
  943. { 0x0190, nv04_graph_mthd_bind_beta1 },
  944. { 0x0194, nv04_graph_mthd_bind_beta4 },
  945. { 0x0198, nv04_graph_mthd_bind_surf2d },
  946. { 0x02fc, nv04_graph_mthd_set_operation },
  947. {},
  948. };
  949. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_sifm[] = {
  950. { 0x0188, nv04_graph_mthd_bind_nv01_patt },
  951. { 0x018c, nv04_graph_mthd_bind_rop },
  952. { 0x0190, nv04_graph_mthd_bind_beta1 },
  953. { 0x0194, nv04_graph_mthd_bind_surf_dst },
  954. { 0x0304, nv04_graph_mthd_set_operation },
  955. {},
  956. };
  957. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_sifm[] = {
  958. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  959. { 0x018c, nv04_graph_mthd_bind_rop },
  960. { 0x0190, nv04_graph_mthd_bind_beta1 },
  961. { 0x0194, nv04_graph_mthd_bind_beta4 },
  962. { 0x0198, nv04_graph_mthd_bind_surf2d_swzsurf },
  963. { 0x0304, nv04_graph_mthd_set_operation },
  964. {},
  965. };
  966. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_shape[] = {
  967. { 0x0184, nv04_graph_mthd_bind_clip },
  968. { 0x0188, nv04_graph_mthd_bind_nv01_patt },
  969. { 0x018c, nv04_graph_mthd_bind_rop },
  970. { 0x0190, nv04_graph_mthd_bind_beta1 },
  971. { 0x0194, nv04_graph_mthd_bind_surf_dst },
  972. { 0x02fc, nv04_graph_mthd_set_operation },
  973. {},
  974. };
  975. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_shape[] = {
  976. { 0x0184, nv04_graph_mthd_bind_clip },
  977. { 0x0188, nv04_graph_mthd_bind_nv04_patt },
  978. { 0x018c, nv04_graph_mthd_bind_rop },
  979. { 0x0190, nv04_graph_mthd_bind_beta1 },
  980. { 0x0194, nv04_graph_mthd_bind_beta4 },
  981. { 0x0198, nv04_graph_mthd_bind_surf2d },
  982. { 0x02fc, nv04_graph_mthd_set_operation },
  983. {},
  984. };
  985. static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_tex_tri[] = {
  986. { 0x0188, nv04_graph_mthd_bind_clip },
  987. { 0x018c, nv04_graph_mthd_bind_surf_color },
  988. { 0x0190, nv04_graph_mthd_bind_surf_zeta },
  989. {},
  990. };
  991. static struct nouveau_pgraph_object_method nv04_graph_mthds_surf3d[] = {
  992. { 0x02f8, nv04_graph_mthd_surf3d_clip_h },
  993. { 0x02fc, nv04_graph_mthd_surf3d_clip_v },
  994. {},
  995. };
  996. struct nouveau_pgraph_object_class nv04_graph_grclass[] = {
  997. { 0x0038, false, NULL }, /* dvd subpicture */
  998. { 0x0039, false, NULL }, /* m2mf */
  999. { 0x004b, false, nv04_graph_mthds_nv03_gdirect }, /* nv03 gdirect */
  1000. { 0x004a, false, nv04_graph_mthds_nv04_gdirect }, /* nv04 gdirect */
  1001. { 0x001f, false, nv04_graph_mthds_nv01_imageblit }, /* nv01 imageblit */
  1002. { 0x005f, false, nv04_graph_mthds_nv04_imageblit_ifc }, /* nv04 imageblit */
  1003. { 0x0060, false, nv04_graph_mthds_nv04_iifc }, /* nv04 iifc */
  1004. { 0x0064, false, NULL }, /* nv05 iifc */
  1005. { 0x0021, false, nv04_graph_mthds_nv01_ifc }, /* nv01 ifc */
  1006. { 0x0061, false, nv04_graph_mthds_nv04_imageblit_ifc }, /* nv04 ifc */
  1007. { 0x0065, false, NULL }, /* nv05 ifc */
  1008. { 0x0036, false, nv04_graph_mthds_nv03_sifc }, /* nv03 sifc */
  1009. { 0x0076, false, nv04_graph_mthds_nv04_sifc }, /* nv04 sifc */
  1010. { 0x0066, false, NULL }, /* nv05 sifc */
  1011. { 0x0037, false, nv04_graph_mthds_nv03_sifm }, /* nv03 sifm */
  1012. { 0x0077, false, nv04_graph_mthds_nv04_sifm }, /* nv04 sifm */
  1013. { 0x0030, false, NULL }, /* null */
  1014. { 0x0042, false, NULL }, /* surf2d */
  1015. { 0x0043, false, NULL }, /* rop */
  1016. { 0x0012, false, NULL }, /* beta1 */
  1017. { 0x0072, false, NULL }, /* beta4 */
  1018. { 0x0019, false, NULL }, /* cliprect */
  1019. { 0x0018, false, NULL }, /* nv01 pattern */
  1020. { 0x0044, false, NULL }, /* nv04 pattern */
  1021. { 0x0052, false, NULL }, /* swzsurf */
  1022. { 0x0053, false, nv04_graph_mthds_surf3d }, /* surf3d */
  1023. { 0x0048, false, nv04_graph_mthds_nv03_tex_tri }, /* nv03 tex_tri */
  1024. { 0x0054, false, NULL }, /* tex_tri */
  1025. { 0x0055, false, NULL }, /* multitex_tri */
  1026. { 0x0017, false, NULL }, /* nv01 chroma */
  1027. { 0x0057, false, NULL }, /* nv04 chroma */
  1028. { 0x0058, false, NULL }, /* surf_dst */
  1029. { 0x0059, false, NULL }, /* surf_src */
  1030. { 0x005a, false, NULL }, /* surf_color */
  1031. { 0x005b, false, NULL }, /* surf_zeta */
  1032. { 0x001c, false, nv04_graph_mthds_nv01_shape }, /* nv01 line */
  1033. { 0x005c, false, nv04_graph_mthds_nv04_shape }, /* nv04 line */
  1034. { 0x001d, false, nv04_graph_mthds_nv01_shape }, /* nv01 tri */
  1035. { 0x005d, false, nv04_graph_mthds_nv04_shape }, /* nv04 tri */
  1036. { 0x001e, false, nv04_graph_mthds_nv01_shape }, /* nv01 rect */
  1037. { 0x005e, false, nv04_graph_mthds_nv04_shape }, /* nv04 rect */
  1038. { 0x506e, true, nv04_graph_mthds_sw },
  1039. {}
  1040. };