1 /* 2 * Copyright 2009 Marcin Kościelnicki 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 #define CP_FLAG_CLEAR 0 24 #define CP_FLAG_SET 1 25 #define CP_FLAG_SWAP_DIRECTION ((0 * 32) + 0) 26 #define CP_FLAG_SWAP_DIRECTION_LOAD 0 27 #define CP_FLAG_SWAP_DIRECTION_SAVE 1 28 #define CP_FLAG_UNK01 ((0 * 32) + 1) 29 #define CP_FLAG_UNK01_CLEAR 0 30 #define CP_FLAG_UNK01_SET 1 31 #define CP_FLAG_UNK03 ((0 * 32) + 3) 32 #define CP_FLAG_UNK03_CLEAR 0 33 #define CP_FLAG_UNK03_SET 1 34 #define CP_FLAG_USER_SAVE ((0 * 32) + 5) 35 #define CP_FLAG_USER_SAVE_NOT_PENDING 0 36 #define CP_FLAG_USER_SAVE_PENDING 1 37 #define CP_FLAG_USER_LOAD ((0 * 32) + 6) 38 #define CP_FLAG_USER_LOAD_NOT_PENDING 0 39 #define CP_FLAG_USER_LOAD_PENDING 1 40 #define CP_FLAG_UNK0B ((0 * 32) + 0xb) 41 #define CP_FLAG_UNK0B_CLEAR 0 42 #define CP_FLAG_UNK0B_SET 1 43 #define CP_FLAG_XFER_SWITCH ((0 * 32) + 0xe) 44 #define CP_FLAG_XFER_SWITCH_DISABLE 0 45 #define CP_FLAG_XFER_SWITCH_ENABLE 1 46 #define CP_FLAG_STATE ((0 * 32) + 0x1c) 47 #define CP_FLAG_STATE_STOPPED 0 48 #define CP_FLAG_STATE_RUNNING 1 49 #define CP_FLAG_UNK1D ((0 * 32) + 0x1d) 50 #define CP_FLAG_UNK1D_CLEAR 0 51 #define CP_FLAG_UNK1D_SET 1 52 #define CP_FLAG_UNK20 ((1 * 32) + 0) 53 #define CP_FLAG_UNK20_CLEAR 0 54 #define CP_FLAG_UNK20_SET 1 55 #define CP_FLAG_STATUS ((2 * 32) + 0) 56 #define CP_FLAG_STATUS_BUSY 0 57 #define CP_FLAG_STATUS_IDLE 1 58 #define CP_FLAG_AUTO_SAVE ((2 * 32) + 4) 59 #define CP_FLAG_AUTO_SAVE_NOT_PENDING 0 60 #define CP_FLAG_AUTO_SAVE_PENDING 1 61 #define CP_FLAG_AUTO_LOAD ((2 * 32) + 5) 62 #define CP_FLAG_AUTO_LOAD_NOT_PENDING 0 63 #define CP_FLAG_AUTO_LOAD_PENDING 1 64 #define CP_FLAG_NEWCTX ((2 * 32) + 10) 65 #define CP_FLAG_NEWCTX_BUSY 0 66 #define CP_FLAG_NEWCTX_DONE 1 67 #define CP_FLAG_XFER ((2 * 32) + 11) 68 #define CP_FLAG_XFER_IDLE 0 69 #define CP_FLAG_XFER_BUSY 1 70 #define CP_FLAG_ALWAYS ((2 * 32) + 13) 71 #define CP_FLAG_ALWAYS_FALSE 0 72 #define CP_FLAG_ALWAYS_TRUE 1 73 #define CP_FLAG_INTR ((2 * 32) + 15) 74 #define CP_FLAG_INTR_NOT_PENDING 0 75 #define CP_FLAG_INTR_PENDING 1 76 77 #define CP_CTX 0x00100000 78 #define CP_CTX_COUNT 0x000f0000 79 #define CP_CTX_COUNT_SHIFT 16 80 #define CP_CTX_REG 0x00003fff 81 #define CP_LOAD_SR 0x00200000 82 #define CP_LOAD_SR_VALUE 0x000fffff 83 #define CP_BRA 0x00400000 84 #define CP_BRA_IP 0x0001ff00 85 #define CP_BRA_IP_SHIFT 8 86 #define CP_BRA_IF_CLEAR 0x00000080 87 #define CP_BRA_FLAG 0x0000007f 88 #define CP_WAIT 0x00500000 89 #define CP_WAIT_SET 0x00000080 90 #define CP_WAIT_FLAG 0x0000007f 91 #define CP_SET 0x00700000 92 #define CP_SET_1 0x00000080 93 #define CP_SET_FLAG 0x0000007f 94 #define CP_NEWCTX 0x00600004 95 #define CP_NEXT_TO_SWAP 0x00600005 96 #define CP_SET_CONTEXT_POINTER 0x00600006 97 #define CP_SET_XFER_POINTER 0x00600007 98 #define CP_ENABLE 0x00600009 99 #define CP_END 0x0060000c 100 #define CP_NEXT_TO_CURRENT 0x0060000d 101 #define CP_DISABLE1 0x0090ffff 102 #define CP_DISABLE2 0x0091ffff 103 #define CP_XFER_1 0x008000ff 104 #define CP_XFER_2 0x008800ff 105 #define CP_SEEK_1 0x00c000ff 106 #define CP_SEEK_2 0x00c800ff 107 108 #include "ctxnv40.h" 109 110 #include <subdev/fb.h> 111 112 #define IS_NVA3F(x) (((x) > 0xa0 && (x) < 0xaa) || (x) == 0xaf) 113 #define IS_NVAAF(x) ((x) >= 0xaa && (x) <= 0xac) 114 115 /* 116 * This code deals with PGRAPH contexts on NV50 family cards. Like NV40, it's 117 * the GPU itself that does context-switching, but it needs a special 118 * microcode to do it. And it's the driver's task to supply this microcode, 119 * further known as ctxprog, as well as the initial context values, known 120 * as ctxvals. 121 * 122 * Without ctxprog, you cannot switch contexts. Not even in software, since 123 * the majority of context [xfer strands] isn't accessible directly. You're 124 * stuck with a single channel, and you also suffer all the problems resulting 125 * from missing ctxvals, since you cannot load them. 126 * 127 * Without ctxvals, you're stuck with PGRAPH's default context. It's enough to 128 * run 2d operations, but trying to utilise 3d or CUDA will just lock you up, 129 * since you don't have... some sort of needed setup. 130 * 131 * Nouveau will just disable acceleration if not given ctxprog + ctxvals, since 132 * it's too much hassle to handle no-ctxprog as a special case. 133 */ 134 135 /* 136 * How ctxprogs work. 137 * 138 * The ctxprog is written in its own kind of microcode, with very small and 139 * crappy set of available commands. You upload it to a small [512 insns] 140 * area of memory on PGRAPH, and it'll be run when PFIFO wants PGRAPH to 141 * switch channel. or when the driver explicitely requests it. Stuff visible 142 * to ctxprog consists of: PGRAPH MMIO registers, PGRAPH context strands, 143 * the per-channel context save area in VRAM [known as ctxvals or grctx], 144 * 4 flags registers, a scratch register, two grctx pointers, plus many 145 * random poorly-understood details. 146 * 147 * When ctxprog runs, it's supposed to check what operations are asked of it, 148 * save old context if requested, optionally reset PGRAPH and switch to the 149 * new channel, and load the new context. Context consists of three major 150 * parts: subset of MMIO registers and two "xfer areas". 151 */ 152 153 /* TODO: 154 * - document unimplemented bits compared to nvidia 155 * - NVAx: make a TP subroutine, use it. 156 * - use 0x4008fc instead of 0x1540? 157 */ 158 159 enum cp_label { 160 cp_check_load = 1, 161 cp_setup_auto_load, 162 cp_setup_load, 163 cp_setup_save, 164 cp_swap_state, 165 cp_prepare_exit, 166 cp_exit, 167 }; 168 169 static void nv50_gr_construct_mmio(struct nvkm_grctx *ctx); 170 static void nv50_gr_construct_xfer1(struct nvkm_grctx *ctx); 171 static void nv50_gr_construct_xfer2(struct nvkm_grctx *ctx); 172 173 /* Main function: construct the ctxprog skeleton, call the other functions. */ 174 175 static int 176 nv50_grctx_generate(struct nvkm_grctx *ctx) 177 { 178 cp_set (ctx, STATE, RUNNING); 179 cp_set (ctx, XFER_SWITCH, ENABLE); 180 /* decide whether we're loading/unloading the context */ 181 cp_bra (ctx, AUTO_SAVE, PENDING, cp_setup_save); 182 cp_bra (ctx, USER_SAVE, PENDING, cp_setup_save); 183 184 cp_name(ctx, cp_check_load); 185 cp_bra (ctx, AUTO_LOAD, PENDING, cp_setup_auto_load); 186 cp_bra (ctx, USER_LOAD, PENDING, cp_setup_load); 187 cp_bra (ctx, ALWAYS, TRUE, cp_prepare_exit); 188 189 /* setup for context load */ 190 cp_name(ctx, cp_setup_auto_load); 191 cp_out (ctx, CP_DISABLE1); 192 cp_out (ctx, CP_DISABLE2); 193 cp_out (ctx, CP_ENABLE); 194 cp_out (ctx, CP_NEXT_TO_SWAP); 195 cp_set (ctx, UNK01, SET); 196 cp_name(ctx, cp_setup_load); 197 cp_out (ctx, CP_NEWCTX); 198 cp_wait(ctx, NEWCTX, BUSY); 199 cp_set (ctx, UNK1D, CLEAR); 200 cp_set (ctx, SWAP_DIRECTION, LOAD); 201 cp_bra (ctx, UNK0B, SET, cp_prepare_exit); 202 cp_bra (ctx, ALWAYS, TRUE, cp_swap_state); 203 204 /* setup for context save */ 205 cp_name(ctx, cp_setup_save); 206 cp_set (ctx, UNK1D, SET); 207 cp_wait(ctx, STATUS, BUSY); 208 cp_wait(ctx, INTR, PENDING); 209 cp_bra (ctx, STATUS, BUSY, cp_setup_save); 210 cp_set (ctx, UNK01, SET); 211 cp_set (ctx, SWAP_DIRECTION, SAVE); 212 213 /* general PGRAPH state */ 214 cp_name(ctx, cp_swap_state); 215 cp_set (ctx, UNK03, SET); 216 cp_pos (ctx, 0x00004/4); 217 cp_ctx (ctx, 0x400828, 1); /* needed. otherwise, flickering happens. */ 218 cp_pos (ctx, 0x00100/4); 219 nv50_gr_construct_mmio(ctx); 220 nv50_gr_construct_xfer1(ctx); 221 nv50_gr_construct_xfer2(ctx); 222 223 cp_bra (ctx, SWAP_DIRECTION, SAVE, cp_check_load); 224 225 cp_set (ctx, UNK20, SET); 226 cp_set (ctx, SWAP_DIRECTION, SAVE); /* no idea why this is needed, but fixes at least one lockup. */ 227 cp_lsr (ctx, ctx->ctxvals_base); 228 cp_out (ctx, CP_SET_XFER_POINTER); 229 cp_lsr (ctx, 4); 230 cp_out (ctx, CP_SEEK_1); 231 cp_out (ctx, CP_XFER_1); 232 cp_wait(ctx, XFER, BUSY); 233 234 /* pre-exit state updates */ 235 cp_name(ctx, cp_prepare_exit); 236 cp_set (ctx, UNK01, CLEAR); 237 cp_set (ctx, UNK03, CLEAR); 238 cp_set (ctx, UNK1D, CLEAR); 239 240 cp_bra (ctx, USER_SAVE, PENDING, cp_exit); 241 cp_out (ctx, CP_NEXT_TO_CURRENT); 242 243 cp_name(ctx, cp_exit); 244 cp_set (ctx, USER_SAVE, NOT_PENDING); 245 cp_set (ctx, USER_LOAD, NOT_PENDING); 246 cp_set (ctx, XFER_SWITCH, DISABLE); 247 cp_set (ctx, STATE, STOPPED); 248 cp_out (ctx, CP_END); 249 ctx->ctxvals_pos += 0x400; /* padding... no idea why you need it */ 250 251 return 0; 252 } 253 254 void 255 nv50_grctx_fill(struct nvkm_device *device, struct nvkm_gpuobj *mem) 256 { 257 nv50_grctx_generate(&(struct nvkm_grctx) { 258 .device = device, 259 .mode = NVKM_GRCTX_VALS, 260 .data = mem, 261 }); 262 } 263 264 int 265 nv50_grctx_init(struct nvkm_device *device, u32 *size) 266 { 267 u32 *ctxprog = kmalloc(512 * 4, GFP_KERNEL), i; 268 struct nvkm_grctx ctx = { 269 .device = device, 270 .mode = NVKM_GRCTX_PROG, 271 .data = ctxprog, 272 .ctxprog_max = 512, 273 }; 274 275 if (!ctxprog) 276 return -ENOMEM; 277 nv50_grctx_generate(&ctx); 278 279 nv_wr32(device, 0x400324, 0); 280 for (i = 0; i < ctx.ctxprog_len; i++) 281 nv_wr32(device, 0x400328, ctxprog[i]); 282 *size = ctx.ctxvals_pos * 4; 283 kfree(ctxprog); 284 return 0; 285 } 286 287 /* 288 * Constructs MMIO part of ctxprog and ctxvals. Just a matter of knowing which 289 * registers to save/restore and the default values for them. 290 */ 291 292 static void 293 nv50_gr_construct_mmio_ddata(struct nvkm_grctx *ctx); 294 295 static void 296 nv50_gr_construct_mmio(struct nvkm_grctx *ctx) 297 { 298 struct nvkm_device *device = ctx->device; 299 int i, j; 300 int offset, base; 301 u32 units = nv_rd32 (ctx->device, 0x1540); 302 303 /* 0800: DISPATCH */ 304 cp_ctx(ctx, 0x400808, 7); 305 gr_def(ctx, 0x400814, 0x00000030); 306 cp_ctx(ctx, 0x400834, 0x32); 307 if (device->chipset == 0x50) { 308 gr_def(ctx, 0x400834, 0xff400040); 309 gr_def(ctx, 0x400838, 0xfff00080); 310 gr_def(ctx, 0x40083c, 0xfff70090); 311 gr_def(ctx, 0x400840, 0xffe806a8); 312 } 313 gr_def(ctx, 0x400844, 0x00000002); 314 if (IS_NVA3F(device->chipset)) 315 gr_def(ctx, 0x400894, 0x00001000); 316 gr_def(ctx, 0x4008e8, 0x00000003); 317 gr_def(ctx, 0x4008ec, 0x00001000); 318 if (device->chipset == 0x50) 319 cp_ctx(ctx, 0x400908, 0xb); 320 else if (device->chipset < 0xa0) 321 cp_ctx(ctx, 0x400908, 0xc); 322 else 323 cp_ctx(ctx, 0x400908, 0xe); 324 325 if (device->chipset >= 0xa0) 326 cp_ctx(ctx, 0x400b00, 0x1); 327 if (IS_NVA3F(device->chipset)) { 328 cp_ctx(ctx, 0x400b10, 0x1); 329 gr_def(ctx, 0x400b10, 0x0001629d); 330 cp_ctx(ctx, 0x400b20, 0x1); 331 gr_def(ctx, 0x400b20, 0x0001629d); 332 } 333 334 nv50_gr_construct_mmio_ddata(ctx); 335 336 /* 0C00: VFETCH */ 337 cp_ctx(ctx, 0x400c08, 0x2); 338 gr_def(ctx, 0x400c08, 0x0000fe0c); 339 340 /* 1000 */ 341 if (device->chipset < 0xa0) { 342 cp_ctx(ctx, 0x401008, 0x4); 343 gr_def(ctx, 0x401014, 0x00001000); 344 } else if (!IS_NVA3F(device->chipset)) { 345 cp_ctx(ctx, 0x401008, 0x5); 346 gr_def(ctx, 0x401018, 0x00001000); 347 } else { 348 cp_ctx(ctx, 0x401008, 0x5); 349 gr_def(ctx, 0x401018, 0x00004000); 350 } 351 352 /* 1400 */ 353 cp_ctx(ctx, 0x401400, 0x8); 354 cp_ctx(ctx, 0x401424, 0x3); 355 if (device->chipset == 0x50) 356 gr_def(ctx, 0x40142c, 0x0001fd87); 357 else 358 gr_def(ctx, 0x40142c, 0x00000187); 359 cp_ctx(ctx, 0x401540, 0x5); 360 gr_def(ctx, 0x401550, 0x00001018); 361 362 /* 1800: STREAMOUT */ 363 cp_ctx(ctx, 0x401814, 0x1); 364 gr_def(ctx, 0x401814, 0x000000ff); 365 if (device->chipset == 0x50) { 366 cp_ctx(ctx, 0x40181c, 0xe); 367 gr_def(ctx, 0x401850, 0x00000004); 368 } else if (device->chipset < 0xa0) { 369 cp_ctx(ctx, 0x40181c, 0xf); 370 gr_def(ctx, 0x401854, 0x00000004); 371 } else { 372 cp_ctx(ctx, 0x40181c, 0x13); 373 gr_def(ctx, 0x401864, 0x00000004); 374 } 375 376 /* 1C00 */ 377 cp_ctx(ctx, 0x401c00, 0x1); 378 switch (device->chipset) { 379 case 0x50: 380 gr_def(ctx, 0x401c00, 0x0001005f); 381 break; 382 case 0x84: 383 case 0x86: 384 case 0x94: 385 gr_def(ctx, 0x401c00, 0x044d00df); 386 break; 387 case 0x92: 388 case 0x96: 389 case 0x98: 390 case 0xa0: 391 case 0xaa: 392 case 0xac: 393 gr_def(ctx, 0x401c00, 0x042500df); 394 break; 395 case 0xa3: 396 case 0xa5: 397 case 0xa8: 398 case 0xaf: 399 gr_def(ctx, 0x401c00, 0x142500df); 400 break; 401 } 402 403 /* 2000 */ 404 405 /* 2400 */ 406 cp_ctx(ctx, 0x402400, 0x1); 407 if (device->chipset == 0x50) 408 cp_ctx(ctx, 0x402408, 0x1); 409 else 410 cp_ctx(ctx, 0x402408, 0x2); 411 gr_def(ctx, 0x402408, 0x00000600); 412 413 /* 2800: CSCHED */ 414 cp_ctx(ctx, 0x402800, 0x1); 415 if (device->chipset == 0x50) 416 gr_def(ctx, 0x402800, 0x00000006); 417 418 /* 2C00: ZCULL */ 419 cp_ctx(ctx, 0x402c08, 0x6); 420 if (device->chipset != 0x50) 421 gr_def(ctx, 0x402c14, 0x01000000); 422 gr_def(ctx, 0x402c18, 0x000000ff); 423 if (device->chipset == 0x50) 424 cp_ctx(ctx, 0x402ca0, 0x1); 425 else 426 cp_ctx(ctx, 0x402ca0, 0x2); 427 if (device->chipset < 0xa0) 428 gr_def(ctx, 0x402ca0, 0x00000400); 429 else if (!IS_NVA3F(device->chipset)) 430 gr_def(ctx, 0x402ca0, 0x00000800); 431 else 432 gr_def(ctx, 0x402ca0, 0x00000400); 433 cp_ctx(ctx, 0x402cac, 0x4); 434 435 /* 3000: ENG2D */ 436 cp_ctx(ctx, 0x403004, 0x1); 437 gr_def(ctx, 0x403004, 0x00000001); 438 439 /* 3400 */ 440 if (device->chipset >= 0xa0) { 441 cp_ctx(ctx, 0x403404, 0x1); 442 gr_def(ctx, 0x403404, 0x00000001); 443 } 444 445 /* 5000: CCACHE */ 446 cp_ctx(ctx, 0x405000, 0x1); 447 switch (device->chipset) { 448 case 0x50: 449 gr_def(ctx, 0x405000, 0x00300080); 450 break; 451 case 0x84: 452 case 0xa0: 453 case 0xa3: 454 case 0xa5: 455 case 0xa8: 456 case 0xaa: 457 case 0xac: 458 case 0xaf: 459 gr_def(ctx, 0x405000, 0x000e0080); 460 break; 461 case 0x86: 462 case 0x92: 463 case 0x94: 464 case 0x96: 465 case 0x98: 466 gr_def(ctx, 0x405000, 0x00000080); 467 break; 468 } 469 cp_ctx(ctx, 0x405014, 0x1); 470 gr_def(ctx, 0x405014, 0x00000004); 471 cp_ctx(ctx, 0x40501c, 0x1); 472 cp_ctx(ctx, 0x405024, 0x1); 473 cp_ctx(ctx, 0x40502c, 0x1); 474 475 /* 6000? */ 476 if (device->chipset == 0x50) 477 cp_ctx(ctx, 0x4063e0, 0x1); 478 479 /* 6800: M2MF */ 480 if (device->chipset < 0x90) { 481 cp_ctx(ctx, 0x406814, 0x2b); 482 gr_def(ctx, 0x406818, 0x00000f80); 483 gr_def(ctx, 0x406860, 0x007f0080); 484 gr_def(ctx, 0x40689c, 0x007f0080); 485 } else { 486 cp_ctx(ctx, 0x406814, 0x4); 487 if (device->chipset == 0x98) 488 gr_def(ctx, 0x406818, 0x00000f80); 489 else 490 gr_def(ctx, 0x406818, 0x00001f80); 491 if (IS_NVA3F(device->chipset)) 492 gr_def(ctx, 0x40681c, 0x00000030); 493 cp_ctx(ctx, 0x406830, 0x3); 494 } 495 496 /* 7000: per-ROP group state */ 497 for (i = 0; i < 8; i++) { 498 if (units & (1<<(i+16))) { 499 cp_ctx(ctx, 0x407000 + (i<<8), 3); 500 if (device->chipset == 0x50) 501 gr_def(ctx, 0x407000 + (i<<8), 0x1b74f820); 502 else if (device->chipset != 0xa5) 503 gr_def(ctx, 0x407000 + (i<<8), 0x3b74f821); 504 else 505 gr_def(ctx, 0x407000 + (i<<8), 0x7b74f821); 506 gr_def(ctx, 0x407004 + (i<<8), 0x89058001); 507 508 if (device->chipset == 0x50) { 509 cp_ctx(ctx, 0x407010 + (i<<8), 1); 510 } else if (device->chipset < 0xa0) { 511 cp_ctx(ctx, 0x407010 + (i<<8), 2); 512 gr_def(ctx, 0x407010 + (i<<8), 0x00001000); 513 gr_def(ctx, 0x407014 + (i<<8), 0x0000001f); 514 } else { 515 cp_ctx(ctx, 0x407010 + (i<<8), 3); 516 gr_def(ctx, 0x407010 + (i<<8), 0x00001000); 517 if (device->chipset != 0xa5) 518 gr_def(ctx, 0x407014 + (i<<8), 0x000000ff); 519 else 520 gr_def(ctx, 0x407014 + (i<<8), 0x000001ff); 521 } 522 523 cp_ctx(ctx, 0x407080 + (i<<8), 4); 524 if (device->chipset != 0xa5) 525 gr_def(ctx, 0x407080 + (i<<8), 0x027c10fa); 526 else 527 gr_def(ctx, 0x407080 + (i<<8), 0x827c10fa); 528 if (device->chipset == 0x50) 529 gr_def(ctx, 0x407084 + (i<<8), 0x000000c0); 530 else 531 gr_def(ctx, 0x407084 + (i<<8), 0x400000c0); 532 gr_def(ctx, 0x407088 + (i<<8), 0xb7892080); 533 534 if (device->chipset < 0xa0) 535 cp_ctx(ctx, 0x407094 + (i<<8), 1); 536 else if (!IS_NVA3F(device->chipset)) 537 cp_ctx(ctx, 0x407094 + (i<<8), 3); 538 else { 539 cp_ctx(ctx, 0x407094 + (i<<8), 4); 540 gr_def(ctx, 0x4070a0 + (i<<8), 1); 541 } 542 } 543 } 544 545 cp_ctx(ctx, 0x407c00, 0x3); 546 if (device->chipset < 0x90) 547 gr_def(ctx, 0x407c00, 0x00010040); 548 else if (device->chipset < 0xa0) 549 gr_def(ctx, 0x407c00, 0x00390040); 550 else 551 gr_def(ctx, 0x407c00, 0x003d0040); 552 gr_def(ctx, 0x407c08, 0x00000022); 553 if (device->chipset >= 0xa0) { 554 cp_ctx(ctx, 0x407c10, 0x3); 555 cp_ctx(ctx, 0x407c20, 0x1); 556 cp_ctx(ctx, 0x407c2c, 0x1); 557 } 558 559 if (device->chipset < 0xa0) { 560 cp_ctx(ctx, 0x407d00, 0x9); 561 } else { 562 cp_ctx(ctx, 0x407d00, 0x15); 563 } 564 if (device->chipset == 0x98) 565 gr_def(ctx, 0x407d08, 0x00380040); 566 else { 567 if (device->chipset < 0x90) 568 gr_def(ctx, 0x407d08, 0x00010040); 569 else if (device->chipset < 0xa0) 570 gr_def(ctx, 0x407d08, 0x00390040); 571 else { 572 if (nvkm_fb(device)->ram->type != NV_MEM_TYPE_GDDR5) 573 gr_def(ctx, 0x407d08, 0x003d0040); 574 else 575 gr_def(ctx, 0x407d08, 0x003c0040); 576 } 577 gr_def(ctx, 0x407d0c, 0x00000022); 578 } 579 580 /* 8000+: per-TP state */ 581 for (i = 0; i < 10; i++) { 582 if (units & (1<<i)) { 583 if (device->chipset < 0xa0) 584 base = 0x408000 + (i<<12); 585 else 586 base = 0x408000 + (i<<11); 587 if (device->chipset < 0xa0) 588 offset = base + 0xc00; 589 else 590 offset = base + 0x80; 591 cp_ctx(ctx, offset + 0x00, 1); 592 gr_def(ctx, offset + 0x00, 0x0000ff0a); 593 cp_ctx(ctx, offset + 0x08, 1); 594 595 /* per-MP state */ 596 for (j = 0; j < (device->chipset < 0xa0 ? 2 : 4); j++) { 597 if (!(units & (1 << (j+24)))) continue; 598 if (device->chipset < 0xa0) 599 offset = base + 0x200 + (j<<7); 600 else 601 offset = base + 0x100 + (j<<7); 602 cp_ctx(ctx, offset, 0x20); 603 gr_def(ctx, offset + 0x00, 0x01800000); 604 gr_def(ctx, offset + 0x04, 0x00160000); 605 gr_def(ctx, offset + 0x08, 0x01800000); 606 gr_def(ctx, offset + 0x18, 0x0003ffff); 607 switch (device->chipset) { 608 case 0x50: 609 gr_def(ctx, offset + 0x1c, 0x00080000); 610 break; 611 case 0x84: 612 gr_def(ctx, offset + 0x1c, 0x00880000); 613 break; 614 case 0x86: 615 gr_def(ctx, offset + 0x1c, 0x018c0000); 616 break; 617 case 0x92: 618 case 0x96: 619 case 0x98: 620 gr_def(ctx, offset + 0x1c, 0x118c0000); 621 break; 622 case 0x94: 623 gr_def(ctx, offset + 0x1c, 0x10880000); 624 break; 625 case 0xa0: 626 case 0xa5: 627 gr_def(ctx, offset + 0x1c, 0x310c0000); 628 break; 629 case 0xa3: 630 case 0xa8: 631 case 0xaa: 632 case 0xac: 633 case 0xaf: 634 gr_def(ctx, offset + 0x1c, 0x300c0000); 635 break; 636 } 637 gr_def(ctx, offset + 0x40, 0x00010401); 638 if (device->chipset == 0x50) 639 gr_def(ctx, offset + 0x48, 0x00000040); 640 else 641 gr_def(ctx, offset + 0x48, 0x00000078); 642 gr_def(ctx, offset + 0x50, 0x000000bf); 643 gr_def(ctx, offset + 0x58, 0x00001210); 644 if (device->chipset == 0x50) 645 gr_def(ctx, offset + 0x5c, 0x00000080); 646 else 647 gr_def(ctx, offset + 0x5c, 0x08000080); 648 if (device->chipset >= 0xa0) 649 gr_def(ctx, offset + 0x68, 0x0000003e); 650 } 651 652 if (device->chipset < 0xa0) 653 cp_ctx(ctx, base + 0x300, 0x4); 654 else 655 cp_ctx(ctx, base + 0x300, 0x5); 656 if (device->chipset == 0x50) 657 gr_def(ctx, base + 0x304, 0x00007070); 658 else if (device->chipset < 0xa0) 659 gr_def(ctx, base + 0x304, 0x00027070); 660 else if (!IS_NVA3F(device->chipset)) 661 gr_def(ctx, base + 0x304, 0x01127070); 662 else 663 gr_def(ctx, base + 0x304, 0x05127070); 664 665 if (device->chipset < 0xa0) 666 cp_ctx(ctx, base + 0x318, 1); 667 else 668 cp_ctx(ctx, base + 0x320, 1); 669 if (device->chipset == 0x50) 670 gr_def(ctx, base + 0x318, 0x0003ffff); 671 else if (device->chipset < 0xa0) 672 gr_def(ctx, base + 0x318, 0x03ffffff); 673 else 674 gr_def(ctx, base + 0x320, 0x07ffffff); 675 676 if (device->chipset < 0xa0) 677 cp_ctx(ctx, base + 0x324, 5); 678 else 679 cp_ctx(ctx, base + 0x328, 4); 680 681 if (device->chipset < 0xa0) { 682 cp_ctx(ctx, base + 0x340, 9); 683 offset = base + 0x340; 684 } else if (!IS_NVA3F(device->chipset)) { 685 cp_ctx(ctx, base + 0x33c, 0xb); 686 offset = base + 0x344; 687 } else { 688 cp_ctx(ctx, base + 0x33c, 0xd); 689 offset = base + 0x344; 690 } 691 gr_def(ctx, offset + 0x0, 0x00120407); 692 gr_def(ctx, offset + 0x4, 0x05091507); 693 if (device->chipset == 0x84) 694 gr_def(ctx, offset + 0x8, 0x05100202); 695 else 696 gr_def(ctx, offset + 0x8, 0x05010202); 697 gr_def(ctx, offset + 0xc, 0x00030201); 698 if (device->chipset == 0xa3) 699 cp_ctx(ctx, base + 0x36c, 1); 700 701 cp_ctx(ctx, base + 0x400, 2); 702 gr_def(ctx, base + 0x404, 0x00000040); 703 cp_ctx(ctx, base + 0x40c, 2); 704 gr_def(ctx, base + 0x40c, 0x0d0c0b0a); 705 gr_def(ctx, base + 0x410, 0x00141210); 706 707 if (device->chipset < 0xa0) 708 offset = base + 0x800; 709 else 710 offset = base + 0x500; 711 cp_ctx(ctx, offset, 6); 712 gr_def(ctx, offset + 0x0, 0x000001f0); 713 gr_def(ctx, offset + 0x4, 0x00000001); 714 gr_def(ctx, offset + 0x8, 0x00000003); 715 if (device->chipset == 0x50 || IS_NVAAF(device->chipset)) 716 gr_def(ctx, offset + 0xc, 0x00008000); 717 gr_def(ctx, offset + 0x14, 0x00039e00); 718 cp_ctx(ctx, offset + 0x1c, 2); 719 if (device->chipset == 0x50) 720 gr_def(ctx, offset + 0x1c, 0x00000040); 721 else 722 gr_def(ctx, offset + 0x1c, 0x00000100); 723 gr_def(ctx, offset + 0x20, 0x00003800); 724 725 if (device->chipset >= 0xa0) { 726 cp_ctx(ctx, base + 0x54c, 2); 727 if (!IS_NVA3F(device->chipset)) 728 gr_def(ctx, base + 0x54c, 0x003fe006); 729 else 730 gr_def(ctx, base + 0x54c, 0x003fe007); 731 gr_def(ctx, base + 0x550, 0x003fe000); 732 } 733 734 if (device->chipset < 0xa0) 735 offset = base + 0xa00; 736 else 737 offset = base + 0x680; 738 cp_ctx(ctx, offset, 1); 739 gr_def(ctx, offset, 0x00404040); 740 741 if (device->chipset < 0xa0) 742 offset = base + 0xe00; 743 else 744 offset = base + 0x700; 745 cp_ctx(ctx, offset, 2); 746 if (device->chipset < 0xa0) 747 gr_def(ctx, offset, 0x0077f005); 748 else if (device->chipset == 0xa5) 749 gr_def(ctx, offset, 0x6cf7f007); 750 else if (device->chipset == 0xa8) 751 gr_def(ctx, offset, 0x6cfff007); 752 else if (device->chipset == 0xac) 753 gr_def(ctx, offset, 0x0cfff007); 754 else 755 gr_def(ctx, offset, 0x0cf7f007); 756 if (device->chipset == 0x50) 757 gr_def(ctx, offset + 0x4, 0x00007fff); 758 else if (device->chipset < 0xa0) 759 gr_def(ctx, offset + 0x4, 0x003f7fff); 760 else 761 gr_def(ctx, offset + 0x4, 0x02bf7fff); 762 cp_ctx(ctx, offset + 0x2c, 1); 763 if (device->chipset == 0x50) { 764 cp_ctx(ctx, offset + 0x50, 9); 765 gr_def(ctx, offset + 0x54, 0x000003ff); 766 gr_def(ctx, offset + 0x58, 0x00000003); 767 gr_def(ctx, offset + 0x5c, 0x00000003); 768 gr_def(ctx, offset + 0x60, 0x000001ff); 769 gr_def(ctx, offset + 0x64, 0x0000001f); 770 gr_def(ctx, offset + 0x68, 0x0000000f); 771 gr_def(ctx, offset + 0x6c, 0x0000000f); 772 } else if (device->chipset < 0xa0) { 773 cp_ctx(ctx, offset + 0x50, 1); 774 cp_ctx(ctx, offset + 0x70, 1); 775 } else { 776 cp_ctx(ctx, offset + 0x50, 1); 777 cp_ctx(ctx, offset + 0x60, 5); 778 } 779 } 780 } 781 } 782 783 static void 784 dd_emit(struct nvkm_grctx *ctx, int num, u32 val) { 785 int i; 786 if (val && ctx->mode == NVKM_GRCTX_VALS) 787 for (i = 0; i < num; i++) 788 nv_wo32(ctx->data, 4 * (ctx->ctxvals_pos + i), val); 789 ctx->ctxvals_pos += num; 790 } 791 792 static void 793 nv50_gr_construct_mmio_ddata(struct nvkm_grctx *ctx) 794 { 795 struct nvkm_device *device = ctx->device; 796 int base, num; 797 base = ctx->ctxvals_pos; 798 799 /* tesla state */ 800 dd_emit(ctx, 1, 0); /* 00000001 UNK0F90 */ 801 dd_emit(ctx, 1, 0); /* 00000001 UNK135C */ 802 803 /* SRC_TIC state */ 804 dd_emit(ctx, 1, 0); /* 00000007 SRC_TILE_MODE_Z */ 805 dd_emit(ctx, 1, 2); /* 00000007 SRC_TILE_MODE_Y */ 806 dd_emit(ctx, 1, 1); /* 00000001 SRC_LINEAR #1 */ 807 dd_emit(ctx, 1, 0); /* 000000ff SRC_ADDRESS_HIGH */ 808 dd_emit(ctx, 1, 0); /* 00000001 SRC_SRGB */ 809 if (device->chipset >= 0x94) 810 dd_emit(ctx, 1, 0); /* 00000003 eng2d UNK0258 */ 811 dd_emit(ctx, 1, 1); /* 00000fff SRC_DEPTH */ 812 dd_emit(ctx, 1, 0x100); /* 0000ffff SRC_HEIGHT */ 813 814 /* turing state */ 815 dd_emit(ctx, 1, 0); /* 0000000f TEXTURES_LOG2 */ 816 dd_emit(ctx, 1, 0); /* 0000000f SAMPLERS_LOG2 */ 817 dd_emit(ctx, 1, 0); /* 000000ff CB_DEF_ADDRESS_HIGH */ 818 dd_emit(ctx, 1, 0); /* ffffffff CB_DEF_ADDRESS_LOW */ 819 dd_emit(ctx, 1, 0); /* ffffffff SHARED_SIZE */ 820 dd_emit(ctx, 1, 2); /* ffffffff REG_MODE */ 821 dd_emit(ctx, 1, 1); /* 0000ffff BLOCK_ALLOC_THREADS */ 822 dd_emit(ctx, 1, 1); /* 00000001 LANES32 */ 823 dd_emit(ctx, 1, 0); /* 000000ff UNK370 */ 824 dd_emit(ctx, 1, 0); /* 000000ff USER_PARAM_UNK */ 825 dd_emit(ctx, 1, 0); /* 000000ff USER_PARAM_COUNT */ 826 dd_emit(ctx, 1, 1); /* 000000ff UNK384 bits 8-15 */ 827 dd_emit(ctx, 1, 0x3fffff); /* 003fffff TIC_LIMIT */ 828 dd_emit(ctx, 1, 0x1fff); /* 000fffff TSC_LIMIT */ 829 dd_emit(ctx, 1, 0); /* 0000ffff CB_ADDR_INDEX */ 830 dd_emit(ctx, 1, 1); /* 000007ff BLOCKDIM_X */ 831 dd_emit(ctx, 1, 1); /* 000007ff BLOCKDIM_XMY */ 832 dd_emit(ctx, 1, 0); /* 00000001 BLOCKDIM_XMY_OVERFLOW */ 833 dd_emit(ctx, 1, 1); /* 0003ffff BLOCKDIM_XMYMZ */ 834 dd_emit(ctx, 1, 1); /* 000007ff BLOCKDIM_Y */ 835 dd_emit(ctx, 1, 1); /* 0000007f BLOCKDIM_Z */ 836 dd_emit(ctx, 1, 4); /* 000000ff CP_REG_ALLOC_TEMP */ 837 dd_emit(ctx, 1, 1); /* 00000001 BLOCKDIM_DIRTY */ 838 if (IS_NVA3F(device->chipset)) 839 dd_emit(ctx, 1, 0); /* 00000003 UNK03E8 */ 840 dd_emit(ctx, 1, 1); /* 0000007f BLOCK_ALLOC_HALFWARPS */ 841 dd_emit(ctx, 1, 1); /* 00000007 LOCAL_WARPS_NO_CLAMP */ 842 dd_emit(ctx, 1, 7); /* 00000007 LOCAL_WARPS_LOG_ALLOC */ 843 dd_emit(ctx, 1, 1); /* 00000007 STACK_WARPS_NO_CLAMP */ 844 dd_emit(ctx, 1, 7); /* 00000007 STACK_WARPS_LOG_ALLOC */ 845 dd_emit(ctx, 1, 1); /* 00001fff BLOCK_ALLOC_REGSLOTS_PACKED */ 846 dd_emit(ctx, 1, 1); /* 00001fff BLOCK_ALLOC_REGSLOTS_STRIDED */ 847 dd_emit(ctx, 1, 1); /* 000007ff BLOCK_ALLOC_THREADS */ 848 849 /* compat 2d state */ 850 if (device->chipset == 0x50) { 851 dd_emit(ctx, 4, 0); /* 0000ffff clip X, Y, W, H */ 852 853 dd_emit(ctx, 1, 1); /* ffffffff chroma COLOR_FORMAT */ 854 855 dd_emit(ctx, 1, 1); /* ffffffff pattern COLOR_FORMAT */ 856 dd_emit(ctx, 1, 0); /* ffffffff pattern SHAPE */ 857 dd_emit(ctx, 1, 1); /* ffffffff pattern PATTERN_SELECT */ 858 859 dd_emit(ctx, 1, 0xa); /* ffffffff surf2d SRC_FORMAT */ 860 dd_emit(ctx, 1, 0); /* ffffffff surf2d DMA_SRC */ 861 dd_emit(ctx, 1, 0); /* 000000ff surf2d SRC_ADDRESS_HIGH */ 862 dd_emit(ctx, 1, 0); /* ffffffff surf2d SRC_ADDRESS_LOW */ 863 dd_emit(ctx, 1, 0x40); /* 0000ffff surf2d SRC_PITCH */ 864 dd_emit(ctx, 1, 0); /* 0000000f surf2d SRC_TILE_MODE_Z */ 865 dd_emit(ctx, 1, 2); /* 0000000f surf2d SRC_TILE_MODE_Y */ 866 dd_emit(ctx, 1, 0x100); /* ffffffff surf2d SRC_HEIGHT */ 867 dd_emit(ctx, 1, 1); /* 00000001 surf2d SRC_LINEAR */ 868 dd_emit(ctx, 1, 0x100); /* ffffffff surf2d SRC_WIDTH */ 869 870 dd_emit(ctx, 1, 0); /* 0000ffff gdirect CLIP_B_X */ 871 dd_emit(ctx, 1, 0); /* 0000ffff gdirect CLIP_B_Y */ 872 dd_emit(ctx, 1, 0); /* 0000ffff gdirect CLIP_C_X */ 873 dd_emit(ctx, 1, 0); /* 0000ffff gdirect CLIP_C_Y */ 874 dd_emit(ctx, 1, 0); /* 0000ffff gdirect CLIP_D_X */ 875 dd_emit(ctx, 1, 0); /* 0000ffff gdirect CLIP_D_Y */ 876 dd_emit(ctx, 1, 1); /* ffffffff gdirect COLOR_FORMAT */ 877 dd_emit(ctx, 1, 0); /* ffffffff gdirect OPERATION */ 878 dd_emit(ctx, 1, 0); /* 0000ffff gdirect POINT_X */ 879 dd_emit(ctx, 1, 0); /* 0000ffff gdirect POINT_Y */ 880 881 dd_emit(ctx, 1, 0); /* 0000ffff blit SRC_Y */ 882 dd_emit(ctx, 1, 0); /* ffffffff blit OPERATION */ 883 884 dd_emit(ctx, 1, 0); /* ffffffff ifc OPERATION */ 885 886 dd_emit(ctx, 1, 0); /* ffffffff iifc INDEX_FORMAT */ 887 dd_emit(ctx, 1, 0); /* ffffffff iifc LUT_OFFSET */ 888 dd_emit(ctx, 1, 4); /* ffffffff iifc COLOR_FORMAT */ 889 dd_emit(ctx, 1, 0); /* ffffffff iifc OPERATION */ 890 } 891 892 /* m2mf state */ 893 dd_emit(ctx, 1, 0); /* ffffffff m2mf LINE_COUNT */ 894 dd_emit(ctx, 1, 0); /* ffffffff m2mf LINE_LENGTH_IN */ 895 dd_emit(ctx, 2, 0); /* ffffffff m2mf OFFSET_IN, OFFSET_OUT */ 896 dd_emit(ctx, 1, 1); /* ffffffff m2mf TILING_DEPTH_OUT */ 897 dd_emit(ctx, 1, 0x100); /* ffffffff m2mf TILING_HEIGHT_OUT */ 898 dd_emit(ctx, 1, 0); /* ffffffff m2mf TILING_POSITION_OUT_Z */ 899 dd_emit(ctx, 1, 1); /* 00000001 m2mf LINEAR_OUT */ 900 dd_emit(ctx, 2, 0); /* 0000ffff m2mf TILING_POSITION_OUT_X, Y */ 901 dd_emit(ctx, 1, 0x100); /* ffffffff m2mf TILING_PITCH_OUT */ 902 dd_emit(ctx, 1, 1); /* ffffffff m2mf TILING_DEPTH_IN */ 903 dd_emit(ctx, 1, 0x100); /* ffffffff m2mf TILING_HEIGHT_IN */ 904 dd_emit(ctx, 1, 0); /* ffffffff m2mf TILING_POSITION_IN_Z */ 905 dd_emit(ctx, 1, 1); /* 00000001 m2mf LINEAR_IN */ 906 dd_emit(ctx, 2, 0); /* 0000ffff m2mf TILING_POSITION_IN_X, Y */ 907 dd_emit(ctx, 1, 0x100); /* ffffffff m2mf TILING_PITCH_IN */ 908 909 /* more compat 2d state */ 910 if (device->chipset == 0x50) { 911 dd_emit(ctx, 1, 1); /* ffffffff line COLOR_FORMAT */ 912 dd_emit(ctx, 1, 0); /* ffffffff line OPERATION */ 913 914 dd_emit(ctx, 1, 1); /* ffffffff triangle COLOR_FORMAT */ 915 dd_emit(ctx, 1, 0); /* ffffffff triangle OPERATION */ 916 917 dd_emit(ctx, 1, 0); /* 0000000f sifm TILE_MODE_Z */ 918 dd_emit(ctx, 1, 2); /* 0000000f sifm TILE_MODE_Y */ 919 dd_emit(ctx, 1, 0); /* 000000ff sifm FORMAT_FILTER */ 920 dd_emit(ctx, 1, 1); /* 000000ff sifm FORMAT_ORIGIN */ 921 dd_emit(ctx, 1, 0); /* 0000ffff sifm SRC_PITCH */ 922 dd_emit(ctx, 1, 1); /* 00000001 sifm SRC_LINEAR */ 923 dd_emit(ctx, 1, 0); /* 000000ff sifm SRC_OFFSET_HIGH */ 924 dd_emit(ctx, 1, 0); /* ffffffff sifm SRC_OFFSET */ 925 dd_emit(ctx, 1, 0); /* 0000ffff sifm SRC_HEIGHT */ 926 dd_emit(ctx, 1, 0); /* 0000ffff sifm SRC_WIDTH */ 927 dd_emit(ctx, 1, 3); /* ffffffff sifm COLOR_FORMAT */ 928 dd_emit(ctx, 1, 0); /* ffffffff sifm OPERATION */ 929 930 dd_emit(ctx, 1, 0); /* ffffffff sifc OPERATION */ 931 } 932 933 /* tesla state */ 934 dd_emit(ctx, 1, 0); /* 0000000f GP_TEXTURES_LOG2 */ 935 dd_emit(ctx, 1, 0); /* 0000000f GP_SAMPLERS_LOG2 */ 936 dd_emit(ctx, 1, 0); /* 000000ff */ 937 dd_emit(ctx, 1, 0); /* ffffffff */ 938 dd_emit(ctx, 1, 4); /* 000000ff UNK12B0_0 */ 939 dd_emit(ctx, 1, 0x70); /* 000000ff UNK12B0_1 */ 940 dd_emit(ctx, 1, 0x80); /* 000000ff UNK12B0_3 */ 941 dd_emit(ctx, 1, 0); /* 000000ff UNK12B0_2 */ 942 dd_emit(ctx, 1, 0); /* 0000000f FP_TEXTURES_LOG2 */ 943 dd_emit(ctx, 1, 0); /* 0000000f FP_SAMPLERS_LOG2 */ 944 if (IS_NVA3F(device->chipset)) { 945 dd_emit(ctx, 1, 0); /* ffffffff */ 946 dd_emit(ctx, 1, 0); /* 0000007f MULTISAMPLE_SAMPLES_LOG2 */ 947 } else { 948 dd_emit(ctx, 1, 0); /* 0000000f MULTISAMPLE_SAMPLES_LOG2 */ 949 } 950 dd_emit(ctx, 1, 0xc); /* 000000ff SEMANTIC_COLOR.BFC0_ID */ 951 if (device->chipset != 0x50) 952 dd_emit(ctx, 1, 0); /* 00000001 SEMANTIC_COLOR.CLMP_EN */ 953 dd_emit(ctx, 1, 8); /* 000000ff SEMANTIC_COLOR.COLR_NR */ 954 dd_emit(ctx, 1, 0x14); /* 000000ff SEMANTIC_COLOR.FFC0_ID */ 955 if (device->chipset == 0x50) { 956 dd_emit(ctx, 1, 0); /* 000000ff SEMANTIC_LAYER */ 957 dd_emit(ctx, 1, 0); /* 00000001 */ 958 } else { 959 dd_emit(ctx, 1, 0); /* 00000001 SEMANTIC_PTSZ.ENABLE */ 960 dd_emit(ctx, 1, 0x29); /* 000000ff SEMANTIC_PTSZ.PTSZ_ID */ 961 dd_emit(ctx, 1, 0x27); /* 000000ff SEMANTIC_PRIM */ 962 dd_emit(ctx, 1, 0x26); /* 000000ff SEMANTIC_LAYER */ 963 dd_emit(ctx, 1, 8); /* 0000000f SMENATIC_CLIP.CLIP_HIGH */ 964 dd_emit(ctx, 1, 4); /* 000000ff SEMANTIC_CLIP.CLIP_LO */ 965 dd_emit(ctx, 1, 0x27); /* 000000ff UNK0FD4 */ 966 dd_emit(ctx, 1, 0); /* 00000001 UNK1900 */ 967 } 968 dd_emit(ctx, 1, 0); /* 00000007 RT_CONTROL_MAP0 */ 969 dd_emit(ctx, 1, 1); /* 00000007 RT_CONTROL_MAP1 */ 970 dd_emit(ctx, 1, 2); /* 00000007 RT_CONTROL_MAP2 */ 971 dd_emit(ctx, 1, 3); /* 00000007 RT_CONTROL_MAP3 */ 972 dd_emit(ctx, 1, 4); /* 00000007 RT_CONTROL_MAP4 */ 973 dd_emit(ctx, 1, 5); /* 00000007 RT_CONTROL_MAP5 */ 974 dd_emit(ctx, 1, 6); /* 00000007 RT_CONTROL_MAP6 */ 975 dd_emit(ctx, 1, 7); /* 00000007 RT_CONTROL_MAP7 */ 976 dd_emit(ctx, 1, 1); /* 0000000f RT_CONTROL_COUNT */ 977 dd_emit(ctx, 8, 0); /* 00000001 RT_HORIZ_UNK */ 978 dd_emit(ctx, 8, 0); /* ffffffff RT_ADDRESS_LOW */ 979 dd_emit(ctx, 1, 0xcf); /* 000000ff RT_FORMAT */ 980 dd_emit(ctx, 7, 0); /* 000000ff RT_FORMAT */ 981 if (device->chipset != 0x50) 982 dd_emit(ctx, 3, 0); /* 1, 1, 1 */ 983 else 984 dd_emit(ctx, 2, 0); /* 1, 1 */ 985 dd_emit(ctx, 1, 0); /* ffffffff GP_ENABLE */ 986 dd_emit(ctx, 1, 0x80); /* 0000ffff GP_VERTEX_OUTPUT_COUNT*/ 987 dd_emit(ctx, 1, 4); /* 000000ff GP_REG_ALLOC_RESULT */ 988 dd_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 989 if (IS_NVA3F(device->chipset)) { 990 dd_emit(ctx, 1, 3); /* 00000003 */ 991 dd_emit(ctx, 1, 0); /* 00000001 UNK1418. Alone. */ 992 } 993 if (device->chipset != 0x50) 994 dd_emit(ctx, 1, 3); /* 00000003 UNK15AC */ 995 dd_emit(ctx, 1, 1); /* ffffffff RASTERIZE_ENABLE */ 996 dd_emit(ctx, 1, 0); /* 00000001 FP_CONTROL.EXPORTS_Z */ 997 if (device->chipset != 0x50) 998 dd_emit(ctx, 1, 0); /* 00000001 FP_CONTROL.MULTIPLE_RESULTS */ 999 dd_emit(ctx, 1, 0x12); /* 000000ff FP_INTERPOLANT_CTRL.COUNT */ 1000 dd_emit(ctx, 1, 0x10); /* 000000ff FP_INTERPOLANT_CTRL.COUNT_NONFLAT */ 1001 dd_emit(ctx, 1, 0xc); /* 000000ff FP_INTERPOLANT_CTRL.OFFSET */ 1002 dd_emit(ctx, 1, 1); /* 00000001 FP_INTERPOLANT_CTRL.UMASK.W */ 1003 dd_emit(ctx, 1, 0); /* 00000001 FP_INTERPOLANT_CTRL.UMASK.X */ 1004 dd_emit(ctx, 1, 0); /* 00000001 FP_INTERPOLANT_CTRL.UMASK.Y */ 1005 dd_emit(ctx, 1, 0); /* 00000001 FP_INTERPOLANT_CTRL.UMASK.Z */ 1006 dd_emit(ctx, 1, 4); /* 000000ff FP_RESULT_COUNT */ 1007 dd_emit(ctx, 1, 2); /* ffffffff REG_MODE */ 1008 dd_emit(ctx, 1, 4); /* 000000ff FP_REG_ALLOC_TEMP */ 1009 if (device->chipset >= 0xa0) 1010 dd_emit(ctx, 1, 0); /* ffffffff */ 1011 dd_emit(ctx, 1, 0); /* 00000001 GP_BUILTIN_RESULT_EN.LAYER_IDX */ 1012 dd_emit(ctx, 1, 0); /* ffffffff STRMOUT_ENABLE */ 1013 dd_emit(ctx, 1, 0x3fffff); /* 003fffff TIC_LIMIT */ 1014 dd_emit(ctx, 1, 0x1fff); /* 000fffff TSC_LIMIT */ 1015 dd_emit(ctx, 1, 0); /* 00000001 VERTEX_TWO_SIDE_ENABLE*/ 1016 if (device->chipset != 0x50) 1017 dd_emit(ctx, 8, 0); /* 00000001 */ 1018 if (device->chipset >= 0xa0) { 1019 dd_emit(ctx, 1, 1); /* 00000007 VTX_ATTR_DEFINE.COMP */ 1020 dd_emit(ctx, 1, 1); /* 00000007 VTX_ATTR_DEFINE.SIZE */ 1021 dd_emit(ctx, 1, 2); /* 00000007 VTX_ATTR_DEFINE.TYPE */ 1022 dd_emit(ctx, 1, 0); /* 000000ff VTX_ATTR_DEFINE.ATTR */ 1023 } 1024 dd_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1025 dd_emit(ctx, 1, 0x14); /* 0000001f ZETA_FORMAT */ 1026 dd_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 1027 dd_emit(ctx, 1, 0); /* 0000000f VP_TEXTURES_LOG2 */ 1028 dd_emit(ctx, 1, 0); /* 0000000f VP_SAMPLERS_LOG2 */ 1029 if (IS_NVA3F(device->chipset)) 1030 dd_emit(ctx, 1, 0); /* 00000001 */ 1031 dd_emit(ctx, 1, 2); /* 00000003 POLYGON_MODE_BACK */ 1032 if (device->chipset >= 0xa0) 1033 dd_emit(ctx, 1, 0); /* 00000003 VTX_ATTR_DEFINE.SIZE - 1 */ 1034 dd_emit(ctx, 1, 0); /* 0000ffff CB_ADDR_INDEX */ 1035 if (device->chipset >= 0xa0) 1036 dd_emit(ctx, 1, 0); /* 00000003 */ 1037 dd_emit(ctx, 1, 0); /* 00000001 CULL_FACE_ENABLE */ 1038 dd_emit(ctx, 1, 1); /* 00000003 CULL_FACE */ 1039 dd_emit(ctx, 1, 0); /* 00000001 FRONT_FACE */ 1040 dd_emit(ctx, 1, 2); /* 00000003 POLYGON_MODE_FRONT */ 1041 dd_emit(ctx, 1, 0x1000); /* 00007fff UNK141C */ 1042 if (device->chipset != 0x50) { 1043 dd_emit(ctx, 1, 0xe00); /* 7fff */ 1044 dd_emit(ctx, 1, 0x1000); /* 7fff */ 1045 dd_emit(ctx, 1, 0x1e00); /* 7fff */ 1046 } 1047 dd_emit(ctx, 1, 0); /* 00000001 BEGIN_END_ACTIVE */ 1048 dd_emit(ctx, 1, 1); /* 00000001 POLYGON_MODE_??? */ 1049 dd_emit(ctx, 1, 1); /* 000000ff GP_REG_ALLOC_TEMP / 4 rounded up */ 1050 dd_emit(ctx, 1, 1); /* 000000ff FP_REG_ALLOC_TEMP... without /4? */ 1051 dd_emit(ctx, 1, 1); /* 000000ff VP_REG_ALLOC_TEMP / 4 rounded up */ 1052 dd_emit(ctx, 1, 1); /* 00000001 */ 1053 dd_emit(ctx, 1, 0); /* 00000001 */ 1054 dd_emit(ctx, 1, 0); /* 00000001 VTX_ATTR_MASK_UNK0 nonempty */ 1055 dd_emit(ctx, 1, 0); /* 00000001 VTX_ATTR_MASK_UNK1 nonempty */ 1056 dd_emit(ctx, 1, 0x200); /* 0003ffff GP_VERTEX_OUTPUT_COUNT*GP_REG_ALLOC_RESULT */ 1057 if (IS_NVA3F(device->chipset)) 1058 dd_emit(ctx, 1, 0x200); 1059 dd_emit(ctx, 1, 0); /* 00000001 */ 1060 if (device->chipset < 0xa0) { 1061 dd_emit(ctx, 1, 1); /* 00000001 */ 1062 dd_emit(ctx, 1, 0x70); /* 000000ff */ 1063 dd_emit(ctx, 1, 0x80); /* 000000ff */ 1064 dd_emit(ctx, 1, 0); /* 000000ff */ 1065 dd_emit(ctx, 1, 0); /* 00000001 */ 1066 dd_emit(ctx, 1, 1); /* 00000001 */ 1067 dd_emit(ctx, 1, 0x70); /* 000000ff */ 1068 dd_emit(ctx, 1, 0x80); /* 000000ff */ 1069 dd_emit(ctx, 1, 0); /* 000000ff */ 1070 } else { 1071 dd_emit(ctx, 1, 1); /* 00000001 */ 1072 dd_emit(ctx, 1, 0xf0); /* 000000ff */ 1073 dd_emit(ctx, 1, 0xff); /* 000000ff */ 1074 dd_emit(ctx, 1, 0); /* 000000ff */ 1075 dd_emit(ctx, 1, 0); /* 00000001 */ 1076 dd_emit(ctx, 1, 1); /* 00000001 */ 1077 dd_emit(ctx, 1, 0xf0); /* 000000ff */ 1078 dd_emit(ctx, 1, 0xff); /* 000000ff */ 1079 dd_emit(ctx, 1, 0); /* 000000ff */ 1080 dd_emit(ctx, 1, 9); /* 0000003f UNK114C.COMP,SIZE */ 1081 } 1082 1083 /* eng2d state */ 1084 dd_emit(ctx, 1, 0); /* 00000001 eng2d COLOR_KEY_ENABLE */ 1085 dd_emit(ctx, 1, 0); /* 00000007 eng2d COLOR_KEY_FORMAT */ 1086 dd_emit(ctx, 1, 1); /* ffffffff eng2d DST_DEPTH */ 1087 dd_emit(ctx, 1, 0xcf); /* 000000ff eng2d DST_FORMAT */ 1088 dd_emit(ctx, 1, 0); /* ffffffff eng2d DST_LAYER */ 1089 dd_emit(ctx, 1, 1); /* 00000001 eng2d DST_LINEAR */ 1090 dd_emit(ctx, 1, 0); /* 00000007 eng2d PATTERN_COLOR_FORMAT */ 1091 dd_emit(ctx, 1, 0); /* 00000007 eng2d OPERATION */ 1092 dd_emit(ctx, 1, 0); /* 00000003 eng2d PATTERN_SELECT */ 1093 dd_emit(ctx, 1, 0xcf); /* 000000ff eng2d SIFC_FORMAT */ 1094 dd_emit(ctx, 1, 0); /* 00000001 eng2d SIFC_BITMAP_ENABLE */ 1095 dd_emit(ctx, 1, 2); /* 00000003 eng2d SIFC_BITMAP_UNK808 */ 1096 dd_emit(ctx, 1, 0); /* ffffffff eng2d BLIT_DU_DX_FRACT */ 1097 dd_emit(ctx, 1, 1); /* ffffffff eng2d BLIT_DU_DX_INT */ 1098 dd_emit(ctx, 1, 0); /* ffffffff eng2d BLIT_DV_DY_FRACT */ 1099 dd_emit(ctx, 1, 1); /* ffffffff eng2d BLIT_DV_DY_INT */ 1100 dd_emit(ctx, 1, 0); /* 00000001 eng2d BLIT_CONTROL_FILTER */ 1101 dd_emit(ctx, 1, 0xcf); /* 000000ff eng2d DRAW_COLOR_FORMAT */ 1102 dd_emit(ctx, 1, 0xcf); /* 000000ff eng2d SRC_FORMAT */ 1103 dd_emit(ctx, 1, 1); /* 00000001 eng2d SRC_LINEAR #2 */ 1104 1105 num = ctx->ctxvals_pos - base; 1106 ctx->ctxvals_pos = base; 1107 if (IS_NVA3F(device->chipset)) 1108 cp_ctx(ctx, 0x404800, num); 1109 else 1110 cp_ctx(ctx, 0x405400, num); 1111 } 1112 1113 /* 1114 * xfer areas. These are a pain. 1115 * 1116 * There are 2 xfer areas: the first one is big and contains all sorts of 1117 * stuff, the second is small and contains some per-TP context. 1118 * 1119 * Each area is split into 8 "strands". The areas, when saved to grctx, 1120 * are made of 8-word blocks. Each block contains a single word from 1121 * each strand. The strands are independent of each other, their 1122 * addresses are unrelated to each other, and data in them is closely 1123 * packed together. The strand layout varies a bit between cards: here 1124 * and there, a single word is thrown out in the middle and the whole 1125 * strand is offset by a bit from corresponding one on another chipset. 1126 * For this reason, addresses of stuff in strands are almost useless. 1127 * Knowing sequence of stuff and size of gaps between them is much more 1128 * useful, and that's how we build the strands in our generator. 1129 * 1130 * NVA0 takes this mess to a whole new level by cutting the old strands 1131 * into a few dozen pieces [known as genes], rearranging them randomly, 1132 * and putting them back together to make new strands. Hopefully these 1133 * genes correspond more or less directly to the same PGRAPH subunits 1134 * as in 400040 register. 1135 * 1136 * The most common value in default context is 0, and when the genes 1137 * are separated by 0's, gene bounduaries are quite speculative... 1138 * some of them can be clearly deduced, others can be guessed, and yet 1139 * others won't be resolved without figuring out the real meaning of 1140 * given ctxval. For the same reason, ending point of each strand 1141 * is unknown. Except for strand 0, which is the longest strand and 1142 * its end corresponds to end of the whole xfer. 1143 * 1144 * An unsolved mystery is the seek instruction: it takes an argument 1145 * in bits 8-18, and that argument is clearly the place in strands to 1146 * seek to... but the offsets don't seem to correspond to offsets as 1147 * seen in grctx. Perhaps there's another, real, not randomly-changing 1148 * addressing in strands, and the xfer insn just happens to skip over 1149 * the unused bits? NV10-NV30 PIPE comes to mind... 1150 * 1151 * As far as I know, there's no way to access the xfer areas directly 1152 * without the help of ctxprog. 1153 */ 1154 1155 static void 1156 xf_emit(struct nvkm_grctx *ctx, int num, u32 val) { 1157 int i; 1158 if (val && ctx->mode == NVKM_GRCTX_VALS) 1159 for (i = 0; i < num; i++) 1160 nv_wo32(ctx->data, 4 * (ctx->ctxvals_pos + (i << 3)), val); 1161 ctx->ctxvals_pos += num << 3; 1162 } 1163 1164 /* Gene declarations... */ 1165 1166 static void nv50_gr_construct_gene_dispatch(struct nvkm_grctx *ctx); 1167 static void nv50_gr_construct_gene_m2mf(struct nvkm_grctx *ctx); 1168 static void nv50_gr_construct_gene_ccache(struct nvkm_grctx *ctx); 1169 static void nv50_gr_construct_gene_unk10xx(struct nvkm_grctx *ctx); 1170 static void nv50_gr_construct_gene_unk14xx(struct nvkm_grctx *ctx); 1171 static void nv50_gr_construct_gene_zcull(struct nvkm_grctx *ctx); 1172 static void nv50_gr_construct_gene_clipid(struct nvkm_grctx *ctx); 1173 static void nv50_gr_construct_gene_unk24xx(struct nvkm_grctx *ctx); 1174 static void nv50_gr_construct_gene_vfetch(struct nvkm_grctx *ctx); 1175 static void nv50_gr_construct_gene_eng2d(struct nvkm_grctx *ctx); 1176 static void nv50_gr_construct_gene_csched(struct nvkm_grctx *ctx); 1177 static void nv50_gr_construct_gene_unk1cxx(struct nvkm_grctx *ctx); 1178 static void nv50_gr_construct_gene_strmout(struct nvkm_grctx *ctx); 1179 static void nv50_gr_construct_gene_unk34xx(struct nvkm_grctx *ctx); 1180 static void nv50_gr_construct_gene_ropm1(struct nvkm_grctx *ctx); 1181 static void nv50_gr_construct_gene_ropm2(struct nvkm_grctx *ctx); 1182 static void nv50_gr_construct_gene_ropc(struct nvkm_grctx *ctx); 1183 static void nv50_gr_construct_xfer_tp(struct nvkm_grctx *ctx); 1184 1185 static void 1186 nv50_gr_construct_xfer1(struct nvkm_grctx *ctx) 1187 { 1188 struct nvkm_device *device = ctx->device; 1189 int i; 1190 int offset; 1191 int size = 0; 1192 u32 units = nv_rd32 (ctx->device, 0x1540); 1193 1194 offset = (ctx->ctxvals_pos+0x3f)&~0x3f; 1195 ctx->ctxvals_base = offset; 1196 1197 if (device->chipset < 0xa0) { 1198 /* Strand 0 */ 1199 ctx->ctxvals_pos = offset; 1200 nv50_gr_construct_gene_dispatch(ctx); 1201 nv50_gr_construct_gene_m2mf(ctx); 1202 nv50_gr_construct_gene_unk24xx(ctx); 1203 nv50_gr_construct_gene_clipid(ctx); 1204 nv50_gr_construct_gene_zcull(ctx); 1205 if ((ctx->ctxvals_pos-offset)/8 > size) 1206 size = (ctx->ctxvals_pos-offset)/8; 1207 1208 /* Strand 1 */ 1209 ctx->ctxvals_pos = offset + 0x1; 1210 nv50_gr_construct_gene_vfetch(ctx); 1211 nv50_gr_construct_gene_eng2d(ctx); 1212 nv50_gr_construct_gene_csched(ctx); 1213 nv50_gr_construct_gene_ropm1(ctx); 1214 nv50_gr_construct_gene_ropm2(ctx); 1215 if ((ctx->ctxvals_pos-offset)/8 > size) 1216 size = (ctx->ctxvals_pos-offset)/8; 1217 1218 /* Strand 2 */ 1219 ctx->ctxvals_pos = offset + 0x2; 1220 nv50_gr_construct_gene_ccache(ctx); 1221 nv50_gr_construct_gene_unk1cxx(ctx); 1222 nv50_gr_construct_gene_strmout(ctx); 1223 nv50_gr_construct_gene_unk14xx(ctx); 1224 nv50_gr_construct_gene_unk10xx(ctx); 1225 nv50_gr_construct_gene_unk34xx(ctx); 1226 if ((ctx->ctxvals_pos-offset)/8 > size) 1227 size = (ctx->ctxvals_pos-offset)/8; 1228 1229 /* Strand 3: per-ROP group state */ 1230 ctx->ctxvals_pos = offset + 3; 1231 for (i = 0; i < 6; i++) 1232 if (units & (1 << (i + 16))) 1233 nv50_gr_construct_gene_ropc(ctx); 1234 if ((ctx->ctxvals_pos-offset)/8 > size) 1235 size = (ctx->ctxvals_pos-offset)/8; 1236 1237 /* Strands 4-7: per-TP state */ 1238 for (i = 0; i < 4; i++) { 1239 ctx->ctxvals_pos = offset + 4 + i; 1240 if (units & (1 << (2 * i))) 1241 nv50_gr_construct_xfer_tp(ctx); 1242 if (units & (1 << (2 * i + 1))) 1243 nv50_gr_construct_xfer_tp(ctx); 1244 if ((ctx->ctxvals_pos-offset)/8 > size) 1245 size = (ctx->ctxvals_pos-offset)/8; 1246 } 1247 } else { 1248 /* Strand 0 */ 1249 ctx->ctxvals_pos = offset; 1250 nv50_gr_construct_gene_dispatch(ctx); 1251 nv50_gr_construct_gene_m2mf(ctx); 1252 nv50_gr_construct_gene_unk34xx(ctx); 1253 nv50_gr_construct_gene_csched(ctx); 1254 nv50_gr_construct_gene_unk1cxx(ctx); 1255 nv50_gr_construct_gene_strmout(ctx); 1256 if ((ctx->ctxvals_pos-offset)/8 > size) 1257 size = (ctx->ctxvals_pos-offset)/8; 1258 1259 /* Strand 1 */ 1260 ctx->ctxvals_pos = offset + 1; 1261 nv50_gr_construct_gene_unk10xx(ctx); 1262 if ((ctx->ctxvals_pos-offset)/8 > size) 1263 size = (ctx->ctxvals_pos-offset)/8; 1264 1265 /* Strand 2 */ 1266 ctx->ctxvals_pos = offset + 2; 1267 if (device->chipset == 0xa0) 1268 nv50_gr_construct_gene_unk14xx(ctx); 1269 nv50_gr_construct_gene_unk24xx(ctx); 1270 if ((ctx->ctxvals_pos-offset)/8 > size) 1271 size = (ctx->ctxvals_pos-offset)/8; 1272 1273 /* Strand 3 */ 1274 ctx->ctxvals_pos = offset + 3; 1275 nv50_gr_construct_gene_vfetch(ctx); 1276 if ((ctx->ctxvals_pos-offset)/8 > size) 1277 size = (ctx->ctxvals_pos-offset)/8; 1278 1279 /* Strand 4 */ 1280 ctx->ctxvals_pos = offset + 4; 1281 nv50_gr_construct_gene_ccache(ctx); 1282 if ((ctx->ctxvals_pos-offset)/8 > size) 1283 size = (ctx->ctxvals_pos-offset)/8; 1284 1285 /* Strand 5 */ 1286 ctx->ctxvals_pos = offset + 5; 1287 nv50_gr_construct_gene_ropm2(ctx); 1288 nv50_gr_construct_gene_ropm1(ctx); 1289 /* per-ROP context */ 1290 for (i = 0; i < 8; i++) 1291 if (units & (1<<(i+16))) 1292 nv50_gr_construct_gene_ropc(ctx); 1293 if ((ctx->ctxvals_pos-offset)/8 > size) 1294 size = (ctx->ctxvals_pos-offset)/8; 1295 1296 /* Strand 6 */ 1297 ctx->ctxvals_pos = offset + 6; 1298 nv50_gr_construct_gene_zcull(ctx); 1299 nv50_gr_construct_gene_clipid(ctx); 1300 nv50_gr_construct_gene_eng2d(ctx); 1301 if (units & (1 << 0)) 1302 nv50_gr_construct_xfer_tp(ctx); 1303 if (units & (1 << 1)) 1304 nv50_gr_construct_xfer_tp(ctx); 1305 if (units & (1 << 2)) 1306 nv50_gr_construct_xfer_tp(ctx); 1307 if (units & (1 << 3)) 1308 nv50_gr_construct_xfer_tp(ctx); 1309 if ((ctx->ctxvals_pos-offset)/8 > size) 1310 size = (ctx->ctxvals_pos-offset)/8; 1311 1312 /* Strand 7 */ 1313 ctx->ctxvals_pos = offset + 7; 1314 if (device->chipset == 0xa0) { 1315 if (units & (1 << 4)) 1316 nv50_gr_construct_xfer_tp(ctx); 1317 if (units & (1 << 5)) 1318 nv50_gr_construct_xfer_tp(ctx); 1319 if (units & (1 << 6)) 1320 nv50_gr_construct_xfer_tp(ctx); 1321 if (units & (1 << 7)) 1322 nv50_gr_construct_xfer_tp(ctx); 1323 if (units & (1 << 8)) 1324 nv50_gr_construct_xfer_tp(ctx); 1325 if (units & (1 << 9)) 1326 nv50_gr_construct_xfer_tp(ctx); 1327 } else { 1328 nv50_gr_construct_gene_unk14xx(ctx); 1329 } 1330 if ((ctx->ctxvals_pos-offset)/8 > size) 1331 size = (ctx->ctxvals_pos-offset)/8; 1332 } 1333 1334 ctx->ctxvals_pos = offset + size * 8; 1335 ctx->ctxvals_pos = (ctx->ctxvals_pos+0x3f)&~0x3f; 1336 cp_lsr (ctx, offset); 1337 cp_out (ctx, CP_SET_XFER_POINTER); 1338 cp_lsr (ctx, size); 1339 cp_out (ctx, CP_SEEK_1); 1340 cp_out (ctx, CP_XFER_1); 1341 cp_wait(ctx, XFER, BUSY); 1342 } 1343 1344 /* 1345 * non-trivial demagiced parts of ctx init go here 1346 */ 1347 1348 static void 1349 nv50_gr_construct_gene_dispatch(struct nvkm_grctx *ctx) 1350 { 1351 /* start of strand 0 */ 1352 struct nvkm_device *device = ctx->device; 1353 /* SEEK */ 1354 if (device->chipset == 0x50) 1355 xf_emit(ctx, 5, 0); 1356 else if (!IS_NVA3F(device->chipset)) 1357 xf_emit(ctx, 6, 0); 1358 else 1359 xf_emit(ctx, 4, 0); 1360 /* SEEK */ 1361 /* the PGRAPH's internal FIFO */ 1362 if (device->chipset == 0x50) 1363 xf_emit(ctx, 8*3, 0); 1364 else 1365 xf_emit(ctx, 0x100*3, 0); 1366 /* and another bonus slot?!? */ 1367 xf_emit(ctx, 3, 0); 1368 /* and YET ANOTHER bonus slot? */ 1369 if (IS_NVA3F(device->chipset)) 1370 xf_emit(ctx, 3, 0); 1371 /* SEEK */ 1372 /* CTX_SWITCH: caches of gr objects bound to subchannels. 8 values, last used index */ 1373 xf_emit(ctx, 9, 0); 1374 /* SEEK */ 1375 xf_emit(ctx, 9, 0); 1376 /* SEEK */ 1377 xf_emit(ctx, 9, 0); 1378 /* SEEK */ 1379 xf_emit(ctx, 9, 0); 1380 /* SEEK */ 1381 if (device->chipset < 0x90) 1382 xf_emit(ctx, 4, 0); 1383 /* SEEK */ 1384 xf_emit(ctx, 2, 0); 1385 /* SEEK */ 1386 xf_emit(ctx, 6*2, 0); 1387 xf_emit(ctx, 2, 0); 1388 /* SEEK */ 1389 xf_emit(ctx, 2, 0); 1390 /* SEEK */ 1391 xf_emit(ctx, 6*2, 0); 1392 xf_emit(ctx, 2, 0); 1393 /* SEEK */ 1394 if (device->chipset == 0x50) 1395 xf_emit(ctx, 0x1c, 0); 1396 else if (device->chipset < 0xa0) 1397 xf_emit(ctx, 0x1e, 0); 1398 else 1399 xf_emit(ctx, 0x22, 0); 1400 /* SEEK */ 1401 xf_emit(ctx, 0x15, 0); 1402 } 1403 1404 static void 1405 nv50_gr_construct_gene_m2mf(struct nvkm_grctx *ctx) 1406 { 1407 /* Strand 0, right after dispatch */ 1408 struct nvkm_device *device = ctx->device; 1409 int smallm2mf = 0; 1410 if (device->chipset < 0x92 || device->chipset == 0x98) 1411 smallm2mf = 1; 1412 /* SEEK */ 1413 xf_emit (ctx, 1, 0); /* DMA_NOTIFY instance >> 4 */ 1414 xf_emit (ctx, 1, 0); /* DMA_BUFFER_IN instance >> 4 */ 1415 xf_emit (ctx, 1, 0); /* DMA_BUFFER_OUT instance >> 4 */ 1416 xf_emit (ctx, 1, 0); /* OFFSET_IN */ 1417 xf_emit (ctx, 1, 0); /* OFFSET_OUT */ 1418 xf_emit (ctx, 1, 0); /* PITCH_IN */ 1419 xf_emit (ctx, 1, 0); /* PITCH_OUT */ 1420 xf_emit (ctx, 1, 0); /* LINE_LENGTH */ 1421 xf_emit (ctx, 1, 0); /* LINE_COUNT */ 1422 xf_emit (ctx, 1, 0x21); /* FORMAT: bits 0-4 INPUT_INC, bits 5-9 OUTPUT_INC */ 1423 xf_emit (ctx, 1, 1); /* LINEAR_IN */ 1424 xf_emit (ctx, 1, 0x2); /* TILING_MODE_IN: bits 0-2 y tiling, bits 3-5 z tiling */ 1425 xf_emit (ctx, 1, 0x100); /* TILING_PITCH_IN */ 1426 xf_emit (ctx, 1, 0x100); /* TILING_HEIGHT_IN */ 1427 xf_emit (ctx, 1, 1); /* TILING_DEPTH_IN */ 1428 xf_emit (ctx, 1, 0); /* TILING_POSITION_IN_Z */ 1429 xf_emit (ctx, 1, 0); /* TILING_POSITION_IN */ 1430 xf_emit (ctx, 1, 1); /* LINEAR_OUT */ 1431 xf_emit (ctx, 1, 0x2); /* TILING_MODE_OUT: bits 0-2 y tiling, bits 3-5 z tiling */ 1432 xf_emit (ctx, 1, 0x100); /* TILING_PITCH_OUT */ 1433 xf_emit (ctx, 1, 0x100); /* TILING_HEIGHT_OUT */ 1434 xf_emit (ctx, 1, 1); /* TILING_DEPTH_OUT */ 1435 xf_emit (ctx, 1, 0); /* TILING_POSITION_OUT_Z */ 1436 xf_emit (ctx, 1, 0); /* TILING_POSITION_OUT */ 1437 xf_emit (ctx, 1, 0); /* OFFSET_IN_HIGH */ 1438 xf_emit (ctx, 1, 0); /* OFFSET_OUT_HIGH */ 1439 /* SEEK */ 1440 if (smallm2mf) 1441 xf_emit(ctx, 0x40, 0); /* 20 * ffffffff, 3ffff */ 1442 else 1443 xf_emit(ctx, 0x100, 0); /* 80 * ffffffff, 3ffff */ 1444 xf_emit(ctx, 4, 0); /* 1f/7f, 0, 1f/7f, 0 [1f for smallm2mf, 7f otherwise] */ 1445 /* SEEK */ 1446 if (smallm2mf) 1447 xf_emit(ctx, 0x400, 0); /* ffffffff */ 1448 else 1449 xf_emit(ctx, 0x800, 0); /* ffffffff */ 1450 xf_emit(ctx, 4, 0); /* ff/1ff, 0, 0, 0 [ff for smallm2mf, 1ff otherwise] */ 1451 /* SEEK */ 1452 xf_emit(ctx, 0x40, 0); /* 20 * bits ffffffff, 3ffff */ 1453 xf_emit(ctx, 0x6, 0); /* 1f, 0, 1f, 0, 1f, 0 */ 1454 } 1455 1456 static void 1457 nv50_gr_construct_gene_ccache(struct nvkm_grctx *ctx) 1458 { 1459 struct nvkm_device *device = ctx->device; 1460 xf_emit(ctx, 2, 0); /* RO */ 1461 xf_emit(ctx, 0x800, 0); /* ffffffff */ 1462 switch (device->chipset) { 1463 case 0x50: 1464 case 0x92: 1465 case 0xa0: 1466 xf_emit(ctx, 0x2b, 0); 1467 break; 1468 case 0x84: 1469 xf_emit(ctx, 0x29, 0); 1470 break; 1471 case 0x94: 1472 case 0x96: 1473 case 0xa3: 1474 xf_emit(ctx, 0x27, 0); 1475 break; 1476 case 0x86: 1477 case 0x98: 1478 case 0xa5: 1479 case 0xa8: 1480 case 0xaa: 1481 case 0xac: 1482 case 0xaf: 1483 xf_emit(ctx, 0x25, 0); 1484 break; 1485 } 1486 /* CB bindings, 0x80 of them. first word is address >> 8, second is 1487 * size >> 4 | valid << 24 */ 1488 xf_emit(ctx, 0x100, 0); /* ffffffff CB_DEF */ 1489 xf_emit(ctx, 1, 0); /* 0000007f CB_ADDR_BUFFER */ 1490 xf_emit(ctx, 1, 0); /* 0 */ 1491 xf_emit(ctx, 0x30, 0); /* ff SET_PROGRAM_CB */ 1492 xf_emit(ctx, 1, 0); /* 3f last SET_PROGRAM_CB */ 1493 xf_emit(ctx, 4, 0); /* RO */ 1494 xf_emit(ctx, 0x100, 0); /* ffffffff */ 1495 xf_emit(ctx, 8, 0); /* 1f, 0, 0, ... */ 1496 xf_emit(ctx, 8, 0); /* ffffffff */ 1497 xf_emit(ctx, 4, 0); /* ffffffff */ 1498 xf_emit(ctx, 1, 0); /* 3 */ 1499 xf_emit(ctx, 1, 0); /* ffffffff */ 1500 xf_emit(ctx, 1, 0); /* 0000ffff DMA_CODE_CB */ 1501 xf_emit(ctx, 1, 0); /* 0000ffff DMA_TIC */ 1502 xf_emit(ctx, 1, 0); /* 0000ffff DMA_TSC */ 1503 xf_emit(ctx, 1, 0); /* 00000001 LINKED_TSC */ 1504 xf_emit(ctx, 1, 0); /* 000000ff TIC_ADDRESS_HIGH */ 1505 xf_emit(ctx, 1, 0); /* ffffffff TIC_ADDRESS_LOW */ 1506 xf_emit(ctx, 1, 0x3fffff); /* 003fffff TIC_LIMIT */ 1507 xf_emit(ctx, 1, 0); /* 000000ff TSC_ADDRESS_HIGH */ 1508 xf_emit(ctx, 1, 0); /* ffffffff TSC_ADDRESS_LOW */ 1509 xf_emit(ctx, 1, 0x1fff); /* 000fffff TSC_LIMIT */ 1510 xf_emit(ctx, 1, 0); /* 000000ff VP_ADDRESS_HIGH */ 1511 xf_emit(ctx, 1, 0); /* ffffffff VP_ADDRESS_LOW */ 1512 xf_emit(ctx, 1, 0); /* 00ffffff VP_START_ID */ 1513 xf_emit(ctx, 1, 0); /* 000000ff CB_DEF_ADDRESS_HIGH */ 1514 xf_emit(ctx, 1, 0); /* ffffffff CB_DEF_ADDRESS_LOW */ 1515 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1516 xf_emit(ctx, 1, 0); /* 000000ff GP_ADDRESS_HIGH */ 1517 xf_emit(ctx, 1, 0); /* ffffffff GP_ADDRESS_LOW */ 1518 xf_emit(ctx, 1, 0); /* 00ffffff GP_START_ID */ 1519 xf_emit(ctx, 1, 0); /* 000000ff FP_ADDRESS_HIGH */ 1520 xf_emit(ctx, 1, 0); /* ffffffff FP_ADDRESS_LOW */ 1521 xf_emit(ctx, 1, 0); /* 00ffffff FP_START_ID */ 1522 } 1523 1524 static void 1525 nv50_gr_construct_gene_unk10xx(struct nvkm_grctx *ctx) 1526 { 1527 struct nvkm_device *device = ctx->device; 1528 int i; 1529 /* end of area 2 on pre-NVA0, area 1 on NVAx */ 1530 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 1531 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1532 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1533 xf_emit(ctx, 1, 0x80); /* 0000ffff GP_VERTEX_OUTPUT_COUNT */ 1534 xf_emit(ctx, 1, 4); /* 000000ff GP_REG_ALLOC_RESULT */ 1535 xf_emit(ctx, 1, 0x80c14); /* 01ffffff SEMANTIC_COLOR */ 1536 xf_emit(ctx, 1, 0); /* 00000001 VERTEX_TWO_SIDE_ENABLE */ 1537 if (device->chipset == 0x50) 1538 xf_emit(ctx, 1, 0x3ff); 1539 else 1540 xf_emit(ctx, 1, 0x7ff); /* 000007ff */ 1541 xf_emit(ctx, 1, 0); /* 111/113 */ 1542 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1543 for (i = 0; i < 8; i++) { 1544 switch (device->chipset) { 1545 case 0x50: 1546 case 0x86: 1547 case 0x98: 1548 case 0xaa: 1549 case 0xac: 1550 xf_emit(ctx, 0xa0, 0); /* ffffffff */ 1551 break; 1552 case 0x84: 1553 case 0x92: 1554 case 0x94: 1555 case 0x96: 1556 xf_emit(ctx, 0x120, 0); 1557 break; 1558 case 0xa5: 1559 case 0xa8: 1560 xf_emit(ctx, 0x100, 0); /* ffffffff */ 1561 break; 1562 case 0xa0: 1563 case 0xa3: 1564 case 0xaf: 1565 xf_emit(ctx, 0x400, 0); /* ffffffff */ 1566 break; 1567 } 1568 xf_emit(ctx, 4, 0); /* 3f, 0, 0, 0 */ 1569 xf_emit(ctx, 4, 0); /* ffffffff */ 1570 } 1571 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 1572 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1573 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1574 xf_emit(ctx, 1, 0x80); /* 0000ffff GP_VERTEX_OUTPUT_COUNT */ 1575 xf_emit(ctx, 1, 4); /* 000000ff GP_REG_ALLOC_TEMP */ 1576 xf_emit(ctx, 1, 1); /* 00000001 RASTERIZE_ENABLE */ 1577 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 1578 xf_emit(ctx, 1, 0x27); /* 000000ff UNK0FD4 */ 1579 xf_emit(ctx, 1, 0); /* 0001ffff GP_BUILTIN_RESULT_EN */ 1580 xf_emit(ctx, 1, 0x26); /* 000000ff SEMANTIC_LAYER */ 1581 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1582 } 1583 1584 static void 1585 nv50_gr_construct_gene_unk34xx(struct nvkm_grctx *ctx) 1586 { 1587 struct nvkm_device *device = ctx->device; 1588 /* end of area 2 on pre-NVA0, area 1 on NVAx */ 1589 xf_emit(ctx, 1, 0); /* 00000001 VIEWPORT_CLIP_RECTS_EN */ 1590 xf_emit(ctx, 1, 0); /* 00000003 VIEWPORT_CLIP_MODE */ 1591 xf_emit(ctx, 0x10, 0x04000000); /* 07ffffff VIEWPORT_CLIP_HORIZ*8, VIEWPORT_CLIP_VERT*8 */ 1592 xf_emit(ctx, 1, 0); /* 00000001 POLYGON_STIPPLE_ENABLE */ 1593 xf_emit(ctx, 0x20, 0); /* ffffffff POLYGON_STIPPLE */ 1594 xf_emit(ctx, 2, 0); /* 00007fff WINDOW_OFFSET_XY */ 1595 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 1596 xf_emit(ctx, 1, 0x04e3bfdf); /* ffffffff UNK0D64 */ 1597 xf_emit(ctx, 1, 0x04e3bfdf); /* ffffffff UNK0DF4 */ 1598 xf_emit(ctx, 1, 0); /* 00000003 WINDOW_ORIGIN */ 1599 xf_emit(ctx, 1, 0); /* 00000007 */ 1600 xf_emit(ctx, 1, 0x1fe21); /* 0001ffff tesla UNK0FAC */ 1601 if (device->chipset >= 0xa0) 1602 xf_emit(ctx, 1, 0x0fac6881); 1603 if (IS_NVA3F(device->chipset)) { 1604 xf_emit(ctx, 1, 1); 1605 xf_emit(ctx, 3, 0); 1606 } 1607 } 1608 1609 static void 1610 nv50_gr_construct_gene_unk14xx(struct nvkm_grctx *ctx) 1611 { 1612 struct nvkm_device *device = ctx->device; 1613 /* middle of area 2 on pre-NVA0, beginning of area 2 on NVA0, area 7 on >NVA0 */ 1614 if (device->chipset != 0x50) { 1615 xf_emit(ctx, 5, 0); /* ffffffff */ 1616 xf_emit(ctx, 1, 0x80c14); /* 01ffffff SEMANTIC_COLOR */ 1617 xf_emit(ctx, 1, 0); /* 00000001 */ 1618 xf_emit(ctx, 1, 0); /* 000003ff */ 1619 xf_emit(ctx, 1, 0x804); /* 00000fff SEMANTIC_CLIP */ 1620 xf_emit(ctx, 1, 0); /* 00000001 */ 1621 xf_emit(ctx, 2, 4); /* 7f, ff */ 1622 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 1623 } 1624 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1625 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1626 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 1627 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1628 xf_emit(ctx, 1, 0x10); /* 7f/ff VIEW_VOLUME_CLIP_CTRL */ 1629 xf_emit(ctx, 1, 0); /* 000000ff VP_CLIP_DISTANCE_ENABLE */ 1630 if (device->chipset != 0x50) 1631 xf_emit(ctx, 1, 0); /* 3ff */ 1632 xf_emit(ctx, 1, 0); /* 000000ff tesla UNK1940 */ 1633 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK0D7C */ 1634 xf_emit(ctx, 1, 0x804); /* 00000fff SEMANTIC_CLIP */ 1635 xf_emit(ctx, 1, 1); /* 00000001 VIEWPORT_TRANSFORM_EN */ 1636 xf_emit(ctx, 1, 0x1a); /* 0000001f POLYGON_MODE */ 1637 if (device->chipset != 0x50) 1638 xf_emit(ctx, 1, 0x7f); /* 000000ff tesla UNK0FFC */ 1639 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1640 xf_emit(ctx, 1, 1); /* 00000001 SHADE_MODEL */ 1641 xf_emit(ctx, 1, 0x80c14); /* 01ffffff SEMANTIC_COLOR */ 1642 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 1643 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 1644 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1645 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 1646 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1647 xf_emit(ctx, 1, 0x10); /* 7f/ff VIEW_VOLUME_CLIP_CTRL */ 1648 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK0D7C */ 1649 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK0F8C */ 1650 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1651 xf_emit(ctx, 1, 1); /* 00000001 VIEWPORT_TRANSFORM_EN */ 1652 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 1653 xf_emit(ctx, 4, 0); /* ffffffff NOPERSPECTIVE_BITMAP */ 1654 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 1655 xf_emit(ctx, 1, 0); /* 0000000f */ 1656 if (device->chipset == 0x50) 1657 xf_emit(ctx, 1, 0x3ff); /* 000003ff tesla UNK0D68 */ 1658 else 1659 xf_emit(ctx, 1, 0x7ff); /* 000007ff tesla UNK0D68 */ 1660 xf_emit(ctx, 1, 0x80c14); /* 01ffffff SEMANTIC_COLOR */ 1661 xf_emit(ctx, 1, 0); /* 00000001 VERTEX_TWO_SIDE_ENABLE */ 1662 xf_emit(ctx, 0x30, 0); /* ffffffff VIEWPORT_SCALE: X0, Y0, Z0, X1, Y1, ... */ 1663 xf_emit(ctx, 3, 0); /* f, 0, 0 */ 1664 xf_emit(ctx, 3, 0); /* ffffffff last VIEWPORT_SCALE? */ 1665 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1666 xf_emit(ctx, 1, 1); /* 00000001 VIEWPORT_TRANSFORM_EN */ 1667 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 1668 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1924 */ 1669 xf_emit(ctx, 1, 0x10); /* 000000ff VIEW_VOLUME_CLIP_CTRL */ 1670 xf_emit(ctx, 1, 0); /* 00000001 */ 1671 xf_emit(ctx, 0x30, 0); /* ffffffff VIEWPORT_TRANSLATE */ 1672 xf_emit(ctx, 3, 0); /* f, 0, 0 */ 1673 xf_emit(ctx, 3, 0); /* ffffffff */ 1674 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1675 xf_emit(ctx, 2, 0x88); /* 000001ff tesla UNK19D8 */ 1676 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1924 */ 1677 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1678 xf_emit(ctx, 1, 4); /* 0000000f CULL_MODE */ 1679 xf_emit(ctx, 2, 0); /* 07ffffff SCREEN_SCISSOR */ 1680 xf_emit(ctx, 2, 0); /* 00007fff WINDOW_OFFSET_XY */ 1681 xf_emit(ctx, 1, 0); /* 00000003 WINDOW_ORIGIN */ 1682 xf_emit(ctx, 0x10, 0); /* 00000001 SCISSOR_ENABLE */ 1683 xf_emit(ctx, 1, 0); /* 0001ffff GP_BUILTIN_RESULT_EN */ 1684 xf_emit(ctx, 1, 0x26); /* 000000ff SEMANTIC_LAYER */ 1685 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 1686 xf_emit(ctx, 1, 0); /* 0000000f */ 1687 xf_emit(ctx, 1, 0x3f800000); /* ffffffff LINE_WIDTH */ 1688 xf_emit(ctx, 1, 0); /* 00000001 LINE_STIPPLE_ENABLE */ 1689 xf_emit(ctx, 1, 0); /* 00000001 LINE_SMOOTH_ENABLE */ 1690 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 1691 if (IS_NVA3F(device->chipset)) 1692 xf_emit(ctx, 1, 0); /* 00000001 */ 1693 xf_emit(ctx, 1, 0x1a); /* 0000001f POLYGON_MODE */ 1694 xf_emit(ctx, 1, 0x10); /* 000000ff VIEW_VOLUME_CLIP_CTRL */ 1695 if (device->chipset != 0x50) { 1696 xf_emit(ctx, 1, 0); /* ffffffff */ 1697 xf_emit(ctx, 1, 0); /* 00000001 */ 1698 xf_emit(ctx, 1, 0); /* 000003ff */ 1699 } 1700 xf_emit(ctx, 0x20, 0); /* 10xbits ffffffff, 3fffff. SCISSOR_* */ 1701 xf_emit(ctx, 1, 0); /* f */ 1702 xf_emit(ctx, 1, 0); /* 0? */ 1703 xf_emit(ctx, 1, 0); /* ffffffff */ 1704 xf_emit(ctx, 1, 0); /* 003fffff */ 1705 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1706 xf_emit(ctx, 1, 0x52); /* 000001ff SEMANTIC_PTSZ */ 1707 xf_emit(ctx, 1, 0); /* 0001ffff GP_BUILTIN_RESULT_EN */ 1708 xf_emit(ctx, 1, 0x26); /* 000000ff SEMANTIC_LAYER */ 1709 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 1710 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1711 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 1712 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1713 xf_emit(ctx, 1, 0x1a); /* 0000001f POLYGON_MODE */ 1714 xf_emit(ctx, 1, 0); /* 00000001 LINE_SMOOTH_ENABLE */ 1715 xf_emit(ctx, 1, 0); /* 00000001 LINE_STIPPLE_ENABLE */ 1716 xf_emit(ctx, 1, 0x00ffff00); /* 00ffffff LINE_STIPPLE_PATTERN */ 1717 xf_emit(ctx, 1, 0); /* 0000000f */ 1718 } 1719 1720 static void 1721 nv50_gr_construct_gene_zcull(struct nvkm_grctx *ctx) 1722 { 1723 struct nvkm_device *device = ctx->device; 1724 /* end of strand 0 on pre-NVA0, beginning of strand 6 on NVAx */ 1725 /* SEEK */ 1726 xf_emit(ctx, 1, 0x3f); /* 0000003f UNK1590 */ 1727 xf_emit(ctx, 1, 0); /* 00000001 ALPHA_TEST_ENABLE */ 1728 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 1729 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 1730 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_BACK_FUNC_FUNC */ 1731 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_MASK */ 1732 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_REF */ 1733 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_MASK */ 1734 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_BACK_OP_FAIL, ZFAIL, ZPASS */ 1735 xf_emit(ctx, 1, 2); /* 00000003 tesla UNK143C */ 1736 xf_emit(ctx, 2, 0x04000000); /* 07ffffff tesla UNK0D6C */ 1737 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 1738 xf_emit(ctx, 1, 0); /* 00000001 CLIPID_ENABLE */ 1739 xf_emit(ctx, 2, 0); /* ffffffff DEPTH_BOUNDS */ 1740 xf_emit(ctx, 1, 0); /* 00000001 */ 1741 xf_emit(ctx, 1, 0); /* 00000007 DEPTH_TEST_FUNC */ 1742 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 1743 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 1744 xf_emit(ctx, 1, 4); /* 0000000f CULL_MODE */ 1745 xf_emit(ctx, 1, 0); /* 0000ffff */ 1746 xf_emit(ctx, 1, 0); /* 00000001 UNK0FB0 */ 1747 xf_emit(ctx, 1, 0); /* 00000001 POLYGON_STIPPLE_ENABLE */ 1748 xf_emit(ctx, 1, 4); /* 00000007 FP_CONTROL */ 1749 xf_emit(ctx, 1, 0); /* ffffffff */ 1750 xf_emit(ctx, 1, 0); /* 0001ffff GP_BUILTIN_RESULT_EN */ 1751 xf_emit(ctx, 1, 0); /* 000000ff CLEAR_STENCIL */ 1752 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_FRONT_FUNC_FUNC */ 1753 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_MASK */ 1754 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_REF */ 1755 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_MASK */ 1756 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_FRONT_OP_FAIL, ZFAIL, ZPASS */ 1757 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 1758 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_BACK_ENABLE */ 1759 xf_emit(ctx, 1, 0); /* ffffffff CLEAR_DEPTH */ 1760 xf_emit(ctx, 1, 0); /* 00000007 */ 1761 if (device->chipset != 0x50) 1762 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1108 */ 1763 xf_emit(ctx, 1, 0); /* 00000001 SAMPLECNT_ENABLE */ 1764 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 1765 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 1766 xf_emit(ctx, 1, 0x1001); /* 00001fff ZETA_ARRAY_MODE */ 1767 /* SEEK */ 1768 xf_emit(ctx, 4, 0xffff); /* 0000ffff MSAA_MASK */ 1769 xf_emit(ctx, 0x10, 0); /* 00000001 SCISSOR_ENABLE */ 1770 xf_emit(ctx, 0x10, 0); /* ffffffff DEPTH_RANGE_NEAR */ 1771 xf_emit(ctx, 0x10, 0x3f800000); /* ffffffff DEPTH_RANGE_FAR */ 1772 xf_emit(ctx, 1, 0x10); /* 7f/ff/3ff VIEW_VOLUME_CLIP_CTRL */ 1773 xf_emit(ctx, 1, 0); /* 00000001 VIEWPORT_CLIP_RECTS_EN */ 1774 xf_emit(ctx, 1, 3); /* 00000003 FP_CTRL_UNK196C */ 1775 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1968 */ 1776 if (device->chipset != 0x50) 1777 xf_emit(ctx, 1, 0); /* 0fffffff tesla UNK1104 */ 1778 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK151C */ 1779 } 1780 1781 static void 1782 nv50_gr_construct_gene_clipid(struct nvkm_grctx *ctx) 1783 { 1784 /* middle of strand 0 on pre-NVA0 [after 24xx], middle of area 6 on NVAx */ 1785 /* SEEK */ 1786 xf_emit(ctx, 1, 0); /* 00000007 UNK0FB4 */ 1787 /* SEEK */ 1788 xf_emit(ctx, 4, 0); /* 07ffffff CLIPID_REGION_HORIZ */ 1789 xf_emit(ctx, 4, 0); /* 07ffffff CLIPID_REGION_VERT */ 1790 xf_emit(ctx, 2, 0); /* 07ffffff SCREEN_SCISSOR */ 1791 xf_emit(ctx, 2, 0x04000000); /* 07ffffff UNK1508 */ 1792 xf_emit(ctx, 1, 0); /* 00000001 CLIPID_ENABLE */ 1793 xf_emit(ctx, 1, 0x80); /* 00003fff CLIPID_WIDTH */ 1794 xf_emit(ctx, 1, 0); /* 000000ff CLIPID_ID */ 1795 xf_emit(ctx, 1, 0); /* 000000ff CLIPID_ADDRESS_HIGH */ 1796 xf_emit(ctx, 1, 0); /* ffffffff CLIPID_ADDRESS_LOW */ 1797 xf_emit(ctx, 1, 0x80); /* 00003fff CLIPID_HEIGHT */ 1798 xf_emit(ctx, 1, 0); /* 0000ffff DMA_CLIPID */ 1799 } 1800 1801 static void 1802 nv50_gr_construct_gene_unk24xx(struct nvkm_grctx *ctx) 1803 { 1804 struct nvkm_device *device = ctx->device; 1805 int i; 1806 /* middle of strand 0 on pre-NVA0 [after m2mf], end of strand 2 on NVAx */ 1807 /* SEEK */ 1808 xf_emit(ctx, 0x33, 0); 1809 /* SEEK */ 1810 xf_emit(ctx, 2, 0); 1811 /* SEEK */ 1812 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1813 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1814 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 1815 /* SEEK */ 1816 if (IS_NVA3F(device->chipset)) { 1817 xf_emit(ctx, 4, 0); /* RO */ 1818 xf_emit(ctx, 0xe10, 0); /* 190 * 9: 8*ffffffff, 7ff */ 1819 xf_emit(ctx, 1, 0); /* 1ff */ 1820 xf_emit(ctx, 8, 0); /* 0? */ 1821 xf_emit(ctx, 9, 0); /* ffffffff, 7ff */ 1822 1823 xf_emit(ctx, 4, 0); /* RO */ 1824 xf_emit(ctx, 0xe10, 0); /* 190 * 9: 8*ffffffff, 7ff */ 1825 xf_emit(ctx, 1, 0); /* 1ff */ 1826 xf_emit(ctx, 8, 0); /* 0? */ 1827 xf_emit(ctx, 9, 0); /* ffffffff, 7ff */ 1828 } else { 1829 xf_emit(ctx, 0xc, 0); /* RO */ 1830 /* SEEK */ 1831 xf_emit(ctx, 0xe10, 0); /* 190 * 9: 8*ffffffff, 7ff */ 1832 xf_emit(ctx, 1, 0); /* 1ff */ 1833 xf_emit(ctx, 8, 0); /* 0? */ 1834 1835 /* SEEK */ 1836 xf_emit(ctx, 0xc, 0); /* RO */ 1837 /* SEEK */ 1838 xf_emit(ctx, 0xe10, 0); /* 190 * 9: 8*ffffffff, 7ff */ 1839 xf_emit(ctx, 1, 0); /* 1ff */ 1840 xf_emit(ctx, 8, 0); /* 0? */ 1841 } 1842 /* SEEK */ 1843 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1844 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 1845 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 1846 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 1847 if (device->chipset != 0x50) 1848 xf_emit(ctx, 1, 3); /* 00000003 tesla UNK1100 */ 1849 /* SEEK */ 1850 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1851 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 1852 xf_emit(ctx, 1, 0); /* 0000000f VP_GP_BUILTIN_ATTR_EN */ 1853 xf_emit(ctx, 1, 0x80c14); /* 01ffffff SEMANTIC_COLOR */ 1854 xf_emit(ctx, 1, 1); /* 00000001 */ 1855 /* SEEK */ 1856 if (device->chipset >= 0xa0) 1857 xf_emit(ctx, 2, 4); /* 000000ff */ 1858 xf_emit(ctx, 1, 0x80c14); /* 01ffffff SEMANTIC_COLOR */ 1859 xf_emit(ctx, 1, 0); /* 00000001 VERTEX_TWO_SIDE_ENABLE */ 1860 xf_emit(ctx, 1, 0); /* 00000001 POINT_SPRITE_ENABLE */ 1861 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 1862 xf_emit(ctx, 1, 0x27); /* 000000ff SEMANTIC_PRIM_ID */ 1863 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1864 xf_emit(ctx, 1, 0); /* 0000000f */ 1865 xf_emit(ctx, 1, 1); /* 00000001 */ 1866 for (i = 0; i < 10; i++) { 1867 /* SEEK */ 1868 xf_emit(ctx, 0x40, 0); /* ffffffff */ 1869 xf_emit(ctx, 0x10, 0); /* 3, 0, 0.... */ 1870 xf_emit(ctx, 0x10, 0); /* ffffffff */ 1871 } 1872 /* SEEK */ 1873 xf_emit(ctx, 1, 0); /* 00000001 POINT_SPRITE_CTRL */ 1874 xf_emit(ctx, 1, 1); /* 00000001 */ 1875 xf_emit(ctx, 1, 0); /* ffffffff */ 1876 xf_emit(ctx, 4, 0); /* ffffffff NOPERSPECTIVE_BITMAP */ 1877 xf_emit(ctx, 0x10, 0); /* 00ffffff POINT_COORD_REPLACE_MAP */ 1878 xf_emit(ctx, 1, 0); /* 00000003 WINDOW_ORIGIN */ 1879 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 1880 if (device->chipset != 0x50) 1881 xf_emit(ctx, 1, 0); /* 000003ff */ 1882 } 1883 1884 static void 1885 nv50_gr_construct_gene_vfetch(struct nvkm_grctx *ctx) 1886 { 1887 struct nvkm_device *device = ctx->device; 1888 int acnt = 0x10, rep, i; 1889 /* beginning of strand 1 on pre-NVA0, strand 3 on NVAx */ 1890 if (IS_NVA3F(device->chipset)) 1891 acnt = 0x20; 1892 /* SEEK */ 1893 if (device->chipset >= 0xa0) { 1894 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK13A4 */ 1895 xf_emit(ctx, 1, 1); /* 00000fff tesla UNK1318 */ 1896 } 1897 xf_emit(ctx, 1, 0); /* ffffffff VERTEX_BUFFER_FIRST */ 1898 xf_emit(ctx, 1, 0); /* 00000001 PRIMITIVE_RESTART_ENABLE */ 1899 xf_emit(ctx, 1, 0); /* 00000001 UNK0DE8 */ 1900 xf_emit(ctx, 1, 0); /* ffffffff PRIMITIVE_RESTART_INDEX */ 1901 xf_emit(ctx, 1, 0xf); /* ffffffff VP_ATTR_EN */ 1902 xf_emit(ctx, (acnt/8)-1, 0); /* ffffffff VP_ATTR_EN */ 1903 xf_emit(ctx, acnt/8, 0); /* ffffffff VTX_ATR_MASK_UNK0DD0 */ 1904 xf_emit(ctx, 1, 0); /* 0000000f VP_GP_BUILTIN_ATTR_EN */ 1905 xf_emit(ctx, 1, 0x20); /* 0000ffff tesla UNK129C */ 1906 xf_emit(ctx, 1, 0); /* 000000ff turing UNK370??? */ 1907 xf_emit(ctx, 1, 0); /* 0000ffff turing USER_PARAM_COUNT */ 1908 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 1909 /* SEEK */ 1910 if (IS_NVA3F(device->chipset)) 1911 xf_emit(ctx, 0xb, 0); /* RO */ 1912 else if (device->chipset >= 0xa0) 1913 xf_emit(ctx, 0x9, 0); /* RO */ 1914 else 1915 xf_emit(ctx, 0x8, 0); /* RO */ 1916 /* SEEK */ 1917 xf_emit(ctx, 1, 0); /* 00000001 EDGE_FLAG */ 1918 xf_emit(ctx, 1, 0); /* 00000001 PROVOKING_VERTEX_LAST */ 1919 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1920 xf_emit(ctx, 1, 0x1a); /* 0000001f POLYGON_MODE */ 1921 /* SEEK */ 1922 xf_emit(ctx, 0xc, 0); /* RO */ 1923 /* SEEK */ 1924 xf_emit(ctx, 1, 0); /* 7f/ff */ 1925 xf_emit(ctx, 1, 4); /* 7f/ff VP_REG_ALLOC_RESULT */ 1926 xf_emit(ctx, 1, 4); /* 7f/ff VP_RESULT_MAP_SIZE */ 1927 xf_emit(ctx, 1, 0); /* 0000000f VP_GP_BUILTIN_ATTR_EN */ 1928 xf_emit(ctx, 1, 4); /* 000001ff UNK1A28 */ 1929 xf_emit(ctx, 1, 8); /* 000001ff UNK0DF0 */ 1930 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 1931 if (device->chipset == 0x50) 1932 xf_emit(ctx, 1, 0x3ff); /* 3ff tesla UNK0D68 */ 1933 else 1934 xf_emit(ctx, 1, 0x7ff); /* 7ff tesla UNK0D68 */ 1935 if (device->chipset == 0xa8) 1936 xf_emit(ctx, 1, 0x1e00); /* 7fff */ 1937 /* SEEK */ 1938 xf_emit(ctx, 0xc, 0); /* RO or close */ 1939 /* SEEK */ 1940 xf_emit(ctx, 1, 0xf); /* ffffffff VP_ATTR_EN */ 1941 xf_emit(ctx, (acnt/8)-1, 0); /* ffffffff VP_ATTR_EN */ 1942 xf_emit(ctx, 1, 0); /* 0000000f VP_GP_BUILTIN_ATTR_EN */ 1943 if (device->chipset > 0x50 && device->chipset < 0xa0) 1944 xf_emit(ctx, 2, 0); /* ffffffff */ 1945 else 1946 xf_emit(ctx, 1, 0); /* ffffffff */ 1947 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK0FD8 */ 1948 /* SEEK */ 1949 if (IS_NVA3F(device->chipset)) { 1950 xf_emit(ctx, 0x10, 0); /* 0? */ 1951 xf_emit(ctx, 2, 0); /* weird... */ 1952 xf_emit(ctx, 2, 0); /* RO */ 1953 } else { 1954 xf_emit(ctx, 8, 0); /* 0? */ 1955 xf_emit(ctx, 1, 0); /* weird... */ 1956 xf_emit(ctx, 2, 0); /* RO */ 1957 } 1958 /* SEEK */ 1959 xf_emit(ctx, 1, 0); /* ffffffff VB_ELEMENT_BASE */ 1960 xf_emit(ctx, 1, 0); /* ffffffff UNK1438 */ 1961 xf_emit(ctx, acnt, 0); /* 1 tesla UNK1000 */ 1962 if (device->chipset >= 0xa0) 1963 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1118? */ 1964 /* SEEK */ 1965 xf_emit(ctx, acnt, 0); /* ffffffff VERTEX_ARRAY_UNK90C */ 1966 xf_emit(ctx, 1, 0); /* f/1f */ 1967 /* SEEK */ 1968 xf_emit(ctx, acnt, 0); /* ffffffff VERTEX_ARRAY_UNK90C */ 1969 xf_emit(ctx, 1, 0); /* f/1f */ 1970 /* SEEK */ 1971 xf_emit(ctx, acnt, 0); /* RO */ 1972 xf_emit(ctx, 2, 0); /* RO */ 1973 /* SEEK */ 1974 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK111C? */ 1975 xf_emit(ctx, 1, 0); /* RO */ 1976 /* SEEK */ 1977 xf_emit(ctx, 1, 0); /* 000000ff UNK15F4_ADDRESS_HIGH */ 1978 xf_emit(ctx, 1, 0); /* ffffffff UNK15F4_ADDRESS_LOW */ 1979 xf_emit(ctx, 1, 0); /* 000000ff UNK0F84_ADDRESS_HIGH */ 1980 xf_emit(ctx, 1, 0); /* ffffffff UNK0F84_ADDRESS_LOW */ 1981 /* SEEK */ 1982 xf_emit(ctx, acnt, 0); /* 00003fff VERTEX_ARRAY_ATTRIB_OFFSET */ 1983 xf_emit(ctx, 3, 0); /* f/1f */ 1984 /* SEEK */ 1985 xf_emit(ctx, acnt, 0); /* 00000fff VERTEX_ARRAY_STRIDE */ 1986 xf_emit(ctx, 3, 0); /* f/1f */ 1987 /* SEEK */ 1988 xf_emit(ctx, acnt, 0); /* ffffffff VERTEX_ARRAY_LOW */ 1989 xf_emit(ctx, 3, 0); /* f/1f */ 1990 /* SEEK */ 1991 xf_emit(ctx, acnt, 0); /* 000000ff VERTEX_ARRAY_HIGH */ 1992 xf_emit(ctx, 3, 0); /* f/1f */ 1993 /* SEEK */ 1994 xf_emit(ctx, acnt, 0); /* ffffffff VERTEX_LIMIT_LOW */ 1995 xf_emit(ctx, 3, 0); /* f/1f */ 1996 /* SEEK */ 1997 xf_emit(ctx, acnt, 0); /* 000000ff VERTEX_LIMIT_HIGH */ 1998 xf_emit(ctx, 3, 0); /* f/1f */ 1999 /* SEEK */ 2000 if (IS_NVA3F(device->chipset)) { 2001 xf_emit(ctx, acnt, 0); /* f */ 2002 xf_emit(ctx, 3, 0); /* f/1f */ 2003 } 2004 /* SEEK */ 2005 if (IS_NVA3F(device->chipset)) 2006 xf_emit(ctx, 2, 0); /* RO */ 2007 else 2008 xf_emit(ctx, 5, 0); /* RO */ 2009 /* SEEK */ 2010 xf_emit(ctx, 1, 0); /* ffff DMA_VTXBUF */ 2011 /* SEEK */ 2012 if (device->chipset < 0xa0) { 2013 xf_emit(ctx, 0x41, 0); /* RO */ 2014 /* SEEK */ 2015 xf_emit(ctx, 0x11, 0); /* RO */ 2016 } else if (!IS_NVA3F(device->chipset)) 2017 xf_emit(ctx, 0x50, 0); /* RO */ 2018 else 2019 xf_emit(ctx, 0x58, 0); /* RO */ 2020 /* SEEK */ 2021 xf_emit(ctx, 1, 0xf); /* ffffffff VP_ATTR_EN */ 2022 xf_emit(ctx, (acnt/8)-1, 0); /* ffffffff VP_ATTR_EN */ 2023 xf_emit(ctx, 1, 1); /* 1 UNK0DEC */ 2024 /* SEEK */ 2025 xf_emit(ctx, acnt*4, 0); /* ffffffff VTX_ATTR */ 2026 xf_emit(ctx, 4, 0); /* f/1f, 0, 0, 0 */ 2027 /* SEEK */ 2028 if (IS_NVA3F(device->chipset)) 2029 xf_emit(ctx, 0x1d, 0); /* RO */ 2030 else 2031 xf_emit(ctx, 0x16, 0); /* RO */ 2032 /* SEEK */ 2033 xf_emit(ctx, 1, 0xf); /* ffffffff VP_ATTR_EN */ 2034 xf_emit(ctx, (acnt/8)-1, 0); /* ffffffff VP_ATTR_EN */ 2035 /* SEEK */ 2036 if (device->chipset < 0xa0) 2037 xf_emit(ctx, 8, 0); /* RO */ 2038 else if (IS_NVA3F(device->chipset)) 2039 xf_emit(ctx, 0xc, 0); /* RO */ 2040 else 2041 xf_emit(ctx, 7, 0); /* RO */ 2042 /* SEEK */ 2043 xf_emit(ctx, 0xa, 0); /* RO */ 2044 if (device->chipset == 0xa0) 2045 rep = 0xc; 2046 else 2047 rep = 4; 2048 for (i = 0; i < rep; i++) { 2049 /* SEEK */ 2050 if (IS_NVA3F(device->chipset)) 2051 xf_emit(ctx, 0x20, 0); /* ffffffff */ 2052 xf_emit(ctx, 0x200, 0); /* ffffffff */ 2053 xf_emit(ctx, 4, 0); /* 7f/ff, 0, 0, 0 */ 2054 xf_emit(ctx, 4, 0); /* ffffffff */ 2055 } 2056 /* SEEK */ 2057 xf_emit(ctx, 1, 0); /* 113/111 */ 2058 xf_emit(ctx, 1, 0xf); /* ffffffff VP_ATTR_EN */ 2059 xf_emit(ctx, (acnt/8)-1, 0); /* ffffffff VP_ATTR_EN */ 2060 xf_emit(ctx, acnt/8, 0); /* ffffffff VTX_ATTR_MASK_UNK0DD0 */ 2061 xf_emit(ctx, 1, 0); /* 0000000f VP_GP_BUILTIN_ATTR_EN */ 2062 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2063 /* SEEK */ 2064 if (IS_NVA3F(device->chipset)) 2065 xf_emit(ctx, 7, 0); /* weird... */ 2066 else 2067 xf_emit(ctx, 5, 0); /* weird... */ 2068 } 2069 2070 static void 2071 nv50_gr_construct_gene_eng2d(struct nvkm_grctx *ctx) 2072 { 2073 struct nvkm_device *device = ctx->device; 2074 /* middle of strand 1 on pre-NVA0 [after vfetch], middle of strand 6 on NVAx */ 2075 /* SEEK */ 2076 xf_emit(ctx, 2, 0); /* 0001ffff CLIP_X, CLIP_Y */ 2077 xf_emit(ctx, 2, 0); /* 0000ffff CLIP_W, CLIP_H */ 2078 xf_emit(ctx, 1, 0); /* 00000001 CLIP_ENABLE */ 2079 if (device->chipset < 0xa0) { 2080 /* this is useless on everything but the original NV50, 2081 * guess they forgot to nuke it. Or just didn't bother. */ 2082 xf_emit(ctx, 2, 0); /* 0000ffff IFC_CLIP_X, Y */ 2083 xf_emit(ctx, 2, 1); /* 0000ffff IFC_CLIP_W, H */ 2084 xf_emit(ctx, 1, 0); /* 00000001 IFC_CLIP_ENABLE */ 2085 } 2086 xf_emit(ctx, 1, 1); /* 00000001 DST_LINEAR */ 2087 xf_emit(ctx, 1, 0x100); /* 0001ffff DST_WIDTH */ 2088 xf_emit(ctx, 1, 0x100); /* 0001ffff DST_HEIGHT */ 2089 xf_emit(ctx, 1, 0x11); /* 3f[NV50]/7f[NV84+] DST_FORMAT */ 2090 xf_emit(ctx, 1, 0); /* 0001ffff DRAW_POINT_X */ 2091 xf_emit(ctx, 1, 8); /* 0000000f DRAW_UNK58C */ 2092 xf_emit(ctx, 1, 0); /* 000fffff SIFC_DST_X_FRACT */ 2093 xf_emit(ctx, 1, 0); /* 0001ffff SIFC_DST_X_INT */ 2094 xf_emit(ctx, 1, 0); /* 000fffff SIFC_DST_Y_FRACT */ 2095 xf_emit(ctx, 1, 0); /* 0001ffff SIFC_DST_Y_INT */ 2096 xf_emit(ctx, 1, 0); /* 000fffff SIFC_DX_DU_FRACT */ 2097 xf_emit(ctx, 1, 1); /* 0001ffff SIFC_DX_DU_INT */ 2098 xf_emit(ctx, 1, 0); /* 000fffff SIFC_DY_DV_FRACT */ 2099 xf_emit(ctx, 1, 1); /* 0001ffff SIFC_DY_DV_INT */ 2100 xf_emit(ctx, 1, 1); /* 0000ffff SIFC_WIDTH */ 2101 xf_emit(ctx, 1, 1); /* 0000ffff SIFC_HEIGHT */ 2102 xf_emit(ctx, 1, 0xcf); /* 000000ff SIFC_FORMAT */ 2103 xf_emit(ctx, 1, 2); /* 00000003 SIFC_BITMAP_UNK808 */ 2104 xf_emit(ctx, 1, 0); /* 00000003 SIFC_BITMAP_LINE_PACK_MODE */ 2105 xf_emit(ctx, 1, 0); /* 00000001 SIFC_BITMAP_LSB_FIRST */ 2106 xf_emit(ctx, 1, 0); /* 00000001 SIFC_BITMAP_ENABLE */ 2107 xf_emit(ctx, 1, 0); /* 0000ffff BLIT_DST_X */ 2108 xf_emit(ctx, 1, 0); /* 0000ffff BLIT_DST_Y */ 2109 xf_emit(ctx, 1, 0); /* 000fffff BLIT_DU_DX_FRACT */ 2110 xf_emit(ctx, 1, 1); /* 0001ffff BLIT_DU_DX_INT */ 2111 xf_emit(ctx, 1, 0); /* 000fffff BLIT_DV_DY_FRACT */ 2112 xf_emit(ctx, 1, 1); /* 0001ffff BLIT_DV_DY_INT */ 2113 xf_emit(ctx, 1, 1); /* 0000ffff BLIT_DST_W */ 2114 xf_emit(ctx, 1, 1); /* 0000ffff BLIT_DST_H */ 2115 xf_emit(ctx, 1, 0); /* 000fffff BLIT_SRC_X_FRACT */ 2116 xf_emit(ctx, 1, 0); /* 0001ffff BLIT_SRC_X_INT */ 2117 xf_emit(ctx, 1, 0); /* 000fffff BLIT_SRC_Y_FRACT */ 2118 xf_emit(ctx, 1, 0); /* 00000001 UNK888 */ 2119 xf_emit(ctx, 1, 4); /* 0000003f UNK884 */ 2120 xf_emit(ctx, 1, 0); /* 00000007 UNK880 */ 2121 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK0FB8 */ 2122 xf_emit(ctx, 1, 0x15); /* 000000ff tesla UNK128C */ 2123 xf_emit(ctx, 2, 0); /* 00000007, ffff0ff3 */ 2124 xf_emit(ctx, 1, 0); /* 00000001 UNK260 */ 2125 xf_emit(ctx, 1, 0x4444480); /* 1fffffff UNK870 */ 2126 /* SEEK */ 2127 xf_emit(ctx, 0x10, 0); 2128 /* SEEK */ 2129 xf_emit(ctx, 0x27, 0); 2130 } 2131 2132 static void 2133 nv50_gr_construct_gene_csched(struct nvkm_grctx *ctx) 2134 { 2135 struct nvkm_device *device = ctx->device; 2136 /* middle of strand 1 on pre-NVA0 [after eng2d], middle of strand 0 on NVAx */ 2137 /* SEEK */ 2138 xf_emit(ctx, 2, 0); /* 00007fff WINDOW_OFFSET_XY... what is it doing here??? */ 2139 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1924 */ 2140 xf_emit(ctx, 1, 0); /* 00000003 WINDOW_ORIGIN */ 2141 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 2142 xf_emit(ctx, 1, 0); /* 000003ff */ 2143 /* SEEK */ 2144 xf_emit(ctx, 1, 0); /* ffffffff turing UNK364 */ 2145 xf_emit(ctx, 1, 0); /* 0000000f turing UNK36C */ 2146 xf_emit(ctx, 1, 0); /* 0000ffff USER_PARAM_COUNT */ 2147 xf_emit(ctx, 1, 0x100); /* 00ffffff turing UNK384 */ 2148 xf_emit(ctx, 1, 0); /* 0000000f turing UNK2A0 */ 2149 xf_emit(ctx, 1, 0); /* 0000ffff GRIDID */ 2150 xf_emit(ctx, 1, 0x10001); /* ffffffff GRIDDIM_XY */ 2151 xf_emit(ctx, 1, 0); /* ffffffff */ 2152 xf_emit(ctx, 1, 0x10001); /* ffffffff BLOCKDIM_XY */ 2153 xf_emit(ctx, 1, 1); /* 0000ffff BLOCKDIM_Z */ 2154 xf_emit(ctx, 1, 0x10001); /* 00ffffff BLOCK_ALLOC */ 2155 xf_emit(ctx, 1, 1); /* 00000001 LANES32 */ 2156 xf_emit(ctx, 1, 4); /* 000000ff FP_REG_ALLOC_TEMP */ 2157 xf_emit(ctx, 1, 2); /* 00000003 REG_MODE */ 2158 /* SEEK */ 2159 xf_emit(ctx, 0x40, 0); /* ffffffff USER_PARAM */ 2160 switch (device->chipset) { 2161 case 0x50: 2162 case 0x92: 2163 xf_emit(ctx, 8, 0); /* 7, 0, 0, 0, ... */ 2164 xf_emit(ctx, 0x80, 0); /* fff */ 2165 xf_emit(ctx, 2, 0); /* ff, fff */ 2166 xf_emit(ctx, 0x10*2, 0); /* ffffffff, 1f */ 2167 break; 2168 case 0x84: 2169 xf_emit(ctx, 8, 0); /* 7, 0, 0, 0, ... */ 2170 xf_emit(ctx, 0x60, 0); /* fff */ 2171 xf_emit(ctx, 2, 0); /* ff, fff */ 2172 xf_emit(ctx, 0xc*2, 0); /* ffffffff, 1f */ 2173 break; 2174 case 0x94: 2175 case 0x96: 2176 xf_emit(ctx, 8, 0); /* 7, 0, 0, 0, ... */ 2177 xf_emit(ctx, 0x40, 0); /* fff */ 2178 xf_emit(ctx, 2, 0); /* ff, fff */ 2179 xf_emit(ctx, 8*2, 0); /* ffffffff, 1f */ 2180 break; 2181 case 0x86: 2182 case 0x98: 2183 xf_emit(ctx, 4, 0); /* f, 0, 0, 0 */ 2184 xf_emit(ctx, 0x10, 0); /* fff */ 2185 xf_emit(ctx, 2, 0); /* ff, fff */ 2186 xf_emit(ctx, 2*2, 0); /* ffffffff, 1f */ 2187 break; 2188 case 0xa0: 2189 xf_emit(ctx, 8, 0); /* 7, 0, 0, 0, ... */ 2190 xf_emit(ctx, 0xf0, 0); /* fff */ 2191 xf_emit(ctx, 2, 0); /* ff, fff */ 2192 xf_emit(ctx, 0x1e*2, 0); /* ffffffff, 1f */ 2193 break; 2194 case 0xa3: 2195 xf_emit(ctx, 8, 0); /* 7, 0, 0, 0, ... */ 2196 xf_emit(ctx, 0x60, 0); /* fff */ 2197 xf_emit(ctx, 2, 0); /* ff, fff */ 2198 xf_emit(ctx, 0xc*2, 0); /* ffffffff, 1f */ 2199 break; 2200 case 0xa5: 2201 case 0xaf: 2202 xf_emit(ctx, 8, 0); /* 7, 0, 0, 0, ... */ 2203 xf_emit(ctx, 0x30, 0); /* fff */ 2204 xf_emit(ctx, 2, 0); /* ff, fff */ 2205 xf_emit(ctx, 6*2, 0); /* ffffffff, 1f */ 2206 break; 2207 case 0xaa: 2208 xf_emit(ctx, 0x12, 0); 2209 break; 2210 case 0xa8: 2211 case 0xac: 2212 xf_emit(ctx, 4, 0); /* f, 0, 0, 0 */ 2213 xf_emit(ctx, 0x10, 0); /* fff */ 2214 xf_emit(ctx, 2, 0); /* ff, fff */ 2215 xf_emit(ctx, 2*2, 0); /* ffffffff, 1f */ 2216 break; 2217 } 2218 xf_emit(ctx, 1, 0); /* 0000000f */ 2219 xf_emit(ctx, 1, 0); /* 00000000 */ 2220 xf_emit(ctx, 1, 0); /* ffffffff */ 2221 xf_emit(ctx, 1, 0); /* 0000001f */ 2222 xf_emit(ctx, 4, 0); /* ffffffff */ 2223 xf_emit(ctx, 1, 0); /* 00000003 turing UNK35C */ 2224 xf_emit(ctx, 1, 0); /* ffffffff */ 2225 xf_emit(ctx, 4, 0); /* ffffffff */ 2226 xf_emit(ctx, 1, 0); /* 00000003 turing UNK35C */ 2227 xf_emit(ctx, 1, 0); /* ffffffff */ 2228 xf_emit(ctx, 1, 0); /* 000000ff */ 2229 } 2230 2231 static void 2232 nv50_gr_construct_gene_unk1cxx(struct nvkm_grctx *ctx) 2233 { 2234 struct nvkm_device *device = ctx->device; 2235 xf_emit(ctx, 2, 0); /* 00007fff WINDOW_OFFSET_XY */ 2236 xf_emit(ctx, 1, 0x3f800000); /* ffffffff LINE_WIDTH */ 2237 xf_emit(ctx, 1, 0); /* 00000001 LINE_SMOOTH_ENABLE */ 2238 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1658 */ 2239 xf_emit(ctx, 1, 0); /* 00000001 POLYGON_SMOOTH_ENABLE */ 2240 xf_emit(ctx, 3, 0); /* 00000001 POLYGON_OFFSET_*_ENABLE */ 2241 xf_emit(ctx, 1, 4); /* 0000000f CULL_MODE */ 2242 xf_emit(ctx, 1, 0x1a); /* 0000001f POLYGON_MODE */ 2243 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2244 xf_emit(ctx, 1, 0); /* 00000001 POINT_SPRITE_ENABLE */ 2245 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK165C */ 2246 xf_emit(ctx, 0x10, 0); /* 00000001 SCISSOR_ENABLE */ 2247 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2248 xf_emit(ctx, 1, 0); /* 00000001 LINE_STIPPLE_ENABLE */ 2249 xf_emit(ctx, 1, 0x00ffff00); /* 00ffffff LINE_STIPPLE_PATTERN */ 2250 xf_emit(ctx, 1, 0); /* ffffffff POLYGON_OFFSET_UNITS */ 2251 xf_emit(ctx, 1, 0); /* ffffffff POLYGON_OFFSET_FACTOR */ 2252 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1668 */ 2253 xf_emit(ctx, 2, 0); /* 07ffffff SCREEN_SCISSOR */ 2254 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 2255 xf_emit(ctx, 1, 0xf); /* 0000000f COLOR_MASK */ 2256 xf_emit(ctx, 7, 0); /* 0000000f COLOR_MASK */ 2257 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2258 xf_emit(ctx, 1, 0x11); /* 0000007f RT_FORMAT */ 2259 xf_emit(ctx, 7, 0); /* 0000007f RT_FORMAT */ 2260 xf_emit(ctx, 8, 0); /* 00000001 RT_HORIZ_LINEAR */ 2261 xf_emit(ctx, 1, 4); /* 00000007 FP_CONTROL */ 2262 xf_emit(ctx, 1, 0); /* 00000001 ALPHA_TEST_ENABLE */ 2263 xf_emit(ctx, 1, 0); /* 00000007 ALPHA_TEST_FUNC */ 2264 if (IS_NVA3F(device->chipset)) 2265 xf_emit(ctx, 1, 3); /* 00000003 UNK16B4 */ 2266 else if (device->chipset >= 0xa0) 2267 xf_emit(ctx, 1, 1); /* 00000001 UNK16B4 */ 2268 xf_emit(ctx, 1, 0); /* 00000003 MULTISAMPLE_CTRL */ 2269 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK0F90 */ 2270 xf_emit(ctx, 1, 2); /* 00000003 tesla UNK143C */ 2271 xf_emit(ctx, 2, 0x04000000); /* 07ffffff tesla UNK0D6C */ 2272 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_MASK */ 2273 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2274 xf_emit(ctx, 1, 0); /* 00000001 SAMPLECNT_ENABLE */ 2275 xf_emit(ctx, 1, 5); /* 0000000f UNK1408 */ 2276 xf_emit(ctx, 1, 0x52); /* 000001ff SEMANTIC_PTSZ */ 2277 xf_emit(ctx, 1, 0); /* ffffffff POINT_SIZE */ 2278 xf_emit(ctx, 1, 0); /* 00000001 */ 2279 xf_emit(ctx, 1, 0); /* 00000007 tesla UNK0FB4 */ 2280 if (device->chipset != 0x50) { 2281 xf_emit(ctx, 1, 0); /* 3ff */ 2282 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK1110 */ 2283 } 2284 if (IS_NVA3F(device->chipset)) 2285 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1928 */ 2286 xf_emit(ctx, 0x10, 0); /* ffffffff DEPTH_RANGE_NEAR */ 2287 xf_emit(ctx, 0x10, 0x3f800000); /* ffffffff DEPTH_RANGE_FAR */ 2288 xf_emit(ctx, 1, 0x10); /* 000000ff VIEW_VOLUME_CLIP_CTRL */ 2289 xf_emit(ctx, 0x20, 0); /* 07ffffff VIEWPORT_HORIZ, then VIEWPORT_VERT. (W&0x3fff)<<13 | (X&0x1fff). */ 2290 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK187C */ 2291 xf_emit(ctx, 1, 0); /* 00000003 WINDOW_ORIGIN */ 2292 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2293 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2294 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_BACK_ENABLE */ 2295 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_MASK */ 2296 xf_emit(ctx, 1, 0x8100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 2297 xf_emit(ctx, 1, 5); /* 0000000f tesla UNK1220 */ 2298 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 2299 xf_emit(ctx, 1, 0); /* 000000ff tesla UNK1A20 */ 2300 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2301 xf_emit(ctx, 1, 0); /* 00000001 VERTEX_TWO_SIDE_ENABLE */ 2302 xf_emit(ctx, 4, 0xffff); /* 0000ffff MSAA_MASK */ 2303 if (device->chipset != 0x50) 2304 xf_emit(ctx, 1, 3); /* 00000003 tesla UNK1100 */ 2305 if (device->chipset < 0xa0) 2306 xf_emit(ctx, 0x1c, 0); /* RO */ 2307 else if (IS_NVA3F(device->chipset)) 2308 xf_emit(ctx, 0x9, 0); 2309 xf_emit(ctx, 1, 0); /* 00000001 UNK1534 */ 2310 xf_emit(ctx, 1, 0); /* 00000001 LINE_SMOOTH_ENABLE */ 2311 xf_emit(ctx, 1, 0); /* 00000001 LINE_STIPPLE_ENABLE */ 2312 xf_emit(ctx, 1, 0x00ffff00); /* 00ffffff LINE_STIPPLE_PATTERN */ 2313 xf_emit(ctx, 1, 0x1a); /* 0000001f POLYGON_MODE */ 2314 xf_emit(ctx, 1, 0); /* 00000003 WINDOW_ORIGIN */ 2315 if (device->chipset != 0x50) { 2316 xf_emit(ctx, 1, 3); /* 00000003 tesla UNK1100 */ 2317 xf_emit(ctx, 1, 0); /* 3ff */ 2318 } 2319 /* XXX: the following block could belong either to unk1cxx, or 2320 * to STRMOUT. Rather hard to tell. */ 2321 if (device->chipset < 0xa0) 2322 xf_emit(ctx, 0x25, 0); 2323 else 2324 xf_emit(ctx, 0x3b, 0); 2325 } 2326 2327 static void 2328 nv50_gr_construct_gene_strmout(struct nvkm_grctx *ctx) 2329 { 2330 struct nvkm_device *device = ctx->device; 2331 xf_emit(ctx, 1, 0x102); /* 0000ffff STRMOUT_BUFFER_CTRL */ 2332 xf_emit(ctx, 1, 0); /* ffffffff STRMOUT_PRIMITIVE_COUNT */ 2333 xf_emit(ctx, 4, 4); /* 000000ff STRMOUT_NUM_ATTRIBS */ 2334 if (device->chipset >= 0xa0) { 2335 xf_emit(ctx, 4, 0); /* ffffffff UNK1A8C */ 2336 xf_emit(ctx, 4, 0); /* ffffffff UNK1780 */ 2337 } 2338 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 2339 xf_emit(ctx, 1, 4); /* 0000007f VP_RESULT_MAP_SIZE */ 2340 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2341 if (device->chipset == 0x50) 2342 xf_emit(ctx, 1, 0x3ff); /* 000003ff tesla UNK0D68 */ 2343 else 2344 xf_emit(ctx, 1, 0x7ff); /* 000007ff tesla UNK0D68 */ 2345 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2346 /* SEEK */ 2347 xf_emit(ctx, 1, 0x102); /* 0000ffff STRMOUT_BUFFER_CTRL */ 2348 xf_emit(ctx, 1, 0); /* ffffffff STRMOUT_PRIMITIVE_COUNT */ 2349 xf_emit(ctx, 4, 0); /* 000000ff STRMOUT_ADDRESS_HIGH */ 2350 xf_emit(ctx, 4, 0); /* ffffffff STRMOUT_ADDRESS_LOW */ 2351 xf_emit(ctx, 4, 4); /* 000000ff STRMOUT_NUM_ATTRIBS */ 2352 if (device->chipset >= 0xa0) { 2353 xf_emit(ctx, 4, 0); /* ffffffff UNK1A8C */ 2354 xf_emit(ctx, 4, 0); /* ffffffff UNK1780 */ 2355 } 2356 xf_emit(ctx, 1, 0); /* 0000ffff DMA_STRMOUT */ 2357 xf_emit(ctx, 1, 0); /* 0000ffff DMA_QUERY */ 2358 xf_emit(ctx, 1, 0); /* 000000ff QUERY_ADDRESS_HIGH */ 2359 xf_emit(ctx, 2, 0); /* ffffffff QUERY_ADDRESS_LOW QUERY_COUNTER */ 2360 xf_emit(ctx, 2, 0); /* ffffffff */ 2361 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2362 /* SEEK */ 2363 xf_emit(ctx, 0x20, 0); /* ffffffff STRMOUT_MAP */ 2364 xf_emit(ctx, 1, 0); /* 0000000f */ 2365 xf_emit(ctx, 1, 0); /* 00000000? */ 2366 xf_emit(ctx, 2, 0); /* ffffffff */ 2367 } 2368 2369 static void 2370 nv50_gr_construct_gene_ropm1(struct nvkm_grctx *ctx) 2371 { 2372 struct nvkm_device *device = ctx->device; 2373 xf_emit(ctx, 1, 0x4e3bfdf); /* ffffffff UNK0D64 */ 2374 xf_emit(ctx, 1, 0x4e3bfdf); /* ffffffff UNK0DF4 */ 2375 xf_emit(ctx, 1, 0); /* 00000007 */ 2376 xf_emit(ctx, 1, 0); /* 000003ff */ 2377 if (IS_NVA3F(device->chipset)) 2378 xf_emit(ctx, 1, 0x11); /* 000000ff tesla UNK1968 */ 2379 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2380 } 2381 2382 static void 2383 nv50_gr_construct_gene_ropm2(struct nvkm_grctx *ctx) 2384 { 2385 struct nvkm_device *device = ctx->device; 2386 /* SEEK */ 2387 xf_emit(ctx, 1, 0); /* 0000ffff DMA_QUERY */ 2388 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2389 xf_emit(ctx, 2, 0); /* ffffffff */ 2390 xf_emit(ctx, 1, 0); /* 000000ff QUERY_ADDRESS_HIGH */ 2391 xf_emit(ctx, 2, 0); /* ffffffff QUERY_ADDRESS_LOW, COUNTER */ 2392 xf_emit(ctx, 1, 0); /* 00000001 SAMPLECNT_ENABLE */ 2393 xf_emit(ctx, 1, 0); /* 7 */ 2394 /* SEEK */ 2395 xf_emit(ctx, 1, 0); /* 0000ffff DMA_QUERY */ 2396 xf_emit(ctx, 1, 0); /* 000000ff QUERY_ADDRESS_HIGH */ 2397 xf_emit(ctx, 2, 0); /* ffffffff QUERY_ADDRESS_LOW, COUNTER */ 2398 xf_emit(ctx, 1, 0x4e3bfdf); /* ffffffff UNK0D64 */ 2399 xf_emit(ctx, 1, 0x4e3bfdf); /* ffffffff UNK0DF4 */ 2400 xf_emit(ctx, 1, 0); /* 00000001 eng2d UNK260 */ 2401 xf_emit(ctx, 1, 0); /* ff/3ff */ 2402 xf_emit(ctx, 1, 0); /* 00000007 */ 2403 if (IS_NVA3F(device->chipset)) 2404 xf_emit(ctx, 1, 0x11); /* 000000ff tesla UNK1968 */ 2405 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2406 } 2407 2408 static void 2409 nv50_gr_construct_gene_ropc(struct nvkm_grctx *ctx) 2410 { 2411 struct nvkm_device *device = ctx->device; 2412 int magic2; 2413 if (device->chipset == 0x50) { 2414 magic2 = 0x00003e60; 2415 } else if (!IS_NVA3F(device->chipset)) { 2416 magic2 = 0x001ffe67; 2417 } else { 2418 magic2 = 0x00087e67; 2419 } 2420 xf_emit(ctx, 1, 0); /* f/7 MUTISAMPLE_SAMPLES_LOG2 */ 2421 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2422 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_BACK_FUNC_FUNC */ 2423 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_MASK */ 2424 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_MASK */ 2425 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_BACK_OP_FAIL, ZFAIL, ZPASS */ 2426 xf_emit(ctx, 1, 2); /* 00000003 tesla UNK143C */ 2427 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2428 xf_emit(ctx, 1, magic2); /* 001fffff tesla UNK0F78 */ 2429 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2430 xf_emit(ctx, 1, 0); /* 00000007 DEPTH_TEST_FUNC */ 2431 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2432 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2433 if (IS_NVA3F(device->chipset)) 2434 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2435 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_FRONT_FUNC_FUNC */ 2436 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_MASK */ 2437 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_MASK */ 2438 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_FRONT_OP_FAIL, ZFAIL, ZPASS */ 2439 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2440 if (device->chipset >= 0xa0 && !IS_NVAAF(device->chipset)) 2441 xf_emit(ctx, 1, 0x15); /* 000000ff */ 2442 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_BACK_ENABLE */ 2443 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK15B4 */ 2444 xf_emit(ctx, 1, 0x10); /* 3ff/ff VIEW_VOLUME_CLIP_CTRL */ 2445 xf_emit(ctx, 1, 0); /* ffffffff CLEAR_DEPTH */ 2446 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2447 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2448 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2449 if (device->chipset == 0x86 || device->chipset == 0x92 || device->chipset == 0x98 || device->chipset >= 0xa0) { 2450 xf_emit(ctx, 3, 0); /* ff, ffffffff, ffffffff */ 2451 xf_emit(ctx, 1, 4); /* 7 */ 2452 xf_emit(ctx, 1, 0x400); /* fffffff */ 2453 xf_emit(ctx, 1, 0x300); /* ffff */ 2454 xf_emit(ctx, 1, 0x1001); /* 1fff */ 2455 if (device->chipset != 0xa0) { 2456 if (IS_NVA3F(device->chipset)) 2457 xf_emit(ctx, 1, 0); /* 0000000f UNK15C8 */ 2458 else 2459 xf_emit(ctx, 1, 0x15); /* ff */ 2460 } 2461 } 2462 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 2463 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2464 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_BACK_FUNC_FUNC */ 2465 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_MASK */ 2466 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2467 xf_emit(ctx, 1, 2); /* 00000003 tesla UNK143C */ 2468 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2469 xf_emit(ctx, 1, 0); /* 00000007 DEPTH_TEST_FUNC */ 2470 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2471 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2472 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_FRONT_FUNC_FUNC */ 2473 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_MASK */ 2474 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2475 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_BACK_ENABLE */ 2476 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK15B4 */ 2477 xf_emit(ctx, 1, 0x10); /* 7f/ff VIEW_VOLUME_CLIP_CTRL */ 2478 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2479 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2480 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2481 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2482 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1900 */ 2483 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_BACK_FUNC_FUNC */ 2484 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_MASK */ 2485 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_REF */ 2486 xf_emit(ctx, 2, 0); /* ffffffff DEPTH_BOUNDS */ 2487 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2488 xf_emit(ctx, 1, 0); /* 00000007 DEPTH_TEST_FUNC */ 2489 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2490 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2491 xf_emit(ctx, 1, 0); /* 0000000f */ 2492 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK0FB0 */ 2493 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_FRONT_FUNC_FUNC */ 2494 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_MASK */ 2495 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_REF */ 2496 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2497 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_BACK_ENABLE */ 2498 xf_emit(ctx, 1, 0x10); /* 7f/ff VIEW_VOLUME_CLIP_CTRL */ 2499 xf_emit(ctx, 0x10, 0); /* ffffffff DEPTH_RANGE_NEAR */ 2500 xf_emit(ctx, 0x10, 0x3f800000); /* ffffffff DEPTH_RANGE_FAR */ 2501 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2502 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 2503 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_BACK_FUNC_FUNC */ 2504 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_MASK */ 2505 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_FUNC_REF */ 2506 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_MASK */ 2507 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_BACK_OP_FAIL, ZFAIL, ZPASS */ 2508 xf_emit(ctx, 2, 0); /* ffffffff DEPTH_BOUNDS */ 2509 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2510 xf_emit(ctx, 1, 0); /* 00000007 DEPTH_TEST_FUNC */ 2511 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2512 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2513 xf_emit(ctx, 1, 0); /* 000000ff CLEAR_STENCIL */ 2514 xf_emit(ctx, 1, 0); /* 00000007 STENCIL_FRONT_FUNC_FUNC */ 2515 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_MASK */ 2516 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_FUNC_REF */ 2517 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_MASK */ 2518 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_FRONT_OP_FAIL, ZFAIL, ZPASS */ 2519 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2520 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_BACK_ENABLE */ 2521 xf_emit(ctx, 1, 0x10); /* 7f/ff VIEW_VOLUME_CLIP_CTRL */ 2522 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2523 xf_emit(ctx, 1, 0x3f); /* 0000003f UNK1590 */ 2524 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 2525 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2526 xf_emit(ctx, 2, 0); /* ffff0ff3, ffff */ 2527 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK0FB0 */ 2528 xf_emit(ctx, 1, 0); /* 0001ffff GP_BUILTIN_RESULT_EN */ 2529 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK15B4 */ 2530 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2531 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2532 xf_emit(ctx, 1, 0); /* ffffffff CLEAR_DEPTH */ 2533 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK19CC */ 2534 if (device->chipset >= 0xa0) { 2535 xf_emit(ctx, 2, 0); 2536 xf_emit(ctx, 1, 0x1001); 2537 xf_emit(ctx, 0xb, 0); 2538 } else { 2539 xf_emit(ctx, 1, 0); /* 00000007 */ 2540 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2541 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 2542 xf_emit(ctx, 8, 0); /* 00000001 BLEND_ENABLE */ 2543 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2544 } 2545 xf_emit(ctx, 1, 0x11); /* 3f/7f RT_FORMAT */ 2546 xf_emit(ctx, 7, 0); /* 3f/7f RT_FORMAT */ 2547 xf_emit(ctx, 1, 0xf); /* 0000000f COLOR_MASK */ 2548 xf_emit(ctx, 7, 0); /* 0000000f COLOR_MASK */ 2549 xf_emit(ctx, 1, 0x11); /* 3f/7f */ 2550 xf_emit(ctx, 1, 0); /* 00000001 LOGIC_OP_ENABLE */ 2551 if (device->chipset != 0x50) { 2552 xf_emit(ctx, 1, 0); /* 0000000f LOGIC_OP */ 2553 xf_emit(ctx, 1, 0); /* 000000ff */ 2554 } 2555 xf_emit(ctx, 1, 0); /* 00000007 OPERATION */ 2556 xf_emit(ctx, 1, 0); /* ff/3ff */ 2557 xf_emit(ctx, 1, 0); /* 00000003 UNK0F90 */ 2558 xf_emit(ctx, 2, 1); /* 00000007 BLEND_EQUATION_RGB, ALPHA */ 2559 xf_emit(ctx, 1, 1); /* 00000001 UNK133C */ 2560 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_RGB */ 2561 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_RGB */ 2562 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_ALPHA */ 2563 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_ALPHA */ 2564 xf_emit(ctx, 1, 0); /* 00000001 */ 2565 xf_emit(ctx, 1, magic2); /* 001fffff tesla UNK0F78 */ 2566 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2567 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2568 if (IS_NVA3F(device->chipset)) { 2569 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK12E4 */ 2570 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_RGB */ 2571 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_ALPHA */ 2572 xf_emit(ctx, 8, 1); /* 00000001 IBLEND_UNK00 */ 2573 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_FUNC_SRC_RGB */ 2574 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_FUNC_DST_RGB */ 2575 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_FUNC_SRC_ALPHA */ 2576 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_FUNC_DST_ALPHA */ 2577 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1140 */ 2578 xf_emit(ctx, 2, 0); /* 00000001 */ 2579 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2580 xf_emit(ctx, 1, 0); /* 0000000f */ 2581 xf_emit(ctx, 1, 0); /* 00000003 */ 2582 xf_emit(ctx, 1, 0); /* ffffffff */ 2583 xf_emit(ctx, 2, 0); /* 00000001 */ 2584 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2585 xf_emit(ctx, 1, 0); /* 00000001 */ 2586 xf_emit(ctx, 1, 0); /* 000003ff */ 2587 } else if (device->chipset >= 0xa0) { 2588 xf_emit(ctx, 2, 0); /* 00000001 */ 2589 xf_emit(ctx, 1, 0); /* 00000007 */ 2590 xf_emit(ctx, 1, 0); /* 00000003 */ 2591 xf_emit(ctx, 1, 0); /* ffffffff */ 2592 xf_emit(ctx, 2, 0); /* 00000001 */ 2593 } else { 2594 xf_emit(ctx, 1, 0); /* 00000007 MULTISAMPLE_SAMPLES_LOG2 */ 2595 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1430 */ 2596 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2597 } 2598 xf_emit(ctx, 4, 0); /* ffffffff CLEAR_COLOR */ 2599 xf_emit(ctx, 4, 0); /* ffffffff BLEND_COLOR A R G B */ 2600 xf_emit(ctx, 1, 0); /* 00000fff eng2d UNK2B0 */ 2601 if (device->chipset >= 0xa0) 2602 xf_emit(ctx, 2, 0); /* 00000001 */ 2603 xf_emit(ctx, 1, 0); /* 000003ff */ 2604 xf_emit(ctx, 8, 0); /* 00000001 BLEND_ENABLE */ 2605 xf_emit(ctx, 1, 1); /* 00000001 UNK133C */ 2606 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_RGB */ 2607 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_RGB */ 2608 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_RGB */ 2609 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_ALPHA */ 2610 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_ALPHA */ 2611 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_ALPHA */ 2612 xf_emit(ctx, 1, 0); /* 00000001 UNK19C0 */ 2613 xf_emit(ctx, 1, 0); /* 00000001 LOGIC_OP_ENABLE */ 2614 xf_emit(ctx, 1, 0); /* 0000000f LOGIC_OP */ 2615 if (device->chipset >= 0xa0) 2616 xf_emit(ctx, 1, 0); /* 00000001 UNK12E4? NVA3+ only? */ 2617 if (IS_NVA3F(device->chipset)) { 2618 xf_emit(ctx, 8, 1); /* 00000001 IBLEND_UNK00 */ 2619 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_RGB */ 2620 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_FUNC_SRC_RGB */ 2621 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_FUNC_DST_RGB */ 2622 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_ALPHA */ 2623 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_FUNC_SRC_ALPHA */ 2624 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_FUNC_DST_ALPHA */ 2625 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK15C4 */ 2626 xf_emit(ctx, 1, 0); /* 00000001 */ 2627 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1140 */ 2628 } 2629 xf_emit(ctx, 1, 0x11); /* 3f/7f DST_FORMAT */ 2630 xf_emit(ctx, 1, 1); /* 00000001 DST_LINEAR */ 2631 xf_emit(ctx, 1, 0); /* 00000007 PATTERN_COLOR_FORMAT */ 2632 xf_emit(ctx, 2, 0); /* ffffffff PATTERN_MONO_COLOR */ 2633 xf_emit(ctx, 1, 0); /* 00000001 PATTERN_MONO_FORMAT */ 2634 xf_emit(ctx, 2, 0); /* ffffffff PATTERN_MONO_BITMAP */ 2635 xf_emit(ctx, 1, 0); /* 00000003 PATTERN_SELECT */ 2636 xf_emit(ctx, 1, 0); /* 000000ff ROP */ 2637 xf_emit(ctx, 1, 0); /* ffffffff BETA1 */ 2638 xf_emit(ctx, 1, 0); /* ffffffff BETA4 */ 2639 xf_emit(ctx, 1, 0); /* 00000007 OPERATION */ 2640 xf_emit(ctx, 0x50, 0); /* 10x ffffff, ffffff, ffffff, ffffff, 3 PATTERN */ 2641 } 2642 2643 static void 2644 nv50_gr_construct_xfer_unk84xx(struct nvkm_grctx *ctx) 2645 { 2646 struct nvkm_device *device = ctx->device; 2647 int magic3; 2648 switch (device->chipset) { 2649 case 0x50: 2650 magic3 = 0x1000; 2651 break; 2652 case 0x86: 2653 case 0x98: 2654 case 0xa8: 2655 case 0xaa: 2656 case 0xac: 2657 case 0xaf: 2658 magic3 = 0x1e00; 2659 break; 2660 default: 2661 magic3 = 0; 2662 } 2663 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2664 xf_emit(ctx, 1, 4); /* 7f/ff[NVA0+] VP_REG_ALLOC_RESULT */ 2665 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2666 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2667 xf_emit(ctx, 1, 0); /* 111/113[NVA0+] */ 2668 if (IS_NVA3F(device->chipset)) 2669 xf_emit(ctx, 0x1f, 0); /* ffffffff */ 2670 else if (device->chipset >= 0xa0) 2671 xf_emit(ctx, 0x0f, 0); /* ffffffff */ 2672 else 2673 xf_emit(ctx, 0x10, 0); /* fffffff VP_RESULT_MAP_1 up */ 2674 xf_emit(ctx, 2, 0); /* f/1f[NVA3], fffffff/ffffffff[NVA0+] */ 2675 xf_emit(ctx, 1, 4); /* 7f/ff VP_REG_ALLOC_RESULT */ 2676 xf_emit(ctx, 1, 4); /* 7f/ff VP_RESULT_MAP_SIZE */ 2677 if (device->chipset >= 0xa0) 2678 xf_emit(ctx, 1, 0x03020100); /* ffffffff */ 2679 else 2680 xf_emit(ctx, 1, 0x00608080); /* fffffff VP_RESULT_MAP_0 */ 2681 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2682 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2683 xf_emit(ctx, 2, 0); /* 111/113, 7f/ff */ 2684 xf_emit(ctx, 1, 4); /* 7f/ff VP_RESULT_MAP_SIZE */ 2685 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2686 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2687 xf_emit(ctx, 1, 4); /* 000000ff GP_REG_ALLOC_RESULT */ 2688 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 2689 xf_emit(ctx, 1, 0x80); /* 0000ffff GP_VERTEX_OUTPUT_COUNT */ 2690 if (magic3) 2691 xf_emit(ctx, 1, magic3); /* 00007fff tesla UNK141C */ 2692 xf_emit(ctx, 1, 4); /* 7f/ff VP_RESULT_MAP_SIZE */ 2693 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2694 xf_emit(ctx, 1, 0); /* 111/113 */ 2695 xf_emit(ctx, 0x1f, 0); /* ffffffff GP_RESULT_MAP_1 up */ 2696 xf_emit(ctx, 1, 0); /* 0000001f */ 2697 xf_emit(ctx, 1, 0); /* ffffffff */ 2698 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2699 xf_emit(ctx, 1, 4); /* 000000ff GP_REG_ALLOC_RESULT */ 2700 xf_emit(ctx, 1, 0x80); /* 0000ffff GP_VERTEX_OUTPUT_COUNT */ 2701 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 2702 xf_emit(ctx, 1, 0x03020100); /* ffffffff GP_RESULT_MAP_0 */ 2703 xf_emit(ctx, 1, 3); /* 00000003 GP_OUTPUT_PRIMITIVE_TYPE */ 2704 if (magic3) 2705 xf_emit(ctx, 1, magic3); /* 7fff tesla UNK141C */ 2706 xf_emit(ctx, 1, 4); /* 7f/ff VP_RESULT_MAP_SIZE */ 2707 xf_emit(ctx, 1, 0); /* 00000001 PROVOKING_VERTEX_LAST */ 2708 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2709 xf_emit(ctx, 1, 0); /* 111/113 */ 2710 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2711 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 2712 xf_emit(ctx, 1, 3); /* 00000003 GP_OUTPUT_PRIMITIVE_TYPE */ 2713 xf_emit(ctx, 1, 0); /* 00000001 PROVOKING_VERTEX_LAST */ 2714 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2715 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK13A0 */ 2716 xf_emit(ctx, 1, 4); /* 7f/ff VP_REG_ALLOC_RESULT */ 2717 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2718 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2719 xf_emit(ctx, 1, 0); /* 111/113 */ 2720 if (device->chipset == 0x94 || device->chipset == 0x96) 2721 xf_emit(ctx, 0x1020, 0); /* 4 x (0x400 x 0xffffffff, ff, 0, 0, 0, 4 x ffffffff) */ 2722 else if (device->chipset < 0xa0) 2723 xf_emit(ctx, 0xa20, 0); /* 4 x (0x280 x 0xffffffff, ff, 0, 0, 0, 4 x ffffffff) */ 2724 else if (!IS_NVA3F(device->chipset)) 2725 xf_emit(ctx, 0x210, 0); /* ffffffff */ 2726 else 2727 xf_emit(ctx, 0x410, 0); /* ffffffff */ 2728 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 2729 xf_emit(ctx, 1, 4); /* 000000ff GP_RESULT_MAP_SIZE */ 2730 xf_emit(ctx, 1, 3); /* 00000003 GP_OUTPUT_PRIMITIVE_TYPE */ 2731 xf_emit(ctx, 1, 0); /* 00000001 PROVOKING_VERTEX_LAST */ 2732 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 2733 } 2734 2735 static void 2736 nv50_gr_construct_xfer_tprop(struct nvkm_grctx *ctx) 2737 { 2738 struct nvkm_device *device = ctx->device; 2739 int magic1, magic2; 2740 if (device->chipset == 0x50) { 2741 magic1 = 0x3ff; 2742 magic2 = 0x00003e60; 2743 } else if (!IS_NVA3F(device->chipset)) { 2744 magic1 = 0x7ff; 2745 magic2 = 0x001ffe67; 2746 } else { 2747 magic1 = 0x7ff; 2748 magic2 = 0x00087e67; 2749 } 2750 xf_emit(ctx, 1, 0); /* 00000007 ALPHA_TEST_FUNC */ 2751 xf_emit(ctx, 1, 0); /* ffffffff ALPHA_TEST_REF */ 2752 xf_emit(ctx, 1, 0); /* 00000001 ALPHA_TEST_ENABLE */ 2753 if (IS_NVA3F(device->chipset)) 2754 xf_emit(ctx, 1, 1); /* 0000000f UNK16A0 */ 2755 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 2756 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2757 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_BACK_MASK */ 2758 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_BACK_OP_FAIL, ZFAIL, ZPASS */ 2759 xf_emit(ctx, 4, 0); /* ffffffff BLEND_COLOR */ 2760 xf_emit(ctx, 1, 0); /* 00000001 UNK19C0 */ 2761 xf_emit(ctx, 1, 0); /* 00000001 UNK0FDC */ 2762 xf_emit(ctx, 1, 0xf); /* 0000000f COLOR_MASK */ 2763 xf_emit(ctx, 7, 0); /* 0000000f COLOR_MASK */ 2764 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2765 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2766 xf_emit(ctx, 1, 0); /* 00000001 LOGIC_OP_ENABLE */ 2767 xf_emit(ctx, 1, 0); /* ff[NV50]/3ff[NV84+] */ 2768 xf_emit(ctx, 1, 4); /* 00000007 FP_CONTROL */ 2769 xf_emit(ctx, 4, 0xffff); /* 0000ffff MSAA_MASK */ 2770 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_MASK */ 2771 xf_emit(ctx, 3, 0); /* 00000007 STENCIL_FRONT_OP_FAIL, ZFAIL, ZPASS */ 2772 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2773 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_BACK_ENABLE */ 2774 xf_emit(ctx, 2, 0); /* 00007fff WINDOW_OFFSET_XY */ 2775 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK19CC */ 2776 xf_emit(ctx, 1, 0); /* 7 */ 2777 xf_emit(ctx, 1, 0); /* 00000001 SAMPLECNT_ENABLE */ 2778 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2779 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2780 xf_emit(ctx, 1, 0); /* ffffffff COLOR_KEY */ 2781 xf_emit(ctx, 1, 0); /* 00000001 COLOR_KEY_ENABLE */ 2782 xf_emit(ctx, 1, 0); /* 00000007 COLOR_KEY_FORMAT */ 2783 xf_emit(ctx, 2, 0); /* ffffffff SIFC_BITMAP_COLOR */ 2784 xf_emit(ctx, 1, 1); /* 00000001 SIFC_BITMAP_WRITE_BIT0_ENABLE */ 2785 xf_emit(ctx, 1, 0); /* 00000007 ALPHA_TEST_FUNC */ 2786 xf_emit(ctx, 1, 0); /* 00000001 ALPHA_TEST_ENABLE */ 2787 if (IS_NVA3F(device->chipset)) { 2788 xf_emit(ctx, 1, 3); /* 00000003 tesla UNK16B4 */ 2789 xf_emit(ctx, 1, 0); /* 00000003 */ 2790 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1298 */ 2791 } else if (device->chipset >= 0xa0) { 2792 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK16B4 */ 2793 xf_emit(ctx, 1, 0); /* 00000003 */ 2794 } else { 2795 xf_emit(ctx, 1, 0); /* 00000003 MULTISAMPLE_CTRL */ 2796 } 2797 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2798 xf_emit(ctx, 8, 0); /* 00000001 BLEND_ENABLE */ 2799 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_ALPHA */ 2800 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_ALPHA */ 2801 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_ALPHA */ 2802 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_RGB */ 2803 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_RGB */ 2804 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_RGB */ 2805 if (IS_NVA3F(device->chipset)) { 2806 xf_emit(ctx, 1, 0); /* 00000001 UNK12E4 */ 2807 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_RGB */ 2808 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_ALPHA */ 2809 xf_emit(ctx, 8, 1); /* 00000001 IBLEND_UNK00 */ 2810 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_SRC_RGB */ 2811 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_DST_RGB */ 2812 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_SRC_ALPHA */ 2813 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_DST_ALPHA */ 2814 xf_emit(ctx, 1, 0); /* 00000001 UNK1140 */ 2815 } 2816 xf_emit(ctx, 1, 1); /* 00000001 UNK133C */ 2817 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2818 xf_emit(ctx, 1, 0x11); /* 3f/7f RT_FORMAT */ 2819 xf_emit(ctx, 7, 0); /* 3f/7f RT_FORMAT */ 2820 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2821 xf_emit(ctx, 1, 0); /* 00000001 LOGIC_OP_ENABLE */ 2822 xf_emit(ctx, 1, 0); /* ff/3ff */ 2823 xf_emit(ctx, 1, 4); /* 00000007 FP_CONTROL */ 2824 xf_emit(ctx, 1, 0); /* 00000003 UNK0F90 */ 2825 xf_emit(ctx, 1, 0); /* 00000001 FRAMEBUFFER_SRGB */ 2826 xf_emit(ctx, 1, 0); /* 7 */ 2827 xf_emit(ctx, 1, 0x11); /* 3f/7f DST_FORMAT */ 2828 xf_emit(ctx, 1, 1); /* 00000001 DST_LINEAR */ 2829 xf_emit(ctx, 1, 0); /* 00000007 OPERATION */ 2830 xf_emit(ctx, 1, 0xcf); /* 000000ff SIFC_FORMAT */ 2831 xf_emit(ctx, 1, 0xcf); /* 000000ff DRAW_COLOR_FORMAT */ 2832 xf_emit(ctx, 1, 0xcf); /* 000000ff SRC_FORMAT */ 2833 if (IS_NVA3F(device->chipset)) 2834 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2835 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2836 xf_emit(ctx, 1, 0); /* 7/f[NVA3] MULTISAMPLE_SAMPLES_LOG2 */ 2837 xf_emit(ctx, 8, 0); /* 00000001 BLEND_ENABLE */ 2838 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_ALPHA */ 2839 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_ALPHA */ 2840 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_ALPHA */ 2841 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_RGB */ 2842 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_RGB */ 2843 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_RGB */ 2844 xf_emit(ctx, 1, 1); /* 00000001 UNK133C */ 2845 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2846 xf_emit(ctx, 8, 1); /* 00000001 UNK19E0 */ 2847 xf_emit(ctx, 1, 0x11); /* 3f/7f RT_FORMAT */ 2848 xf_emit(ctx, 7, 0); /* 3f/7f RT_FORMAT */ 2849 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2850 xf_emit(ctx, 1, 0xf); /* 0000000f COLOR_MASK */ 2851 xf_emit(ctx, 7, 0); /* 0000000f COLOR_MASK */ 2852 xf_emit(ctx, 1, magic2); /* 001fffff tesla UNK0F78 */ 2853 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2854 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2855 xf_emit(ctx, 1, 0x11); /* 3f/7f DST_FORMAT */ 2856 xf_emit(ctx, 1, 1); /* 00000001 DST_LINEAR */ 2857 if (IS_NVA3F(device->chipset)) 2858 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2859 if (device->chipset == 0x50) 2860 xf_emit(ctx, 1, 0); /* ff */ 2861 else 2862 xf_emit(ctx, 3, 0); /* 1, 7, 3ff */ 2863 xf_emit(ctx, 1, 4); /* 00000007 FP_CONTROL */ 2864 xf_emit(ctx, 1, 0); /* 00000003 UNK0F90 */ 2865 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2866 xf_emit(ctx, 1, 0); /* 00000007 */ 2867 xf_emit(ctx, 1, 0); /* 00000001 SAMPLECNT_ENABLE */ 2868 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2869 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2870 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2871 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 2872 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2873 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2874 xf_emit(ctx, 1, 0x11); /* 3f/7f RT_FORMAT */ 2875 xf_emit(ctx, 7, 0); /* 3f/7f RT_FORMAT */ 2876 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2877 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2878 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2879 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2880 xf_emit(ctx, 1, 0x11); /* 3f/7f DST_FORMAT */ 2881 xf_emit(ctx, 1, 1); /* 00000001 DST_LINEAR */ 2882 xf_emit(ctx, 1, 0); /* 000fffff BLIT_DU_DX_FRACT */ 2883 xf_emit(ctx, 1, 1); /* 0001ffff BLIT_DU_DX_INT */ 2884 xf_emit(ctx, 1, 0); /* 000fffff BLIT_DV_DY_FRACT */ 2885 xf_emit(ctx, 1, 1); /* 0001ffff BLIT_DV_DY_INT */ 2886 xf_emit(ctx, 1, 0); /* ff/3ff */ 2887 xf_emit(ctx, 1, magic1); /* 3ff/7ff tesla UNK0D68 */ 2888 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2889 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK15B4 */ 2890 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2891 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2892 xf_emit(ctx, 1, 0); /* 00000007 */ 2893 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2894 if (IS_NVA3F(device->chipset)) 2895 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2896 xf_emit(ctx, 8, 0); /* 0000ffff DMA_COLOR */ 2897 xf_emit(ctx, 1, 0); /* 0000ffff DMA_GLOBAL */ 2898 xf_emit(ctx, 1, 0); /* 0000ffff DMA_LOCAL */ 2899 xf_emit(ctx, 1, 0); /* 0000ffff DMA_STACK */ 2900 xf_emit(ctx, 1, 0); /* ff/3ff */ 2901 xf_emit(ctx, 1, 0); /* 0000ffff DMA_DST */ 2902 xf_emit(ctx, 1, 0); /* 7 */ 2903 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 2904 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2905 xf_emit(ctx, 8, 0); /* 000000ff RT_ADDRESS_HIGH */ 2906 xf_emit(ctx, 8, 0); /* ffffffff RT_LAYER_STRIDE */ 2907 xf_emit(ctx, 8, 0); /* ffffffff RT_ADDRESS_LOW */ 2908 xf_emit(ctx, 8, 8); /* 0000007f RT_TILE_MODE */ 2909 xf_emit(ctx, 1, 0x11); /* 3f/7f RT_FORMAT */ 2910 xf_emit(ctx, 7, 0); /* 3f/7f RT_FORMAT */ 2911 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2912 xf_emit(ctx, 8, 0x400); /* 0fffffff RT_HORIZ */ 2913 xf_emit(ctx, 8, 0x300); /* 0000ffff RT_VERT */ 2914 xf_emit(ctx, 1, 1); /* 00001fff RT_ARRAY_MODE */ 2915 xf_emit(ctx, 1, 0xf); /* 0000000f COLOR_MASK */ 2916 xf_emit(ctx, 7, 0); /* 0000000f COLOR_MASK */ 2917 xf_emit(ctx, 1, 0x20); /* 00000fff DST_TILE_MODE */ 2918 xf_emit(ctx, 1, 0x11); /* 3f/7f DST_FORMAT */ 2919 xf_emit(ctx, 1, 0x100); /* 0001ffff DST_HEIGHT */ 2920 xf_emit(ctx, 1, 0); /* 000007ff DST_LAYER */ 2921 xf_emit(ctx, 1, 1); /* 00000001 DST_LINEAR */ 2922 xf_emit(ctx, 1, 0); /* ffffffff DST_ADDRESS_LOW */ 2923 xf_emit(ctx, 1, 0); /* 000000ff DST_ADDRESS_HIGH */ 2924 xf_emit(ctx, 1, 0x40); /* 0007ffff DST_PITCH */ 2925 xf_emit(ctx, 1, 0x100); /* 0001ffff DST_WIDTH */ 2926 xf_emit(ctx, 1, 0); /* 0000ffff */ 2927 xf_emit(ctx, 1, 3); /* 00000003 tesla UNK15AC */ 2928 xf_emit(ctx, 1, 0); /* ff/3ff */ 2929 xf_emit(ctx, 1, 0); /* 0001ffff GP_BUILTIN_RESULT_EN */ 2930 xf_emit(ctx, 1, 0); /* 00000003 UNK0F90 */ 2931 xf_emit(ctx, 1, 0); /* 00000007 */ 2932 if (IS_NVA3F(device->chipset)) 2933 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2934 xf_emit(ctx, 1, magic2); /* 001fffff tesla UNK0F78 */ 2935 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 2936 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 2937 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2938 xf_emit(ctx, 1, 2); /* 00000003 tesla UNK143C */ 2939 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2940 xf_emit(ctx, 1, 0); /* 0000ffff DMA_ZETA */ 2941 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2942 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2943 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2944 xf_emit(ctx, 2, 0); /* ffff, ff/3ff */ 2945 xf_emit(ctx, 1, 0); /* 0001ffff GP_BUILTIN_RESULT_EN */ 2946 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2947 xf_emit(ctx, 1, 0); /* 000000ff STENCIL_FRONT_MASK */ 2948 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK15B4 */ 2949 xf_emit(ctx, 1, 0); /* 00000007 */ 2950 xf_emit(ctx, 1, 0); /* ffffffff ZETA_LAYER_STRIDE */ 2951 xf_emit(ctx, 1, 0); /* 000000ff ZETA_ADDRESS_HIGH */ 2952 xf_emit(ctx, 1, 0); /* ffffffff ZETA_ADDRESS_LOW */ 2953 xf_emit(ctx, 1, 4); /* 00000007 ZETA_TILE_MODE */ 2954 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2955 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2956 xf_emit(ctx, 1, 0x400); /* 0fffffff ZETA_HORIZ */ 2957 xf_emit(ctx, 1, 0x300); /* 0000ffff ZETA_VERT */ 2958 xf_emit(ctx, 1, 0x1001); /* 00001fff ZETA_ARRAY_MODE */ 2959 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 2960 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 2961 if (IS_NVA3F(device->chipset)) 2962 xf_emit(ctx, 1, 0); /* 00000001 */ 2963 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2964 xf_emit(ctx, 1, 0x11); /* 3f/7f RT_FORMAT */ 2965 xf_emit(ctx, 7, 0); /* 3f/7f RT_FORMAT */ 2966 xf_emit(ctx, 1, 0x0fac6881); /* 0fffffff RT_CONTROL */ 2967 xf_emit(ctx, 1, 0xf); /* 0000000f COLOR_MASK */ 2968 xf_emit(ctx, 7, 0); /* 0000000f COLOR_MASK */ 2969 xf_emit(ctx, 1, 0); /* ff/3ff */ 2970 xf_emit(ctx, 8, 0); /* 00000001 BLEND_ENABLE */ 2971 xf_emit(ctx, 1, 0); /* 00000003 UNK0F90 */ 2972 xf_emit(ctx, 1, 0); /* 00000001 FRAMEBUFFER_SRGB */ 2973 xf_emit(ctx, 1, 0); /* 7 */ 2974 xf_emit(ctx, 1, 0); /* 00000001 LOGIC_OP_ENABLE */ 2975 if (IS_NVA3F(device->chipset)) { 2976 xf_emit(ctx, 1, 0); /* 00000001 UNK1140 */ 2977 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 2978 } 2979 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 2980 xf_emit(ctx, 1, 0); /* 00000001 UNK1534 */ 2981 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 2982 if (device->chipset >= 0xa0) 2983 xf_emit(ctx, 1, 0x0fac6881); /* fffffff */ 2984 xf_emit(ctx, 1, magic2); /* 001fffff tesla UNK0F78 */ 2985 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_BOUNDS_EN */ 2986 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 2987 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE_ENABLE */ 2988 xf_emit(ctx, 1, 0x11); /* 3f/7f DST_FORMAT */ 2989 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK0FB0 */ 2990 xf_emit(ctx, 1, 0); /* ff/3ff */ 2991 xf_emit(ctx, 1, 4); /* 00000007 FP_CONTROL */ 2992 xf_emit(ctx, 1, 0); /* 00000001 STENCIL_FRONT_ENABLE */ 2993 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK15B4 */ 2994 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK19CC */ 2995 xf_emit(ctx, 1, 0); /* 00000007 */ 2996 xf_emit(ctx, 1, 0); /* 00000001 SAMPLECNT_ENABLE */ 2997 xf_emit(ctx, 1, 0); /* 0000000f ZETA_FORMAT */ 2998 xf_emit(ctx, 1, 1); /* 00000001 ZETA_ENABLE */ 2999 if (IS_NVA3F(device->chipset)) { 3000 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 3001 xf_emit(ctx, 1, 0); /* 0000000f tesla UNK15C8 */ 3002 } 3003 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A3C */ 3004 if (device->chipset >= 0xa0) { 3005 xf_emit(ctx, 3, 0); /* 7/f, 1, ffff0ff3 */ 3006 xf_emit(ctx, 1, 0xfac6881); /* fffffff */ 3007 xf_emit(ctx, 4, 0); /* 1, 1, 1, 3ff */ 3008 xf_emit(ctx, 1, 4); /* 7 */ 3009 xf_emit(ctx, 1, 0); /* 1 */ 3010 xf_emit(ctx, 2, 1); /* 1 */ 3011 xf_emit(ctx, 2, 0); /* 7, f */ 3012 xf_emit(ctx, 1, 1); /* 1 */ 3013 xf_emit(ctx, 1, 0); /* 7/f */ 3014 if (IS_NVA3F(device->chipset)) 3015 xf_emit(ctx, 0x9, 0); /* 1 */ 3016 else 3017 xf_emit(ctx, 0x8, 0); /* 1 */ 3018 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 3019 xf_emit(ctx, 8, 1); /* 1 */ 3020 xf_emit(ctx, 1, 0x11); /* 7f */ 3021 xf_emit(ctx, 7, 0); /* 7f */ 3022 xf_emit(ctx, 1, 0xfac6881); /* fffffff */ 3023 xf_emit(ctx, 1, 0xf); /* f */ 3024 xf_emit(ctx, 7, 0); /* f */ 3025 xf_emit(ctx, 1, 0x11); /* 7f */ 3026 xf_emit(ctx, 1, 1); /* 1 */ 3027 xf_emit(ctx, 5, 0); /* 1, 7, 3ff, 3, 7 */ 3028 if (IS_NVA3F(device->chipset)) { 3029 xf_emit(ctx, 1, 0); /* 00000001 UNK1140 */ 3030 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 3031 } 3032 } 3033 } 3034 3035 static void 3036 nv50_gr_construct_xfer_tex(struct nvkm_grctx *ctx) 3037 { 3038 struct nvkm_device *device = ctx->device; 3039 xf_emit(ctx, 2, 0); /* 1 LINKED_TSC. yes, 2. */ 3040 if (device->chipset != 0x50) 3041 xf_emit(ctx, 1, 0); /* 3 */ 3042 xf_emit(ctx, 1, 1); /* 1ffff BLIT_DU_DX_INT */ 3043 xf_emit(ctx, 1, 0); /* fffff BLIT_DU_DX_FRACT */ 3044 xf_emit(ctx, 1, 1); /* 1ffff BLIT_DV_DY_INT */ 3045 xf_emit(ctx, 1, 0); /* fffff BLIT_DV_DY_FRACT */ 3046 if (device->chipset == 0x50) 3047 xf_emit(ctx, 1, 0); /* 3 BLIT_CONTROL */ 3048 else 3049 xf_emit(ctx, 2, 0); /* 3ff, 1 */ 3050 xf_emit(ctx, 1, 0x2a712488); /* ffffffff SRC_TIC_0 */ 3051 xf_emit(ctx, 1, 0); /* ffffffff SRC_TIC_1 */ 3052 xf_emit(ctx, 1, 0x4085c000); /* ffffffff SRC_TIC_2 */ 3053 xf_emit(ctx, 1, 0x40); /* ffffffff SRC_TIC_3 */ 3054 xf_emit(ctx, 1, 0x100); /* ffffffff SRC_TIC_4 */ 3055 xf_emit(ctx, 1, 0x10100); /* ffffffff SRC_TIC_5 */ 3056 xf_emit(ctx, 1, 0x02800000); /* ffffffff SRC_TIC_6 */ 3057 xf_emit(ctx, 1, 0); /* ffffffff SRC_TIC_7 */ 3058 if (device->chipset == 0x50) { 3059 xf_emit(ctx, 1, 0); /* 00000001 turing UNK358 */ 3060 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A34? */ 3061 xf_emit(ctx, 1, 0); /* 00000003 turing UNK37C tesla UNK1690 */ 3062 xf_emit(ctx, 1, 0); /* 00000003 BLIT_CONTROL */ 3063 xf_emit(ctx, 1, 0); /* 00000001 turing UNK32C tesla UNK0F94 */ 3064 } else if (!IS_NVAAF(device->chipset)) { 3065 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A34? */ 3066 xf_emit(ctx, 1, 0); /* 00000003 */ 3067 xf_emit(ctx, 1, 0); /* 000003ff */ 3068 xf_emit(ctx, 1, 0); /* 00000003 */ 3069 xf_emit(ctx, 1, 0); /* 000003ff */ 3070 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1664 / turing UNK03E8 */ 3071 xf_emit(ctx, 1, 0); /* 00000003 */ 3072 xf_emit(ctx, 1, 0); /* 000003ff */ 3073 } else { 3074 xf_emit(ctx, 0x6, 0); 3075 } 3076 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A34 */ 3077 xf_emit(ctx, 1, 0); /* 0000ffff DMA_TEXTURE */ 3078 xf_emit(ctx, 1, 0); /* 0000ffff DMA_SRC */ 3079 } 3080 3081 static void 3082 nv50_gr_construct_xfer_unk8cxx(struct nvkm_grctx *ctx) 3083 { 3084 struct nvkm_device *device = ctx->device; 3085 xf_emit(ctx, 1, 0); /* 00000001 UNK1534 */ 3086 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 3087 xf_emit(ctx, 2, 0); /* 7, ffff0ff3 */ 3088 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 3089 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE */ 3090 xf_emit(ctx, 1, 0x04e3bfdf); /* ffffffff UNK0D64 */ 3091 xf_emit(ctx, 1, 0x04e3bfdf); /* ffffffff UNK0DF4 */ 3092 xf_emit(ctx, 1, 1); /* 00000001 UNK15B4 */ 3093 xf_emit(ctx, 1, 0); /* 00000001 LINE_STIPPLE_ENABLE */ 3094 xf_emit(ctx, 1, 0x00ffff00); /* 00ffffff LINE_STIPPLE_PATTERN */ 3095 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK0F98 */ 3096 if (IS_NVA3F(device->chipset)) 3097 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 3098 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1668 */ 3099 xf_emit(ctx, 1, 0); /* 00000001 LINE_STIPPLE_ENABLE */ 3100 xf_emit(ctx, 1, 0x00ffff00); /* 00ffffff LINE_STIPPLE_PATTERN */ 3101 xf_emit(ctx, 1, 0); /* 00000001 POLYGON_SMOOTH_ENABLE */ 3102 xf_emit(ctx, 1, 0); /* 00000001 UNK1534 */ 3103 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 3104 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1658 */ 3105 xf_emit(ctx, 1, 0); /* 00000001 LINE_SMOOTH_ENABLE */ 3106 xf_emit(ctx, 1, 0); /* ffff0ff3 */ 3107 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_TEST_ENABLE */ 3108 xf_emit(ctx, 1, 0); /* 00000001 DEPTH_WRITE */ 3109 xf_emit(ctx, 1, 1); /* 00000001 UNK15B4 */ 3110 xf_emit(ctx, 1, 0); /* 00000001 POINT_SPRITE_ENABLE */ 3111 xf_emit(ctx, 1, 1); /* 00000001 tesla UNK165C */ 3112 xf_emit(ctx, 1, 0x30201000); /* ffffffff tesla UNK1670 */ 3113 xf_emit(ctx, 1, 0x70605040); /* ffffffff tesla UNK1670 */ 3114 xf_emit(ctx, 1, 0xb8a89888); /* ffffffff tesla UNK1670 */ 3115 xf_emit(ctx, 1, 0xf8e8d8c8); /* ffffffff tesla UNK1670 */ 3116 xf_emit(ctx, 1, 0); /* 00000001 VERTEX_TWO_SIDE_ENABLE */ 3117 xf_emit(ctx, 1, 0x1a); /* 0000001f POLYGON_MODE */ 3118 } 3119 3120 static void 3121 nv50_gr_construct_xfer_tp(struct nvkm_grctx *ctx) 3122 { 3123 struct nvkm_device *device = ctx->device; 3124 if (device->chipset < 0xa0) { 3125 nv50_gr_construct_xfer_unk84xx(ctx); 3126 nv50_gr_construct_xfer_tprop(ctx); 3127 nv50_gr_construct_xfer_tex(ctx); 3128 nv50_gr_construct_xfer_unk8cxx(ctx); 3129 } else { 3130 nv50_gr_construct_xfer_tex(ctx); 3131 nv50_gr_construct_xfer_tprop(ctx); 3132 nv50_gr_construct_xfer_unk8cxx(ctx); 3133 nv50_gr_construct_xfer_unk84xx(ctx); 3134 } 3135 } 3136 3137 static void 3138 nv50_gr_construct_xfer_mpc(struct nvkm_grctx *ctx) 3139 { 3140 struct nvkm_device *device = ctx->device; 3141 int i, mpcnt = 2; 3142 switch (device->chipset) { 3143 case 0x98: 3144 case 0xaa: 3145 mpcnt = 1; 3146 break; 3147 case 0x50: 3148 case 0x84: 3149 case 0x86: 3150 case 0x92: 3151 case 0x94: 3152 case 0x96: 3153 case 0xa8: 3154 case 0xac: 3155 mpcnt = 2; 3156 break; 3157 case 0xa0: 3158 case 0xa3: 3159 case 0xa5: 3160 case 0xaf: 3161 mpcnt = 3; 3162 break; 3163 } 3164 for (i = 0; i < mpcnt; i++) { 3165 xf_emit(ctx, 1, 0); /* ff */ 3166 xf_emit(ctx, 1, 0x80); /* ffffffff tesla UNK1404 */ 3167 xf_emit(ctx, 1, 0x80007004); /* ffffffff tesla UNK12B0 */ 3168 xf_emit(ctx, 1, 0x04000400); /* ffffffff */ 3169 if (device->chipset >= 0xa0) 3170 xf_emit(ctx, 1, 0xc0); /* 00007fff tesla UNK152C */ 3171 xf_emit(ctx, 1, 0x1000); /* 0000ffff tesla UNK0D60 */ 3172 xf_emit(ctx, 1, 0); /* ff/3ff */ 3173 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A30 */ 3174 if (device->chipset == 0x86 || device->chipset == 0x98 || device->chipset == 0xa8 || IS_NVAAF(device->chipset)) { 3175 xf_emit(ctx, 1, 0xe00); /* 7fff */ 3176 xf_emit(ctx, 1, 0x1e00); /* 7fff */ 3177 } 3178 xf_emit(ctx, 1, 1); /* 000000ff VP_REG_ALLOC_TEMP */ 3179 xf_emit(ctx, 1, 0); /* 00000001 LINKED_TSC */ 3180 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 3181 if (device->chipset == 0x50) 3182 xf_emit(ctx, 2, 0x1000); /* 7fff tesla UNK141C */ 3183 xf_emit(ctx, 1, 1); /* 000000ff GP_REG_ALLOC_TEMP */ 3184 xf_emit(ctx, 1, 0); /* 00000001 GP_ENABLE */ 3185 xf_emit(ctx, 1, 4); /* 000000ff FP_REG_ALLOC_TEMP */ 3186 xf_emit(ctx, 1, 2); /* 00000003 REG_MODE */ 3187 if (IS_NVAAF(device->chipset)) 3188 xf_emit(ctx, 0xb, 0); /* RO */ 3189 else if (device->chipset >= 0xa0) 3190 xf_emit(ctx, 0xc, 0); /* RO */ 3191 else 3192 xf_emit(ctx, 0xa, 0); /* RO */ 3193 } 3194 xf_emit(ctx, 1, 0x08100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 3195 xf_emit(ctx, 1, 0); /* ff/3ff */ 3196 if (device->chipset >= 0xa0) { 3197 xf_emit(ctx, 1, 0x1fe21); /* 0003ffff tesla UNK0FAC */ 3198 } 3199 xf_emit(ctx, 3, 0); /* 7fff, 0, 0 */ 3200 xf_emit(ctx, 1, 0); /* 00000001 tesla UNK1534 */ 3201 xf_emit(ctx, 1, 0); /* 7/f MULTISAMPLE_SAMPLES_LOG2 */ 3202 xf_emit(ctx, 4, 0xffff); /* 0000ffff MSAA_MASK */ 3203 xf_emit(ctx, 1, 1); /* 00000001 LANES32 */ 3204 xf_emit(ctx, 1, 0x10001); /* 00ffffff BLOCK_ALLOC */ 3205 xf_emit(ctx, 1, 0x10001); /* ffffffff BLOCKDIM_XY */ 3206 xf_emit(ctx, 1, 1); /* 0000ffff BLOCKDIM_Z */ 3207 xf_emit(ctx, 1, 0); /* ffffffff SHARED_SIZE */ 3208 xf_emit(ctx, 1, 0x1fe21); /* 1ffff/3ffff[NVA0+] tesla UNk0FAC */ 3209 xf_emit(ctx, 1, 0); /* ffffffff tesla UNK1A34 */ 3210 if (IS_NVA3F(device->chipset)) 3211 xf_emit(ctx, 1, 1); /* 0000001f tesla UNK169C */ 3212 xf_emit(ctx, 1, 0); /* ff/3ff */ 3213 xf_emit(ctx, 1, 0); /* 1 LINKED_TSC */ 3214 xf_emit(ctx, 1, 0); /* ff FP_ADDRESS_HIGH */ 3215 xf_emit(ctx, 1, 0); /* ffffffff FP_ADDRESS_LOW */ 3216 xf_emit(ctx, 1, 0x08100c12); /* 1fffffff FP_INTERPOLANT_CTRL */ 3217 xf_emit(ctx, 1, 4); /* 00000007 FP_CONTROL */ 3218 xf_emit(ctx, 1, 0); /* 000000ff FRAG_COLOR_CLAMP_EN */ 3219 xf_emit(ctx, 1, 2); /* 00000003 REG_MODE */ 3220 xf_emit(ctx, 1, 0x11); /* 0000007f RT_FORMAT */ 3221 xf_emit(ctx, 7, 0); /* 0000007f RT_FORMAT */ 3222 xf_emit(ctx, 1, 0); /* 00000007 */ 3223 xf_emit(ctx, 1, 0xfac6881); /* 0fffffff RT_CONTROL */ 3224 xf_emit(ctx, 1, 0); /* 00000003 MULTISAMPLE_CTRL */ 3225 if (IS_NVA3F(device->chipset)) 3226 xf_emit(ctx, 1, 3); /* 00000003 tesla UNK16B4 */ 3227 xf_emit(ctx, 1, 0); /* 00000001 ALPHA_TEST_ENABLE */ 3228 xf_emit(ctx, 1, 0); /* 00000007 ALPHA_TEST_FUNC */ 3229 xf_emit(ctx, 1, 0); /* 00000001 FRAMEBUFFER_SRGB */ 3230 xf_emit(ctx, 1, 4); /* ffffffff tesla UNK1400 */ 3231 xf_emit(ctx, 8, 0); /* 00000001 BLEND_ENABLE */ 3232 xf_emit(ctx, 1, 0); /* 00000001 LOGIC_OP_ENABLE */ 3233 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_RGB */ 3234 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_RGB */ 3235 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_RGB */ 3236 xf_emit(ctx, 1, 2); /* 0000001f BLEND_FUNC_SRC_ALPHA */ 3237 xf_emit(ctx, 1, 1); /* 0000001f BLEND_FUNC_DST_ALPHA */ 3238 xf_emit(ctx, 1, 1); /* 00000007 BLEND_EQUATION_ALPHA */ 3239 xf_emit(ctx, 1, 1); /* 00000001 UNK133C */ 3240 if (IS_NVA3F(device->chipset)) { 3241 xf_emit(ctx, 1, 0); /* 00000001 UNK12E4 */ 3242 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_FUNC_SRC_RGB */ 3243 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_FUNC_DST_RGB */ 3244 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_RGB */ 3245 xf_emit(ctx, 8, 2); /* 0000001f IBLEND_FUNC_SRC_ALPHA */ 3246 xf_emit(ctx, 8, 1); /* 0000001f IBLEND_FUNC_DST_ALPHA */ 3247 xf_emit(ctx, 8, 1); /* 00000007 IBLEND_EQUATION_ALPHA */ 3248 xf_emit(ctx, 8, 1); /* 00000001 IBLEND_UNK00 */ 3249 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK1928 */ 3250 xf_emit(ctx, 1, 0); /* 00000001 UNK1140 */ 3251 } 3252 xf_emit(ctx, 1, 0); /* 00000003 tesla UNK0F90 */ 3253 xf_emit(ctx, 1, 4); /* 000000ff FP_RESULT_COUNT */ 3254 /* XXX: demagic this part some day */ 3255 if (device->chipset == 0x50) 3256 xf_emit(ctx, 0x3a0, 0); 3257 else if (device->chipset < 0x94) 3258 xf_emit(ctx, 0x3a2, 0); 3259 else if (device->chipset == 0x98 || device->chipset == 0xaa) 3260 xf_emit(ctx, 0x39f, 0); 3261 else 3262 xf_emit(ctx, 0x3a3, 0); 3263 xf_emit(ctx, 1, 0x11); /* 3f/7f DST_FORMAT */ 3264 xf_emit(ctx, 1, 0); /* 7 OPERATION */ 3265 xf_emit(ctx, 1, 1); /* 1 DST_LINEAR */ 3266 xf_emit(ctx, 0x2d, 0); 3267 } 3268 3269 static void 3270 nv50_gr_construct_xfer2(struct nvkm_grctx *ctx) 3271 { 3272 struct nvkm_device *device = ctx->device; 3273 int i; 3274 u32 offset; 3275 u32 units = nv_rd32 (ctx->device, 0x1540); 3276 int size = 0; 3277 3278 offset = (ctx->ctxvals_pos+0x3f)&~0x3f; 3279 3280 if (device->chipset < 0xa0) { 3281 for (i = 0; i < 8; i++) { 3282 ctx->ctxvals_pos = offset + i; 3283 /* that little bugger belongs to csched. No idea 3284 * what it's doing here. */ 3285 if (i == 0) 3286 xf_emit(ctx, 1, 0x08100c12); /* FP_INTERPOLANT_CTRL */ 3287 if (units & (1 << i)) 3288 nv50_gr_construct_xfer_mpc(ctx); 3289 if ((ctx->ctxvals_pos-offset)/8 > size) 3290 size = (ctx->ctxvals_pos-offset)/8; 3291 } 3292 } else { 3293 /* Strand 0: TPs 0, 1 */ 3294 ctx->ctxvals_pos = offset; 3295 /* that little bugger belongs to csched. No idea 3296 * what it's doing here. */ 3297 xf_emit(ctx, 1, 0x08100c12); /* FP_INTERPOLANT_CTRL */ 3298 if (units & (1 << 0)) 3299 nv50_gr_construct_xfer_mpc(ctx); 3300 if (units & (1 << 1)) 3301 nv50_gr_construct_xfer_mpc(ctx); 3302 if ((ctx->ctxvals_pos-offset)/8 > size) 3303 size = (ctx->ctxvals_pos-offset)/8; 3304 3305 /* Strand 1: TPs 2, 3 */ 3306 ctx->ctxvals_pos = offset + 1; 3307 if (units & (1 << 2)) 3308 nv50_gr_construct_xfer_mpc(ctx); 3309 if (units & (1 << 3)) 3310 nv50_gr_construct_xfer_mpc(ctx); 3311 if ((ctx->ctxvals_pos-offset)/8 > size) 3312 size = (ctx->ctxvals_pos-offset)/8; 3313 3314 /* Strand 2: TPs 4, 5, 6 */ 3315 ctx->ctxvals_pos = offset + 2; 3316 if (units & (1 << 4)) 3317 nv50_gr_construct_xfer_mpc(ctx); 3318 if (units & (1 << 5)) 3319 nv50_gr_construct_xfer_mpc(ctx); 3320 if (units & (1 << 6)) 3321 nv50_gr_construct_xfer_mpc(ctx); 3322 if ((ctx->ctxvals_pos-offset)/8 > size) 3323 size = (ctx->ctxvals_pos-offset)/8; 3324 3325 /* Strand 3: TPs 7, 8, 9 */ 3326 ctx->ctxvals_pos = offset + 3; 3327 if (units & (1 << 7)) 3328 nv50_gr_construct_xfer_mpc(ctx); 3329 if (units & (1 << 8)) 3330 nv50_gr_construct_xfer_mpc(ctx); 3331 if (units & (1 << 9)) 3332 nv50_gr_construct_xfer_mpc(ctx); 3333 if ((ctx->ctxvals_pos-offset)/8 > size) 3334 size = (ctx->ctxvals_pos-offset)/8; 3335 } 3336 ctx->ctxvals_pos = offset + size * 8; 3337 ctx->ctxvals_pos = (ctx->ctxvals_pos+0x3f)&~0x3f; 3338 cp_lsr (ctx, offset); 3339 cp_out (ctx, CP_SET_XFER_POINTER); 3340 cp_lsr (ctx, size); 3341 cp_out (ctx, CP_SEEK_2); 3342 cp_out (ctx, CP_XFER_2); 3343 cp_wait(ctx, XFER, BUSY); 3344 } 3345