ffb_drv.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. /* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $
  2. * ffb_drv.h: Creator/Creator3D direct rendering driver.
  3. *
  4. * Copyright (C) 2000 David S. Miller (davem@redhat.com)
  5. */
  6. /* Auxilliary clips. */
  7. typedef struct {
  8. volatile unsigned int min;
  9. volatile unsigned int max;
  10. } ffb_auxclip, *ffb_auxclipPtr;
  11. /* FFB register set. */
  12. typedef struct _ffb_fbc {
  13. /* Next vertex registers, on the right we list which drawops
  14. * use said register and the logical name the register has in
  15. * that context.
  16. *//* DESCRIPTION DRAWOP(NAME) */
  17. /*0x00*/ unsigned int pad1[3];
  18. /* Reserved */
  19. /*0x0c*/ volatile unsigned int alpha;
  20. /* ALPHA Transparency */
  21. /*0x10*/ volatile unsigned int red;
  22. /* RED */
  23. /*0x14*/ volatile unsigned int green;
  24. /* GREEN */
  25. /*0x18*/ volatile unsigned int blue;
  26. /* BLUE */
  27. /*0x1c*/ volatile unsigned int z;
  28. /* DEPTH */
  29. /*0x20*/ volatile unsigned int y;
  30. /* Y triangle(DOYF) */
  31. /* aadot(DYF) */
  32. /* ddline(DYF) */
  33. /* aaline(DYF) */
  34. /*0x24*/ volatile unsigned int x;
  35. /* X triangle(DOXF) */
  36. /* aadot(DXF) */
  37. /* ddline(DXF) */
  38. /* aaline(DXF) */
  39. /*0x28*/ unsigned int pad2[2];
  40. /* Reserved */
  41. /*0x30*/ volatile unsigned int ryf;
  42. /* Y (alias to DOYF) ddline(RYF) */
  43. /* aaline(RYF) */
  44. /* triangle(RYF) */
  45. /*0x34*/ volatile unsigned int rxf;
  46. /* X ddline(RXF) */
  47. /* aaline(RXF) */
  48. /* triangle(RXF) */
  49. /*0x38*/ unsigned int pad3[2];
  50. /* Reserved */
  51. /*0x40*/ volatile unsigned int dmyf;
  52. /* Y (alias to DOYF) triangle(DMYF) */
  53. /*0x44*/ volatile unsigned int dmxf;
  54. /* X triangle(DMXF) */
  55. /*0x48*/ unsigned int pad4[2];
  56. /* Reserved */
  57. /*0x50*/ volatile unsigned int ebyi;
  58. /* Y (alias to RYI) polygon(EBYI) */
  59. /*0x54*/ volatile unsigned int ebxi;
  60. /* X polygon(EBXI) */
  61. /*0x58*/ unsigned int pad5[2];
  62. /* Reserved */
  63. /*0x60*/ volatile unsigned int by;
  64. /* Y brline(RYI) */
  65. /* fastfill(OP) */
  66. /* polygon(YI) */
  67. /* rectangle(YI) */
  68. /* bcopy(SRCY) */
  69. /* vscroll(SRCY) */
  70. /*0x64*/ volatile unsigned int bx;
  71. /* X brline(RXI) */
  72. /* polygon(XI) */
  73. /* rectangle(XI) */
  74. /* bcopy(SRCX) */
  75. /* vscroll(SRCX) */
  76. /* fastfill(GO) */
  77. /*0x68*/ volatile unsigned int dy;
  78. /* destination Y fastfill(DSTY) */
  79. /* bcopy(DSRY) */
  80. /* vscroll(DSRY) */
  81. /*0x6c*/ volatile unsigned int dx;
  82. /* destination X fastfill(DSTX) */
  83. /* bcopy(DSTX) */
  84. /* vscroll(DSTX) */
  85. /*0x70*/ volatile unsigned int bh;
  86. /* Y (alias to RYI) brline(DYI) */
  87. /* dot(DYI) */
  88. /* polygon(ETYI) */
  89. /* Height fastfill(H) */
  90. /* bcopy(H) */
  91. /* vscroll(H) */
  92. /* Y count fastfill(NY) */
  93. /*0x74*/ volatile unsigned int bw;
  94. /* X dot(DXI) */
  95. /* brline(DXI) */
  96. /* polygon(ETXI) */
  97. /* fastfill(W) */
  98. /* bcopy(W) */
  99. /* vscroll(W) */
  100. /* fastfill(NX) */
  101. /*0x78*/ unsigned int pad6[2];
  102. /* Reserved */
  103. /*0x80*/ unsigned int pad7[32];
  104. /* Reserved */
  105. /* Setup Unit's vertex state register */
  106. /*100*/ volatile unsigned int suvtx;
  107. /*104*/ unsigned int pad8[63];
  108. /* Reserved */
  109. /* Frame Buffer Control Registers */
  110. /*200*/ volatile unsigned int ppc;
  111. /* Pixel Processor Control */
  112. /*204*/ volatile unsigned int wid;
  113. /* Current WID */
  114. /*208*/ volatile unsigned int fg;
  115. /* FG data */
  116. /*20c*/ volatile unsigned int bg;
  117. /* BG data */
  118. /*210*/ volatile unsigned int consty;
  119. /* Constant Y */
  120. /*214*/ volatile unsigned int constz;
  121. /* Constant Z */
  122. /*218*/ volatile unsigned int xclip;
  123. /* X Clip */
  124. /*21c*/ volatile unsigned int dcss;
  125. /* Depth Cue Scale Slope */
  126. /*220*/ volatile unsigned int vclipmin;
  127. /* Viewclip XY Min Bounds */
  128. /*224*/ volatile unsigned int vclipmax;
  129. /* Viewclip XY Max Bounds */
  130. /*228*/ volatile unsigned int vclipzmin;
  131. /* Viewclip Z Min Bounds */
  132. /*22c*/ volatile unsigned int vclipzmax;
  133. /* Viewclip Z Max Bounds */
  134. /*230*/ volatile unsigned int dcsf;
  135. /* Depth Cue Scale Front Bound */
  136. /*234*/ volatile unsigned int dcsb;
  137. /* Depth Cue Scale Back Bound */
  138. /*238*/ volatile unsigned int dczf;
  139. /* Depth Cue Z Front */
  140. /*23c*/ volatile unsigned int dczb;
  141. /* Depth Cue Z Back */
  142. /*240*/ unsigned int pad9;
  143. /* Reserved */
  144. /*244*/ volatile unsigned int blendc;
  145. /* Alpha Blend Control */
  146. /*248*/ volatile unsigned int blendc1;
  147. /* Alpha Blend Color 1 */
  148. /*24c*/ volatile unsigned int blendc2;
  149. /* Alpha Blend Color 2 */
  150. /*250*/ volatile unsigned int fbramitc;
  151. /* FB RAM Interleave Test Control */
  152. /*254*/ volatile unsigned int fbc;
  153. /* Frame Buffer Control */
  154. /*258*/ volatile unsigned int rop;
  155. /* Raster OPeration */
  156. /*25c*/ volatile unsigned int cmp;
  157. /* Frame Buffer Compare */
  158. /*260*/ volatile unsigned int matchab;
  159. /* Buffer AB Match Mask */
  160. /*264*/ volatile unsigned int matchc;
  161. /* Buffer C(YZ) Match Mask */
  162. /*268*/ volatile unsigned int magnab;
  163. /* Buffer AB Magnitude Mask */
  164. /*26c*/ volatile unsigned int magnc;
  165. /* Buffer C(YZ) Magnitude Mask */
  166. /*270*/ volatile unsigned int fbcfg0;
  167. /* Frame Buffer Config 0 */
  168. /*274*/ volatile unsigned int fbcfg1;
  169. /* Frame Buffer Config 1 */
  170. /*278*/ volatile unsigned int fbcfg2;
  171. /* Frame Buffer Config 2 */
  172. /*27c*/ volatile unsigned int fbcfg3;
  173. /* Frame Buffer Config 3 */
  174. /*280*/ volatile unsigned int ppcfg;
  175. /* Pixel Processor Config */
  176. /*284*/ volatile unsigned int pick;
  177. /* Picking Control */
  178. /*288*/ volatile unsigned int fillmode;
  179. /* FillMode */
  180. /*28c*/ volatile unsigned int fbramwac;
  181. /* FB RAM Write Address Control */
  182. /*290*/ volatile unsigned int pmask;
  183. /* RGB PlaneMask */
  184. /*294*/ volatile unsigned int xpmask;
  185. /* X PlaneMask */
  186. /*298*/ volatile unsigned int ypmask;
  187. /* Y PlaneMask */
  188. /*29c*/ volatile unsigned int zpmask;
  189. /* Z PlaneMask */
  190. /*2a0*/ ffb_auxclip auxclip[4];
  191. /* Auxilliary Viewport Clip */
  192. /* New 3dRAM III support regs */
  193. /*2c0*/ volatile unsigned int rawblend2;
  194. /*2c4*/ volatile unsigned int rawpreblend;
  195. /*2c8*/ volatile unsigned int rawstencil;
  196. /*2cc*/ volatile unsigned int rawstencilctl;
  197. /*2d0*/ volatile unsigned int threedram1;
  198. /*2d4*/ volatile unsigned int threedram2;
  199. /*2d8*/ volatile unsigned int passin;
  200. /*2dc*/ volatile unsigned int rawclrdepth;
  201. /*2e0*/ volatile unsigned int rawpmask;
  202. /*2e4*/ volatile unsigned int rawcsrc;
  203. /*2e8*/ volatile unsigned int rawmatch;
  204. /*2ec*/ volatile unsigned int rawmagn;
  205. /*2f0*/ volatile unsigned int rawropblend;
  206. /*2f4*/ volatile unsigned int rawcmp;
  207. /*2f8*/ volatile unsigned int rawwac;
  208. /*2fc*/ volatile unsigned int fbramid;
  209. /*300*/ volatile unsigned int drawop;
  210. /* Draw OPeration */
  211. /*304*/ unsigned int pad10[2];
  212. /* Reserved */
  213. /*30c*/ volatile unsigned int lpat;
  214. /* Line Pattern control */
  215. /*310*/ unsigned int pad11;
  216. /* Reserved */
  217. /*314*/ volatile unsigned int fontxy;
  218. /* XY Font coordinate */
  219. /*318*/ volatile unsigned int fontw;
  220. /* Font Width */
  221. /*31c*/ volatile unsigned int fontinc;
  222. /* Font Increment */
  223. /*320*/ volatile unsigned int font;
  224. /* Font bits */
  225. /*324*/ unsigned int pad12[3];
  226. /* Reserved */
  227. /*330*/ volatile unsigned int blend2;
  228. /*334*/ volatile unsigned int preblend;
  229. /*338*/ volatile unsigned int stencil;
  230. /*33c*/ volatile unsigned int stencilctl;
  231. /*340*/ unsigned int pad13[4];
  232. /* Reserved */
  233. /*350*/ volatile unsigned int dcss1;
  234. /* Depth Cue Scale Slope 1 */
  235. /*354*/ volatile unsigned int dcss2;
  236. /* Depth Cue Scale Slope 2 */
  237. /*358*/ volatile unsigned int dcss3;
  238. /* Depth Cue Scale Slope 3 */
  239. /*35c*/ volatile unsigned int widpmask;
  240. /*360*/ volatile unsigned int dcs2;
  241. /*364*/ volatile unsigned int dcs3;
  242. /*368*/ volatile unsigned int dcs4;
  243. /*36c*/ unsigned int pad14;
  244. /* Reserved */
  245. /*370*/ volatile unsigned int dcd2;
  246. /*374*/ volatile unsigned int dcd3;
  247. /*378*/ volatile unsigned int dcd4;
  248. /*37c*/ unsigned int pad15;
  249. /* Reserved */
  250. /*380*/ volatile unsigned int pattern[32];
  251. /* area Pattern */
  252. /*400*/ unsigned int pad16[8];
  253. /* Reserved */
  254. /*420*/ volatile unsigned int reset;
  255. /* chip RESET */
  256. /*424*/ unsigned int pad17[247];
  257. /* Reserved */
  258. /*800*/ volatile unsigned int devid;
  259. /* Device ID */
  260. /*804*/ unsigned int pad18[63];
  261. /* Reserved */
  262. /*900*/ volatile unsigned int ucsr;
  263. /* User Control & Status Register */
  264. /*904*/ unsigned int pad19[31];
  265. /* Reserved */
  266. /*980*/ volatile unsigned int mer;
  267. /* Mode Enable Register */
  268. /*984*/ unsigned int pad20[1439];
  269. /* Reserved */
  270. } ffb_fbc, *ffb_fbcPtr;
  271. struct ffb_hw_context {
  272. int is_2d_only;
  273. unsigned int ppc;
  274. unsigned int wid;
  275. unsigned int fg;
  276. unsigned int bg;
  277. unsigned int consty;
  278. unsigned int constz;
  279. unsigned int xclip;
  280. unsigned int dcss;
  281. unsigned int vclipmin;
  282. unsigned int vclipmax;
  283. unsigned int vclipzmin;
  284. unsigned int vclipzmax;
  285. unsigned int dcsf;
  286. unsigned int dcsb;
  287. unsigned int dczf;
  288. unsigned int dczb;
  289. unsigned int blendc;
  290. unsigned int blendc1;
  291. unsigned int blendc2;
  292. unsigned int fbc;
  293. unsigned int rop;
  294. unsigned int cmp;
  295. unsigned int matchab;
  296. unsigned int matchc;
  297. unsigned int magnab;
  298. unsigned int magnc;
  299. unsigned int pmask;
  300. unsigned int xpmask;
  301. unsigned int ypmask;
  302. unsigned int zpmask;
  303. unsigned int auxclip0min;
  304. unsigned int auxclip0max;
  305. unsigned int auxclip1min;
  306. unsigned int auxclip1max;
  307. unsigned int auxclip2min;
  308. unsigned int auxclip2max;
  309. unsigned int auxclip3min;
  310. unsigned int auxclip3max;
  311. unsigned int drawop;
  312. unsigned int lpat;
  313. unsigned int fontxy;
  314. unsigned int fontw;
  315. unsigned int fontinc;
  316. unsigned int area_pattern[32];
  317. unsigned int ucsr;
  318. unsigned int stencil;
  319. unsigned int stencilctl;
  320. unsigned int dcss1;
  321. unsigned int dcss2;
  322. unsigned int dcss3;
  323. unsigned int dcs2;
  324. unsigned int dcs3;
  325. unsigned int dcs4;
  326. unsigned int dcd2;
  327. unsigned int dcd3;
  328. unsigned int dcd4;
  329. unsigned int mer;
  330. };
  331. #define FFB_MAX_CTXS 32
  332. enum ffb_chip_type {
  333. ffb1_prototype = 0, /* Early pre-FCS FFB */
  334. ffb1_standard, /* First FCS FFB, 100Mhz UPA, 66MHz gclk */
  335. ffb1_speedsort, /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */
  336. ffb2_prototype, /* Early pre-FCS vertical FFB2 */
  337. ffb2_vertical, /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk,
  338. 75(SingleBuffer)/83(DoubleBuffer) MHz fclk */
  339. ffb2_vertical_plus, /* Second FCS FFB2/vertical, same timings */
  340. ffb2_horizontal, /* First FCS FFB2/horizontal, same timings as FFB2/vert */
  341. ffb2_horizontal_plus, /* Second FCS FFB2/horizontal, same timings */
  342. afb_m3, /* FCS Elite3D, 3 float chips */
  343. afb_m6 /* FCS Elite3D, 6 float chips */
  344. };
  345. typedef struct ffb_dev_priv {
  346. /* Misc software state. */
  347. int prom_node;
  348. enum ffb_chip_type ffb_type;
  349. u64 card_phys_base;
  350. struct miscdevice miscdev;
  351. /* Controller registers. */
  352. ffb_fbcPtr regs;
  353. /* Context table. */
  354. struct ffb_hw_context *hw_state[FFB_MAX_CTXS];
  355. } ffb_dev_priv_t;
  356. extern unsigned long ffb_get_unmapped_area(struct file *filp,
  357. unsigned long hint,
  358. unsigned long len,
  359. unsigned long pgoff,
  360. unsigned long flags);
  361. extern void ffb_set_context_ioctls(void);
  362. extern drm_ioctl_desc_t DRM(ioctls)[];
  363. extern int ffb_driver_context_switch(drm_device_t * dev, int old, int new);