if (src1) {
if (src1->type == P_CONST || src1->type == P_IMMD) {
+ if (src1->type == P_IMMD)
+ inst[1] |= (NV50_CB_PMISC << 22);
+ else
+ inst[1] |= (NV50_CB_PVP << 22);
inst[0] |= 0x00800000; /* src1 is const */
/*XXX: does src1 come from "src2" now? */
alloc_reg(pc, src1);
if (src2) {
if (src2->type == P_CONST || src2->type == P_IMMD) {
+ if (src2->type == P_IMMD)
+ inst[1] |= (NV50_CB_PMISC << 22);
+ else
+ inst[1] |= (NV50_CB_PVP << 22);
inst[0] |= 0x01000000; /* src2 is const */
inst[1] |= (src2->hw << 14);
} else {
}
if (pc->immd_nr) {
- int rid = pc->param_nr * 4;
+ int rid = 0;
pc->immd = calloc(pc->immd_nr * 4, sizeof(struct nv50_reg));
if (!pc->immd)
}
}
- p->param_nr = pc->param_nr * 4;
p->immd_nr = pc->immd_nr * 4;
p->immd = pc->immd_buf;
memcpy(map, p->insns, p->insns_nr * 4);
ws->buffer_unmap(ws, p->buffer);
- if (p->param_nr) {
- float *cb;
-
- cb = ws->buffer_map(ws, nv50->constbuf[PIPE_SHADER_VERTEX],
- PIPE_BUFFER_USAGE_CPU_READ);
- for (i = 0; i < p->param_nr; i++) {
- BEGIN_RING(tesla, 0x0f00, 2);
- OUT_RING (i << 8);
- OUT_RING (fui(cb[i]));
- }
- ws->buffer_unmap(ws, nv50->constbuf[PIPE_SHADER_VERTEX]);
- }
-
-
for (i = 0; i < p->immd_nr; i++) {
BEGIN_RING(tesla, 0x0f00, 2);
- OUT_RING ((p->param_nr + i) << 8);
+ OUT_RING ((NV50_CB_PMISC << 16) | (i << 8));
OUT_RING (fui(p->immd[i]));
}
return NULL;
}
- /* Static constant buffer */
- screen->constbuf = ws->buffer_create(ws, 0, 0, 256 * 4 * 4);
- if (nvws->res_init(&screen->vp_data_heap, 0, 256)) {
- NOUVEAU_ERR("Error initialising constant buffer\n");
- nv50_screen_destroy(&screen->pipe);
- return NULL;
- }
-
/* Static tesla init */
so = so_new(256, 20);
so_method(so, screen->tesla, 0x16b8, 1);
so_data (so, 8);
+ /* Shared constant buffer */
+ screen->constbuf = ws->buffer_create(ws, 0, 0, 256 * 4 * 4);
+ if (nvws->res_init(&screen->vp_data_heap, 0, 256)) {
+ NOUVEAU_ERR("Error initialising constant buffer\n");
+ nv50_screen_destroy(&screen->pipe);
+ return NULL;
+ }
+
so_method(so, screen->tesla, 0x1280, 3);
so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00001000);
+ so_data (so, (NV50_CB_PMISC << 16) | 0x00001000);
+
+ /* Texture sampler/image unit setup - we abuse the constant buffer
+ * upload mechanism for the moment to upload data to the tex config
+ * blocks. At some point we *may* want to go the NVIDIA way of doing
+ * things?
+ */
+ screen->tic = ws->buffer_create(ws, 0, 0, 32 * 8 * 4);
so_method(so, screen->tesla, 0x1280, 3);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00014000);
- so_method(so, screen->tesla, 0x1280, 3);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_data (so, (NV50_CB_TIC << 16) | 0x0800);
+ so_method(so, screen->tesla, 0x1574, 3);
+ so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00024000);
+ so_data (so, 0x00000800);
+
+ screen->tsc = ws->buffer_create(ws, 0, 0, 32 * 8 * 4);
so_method(so, screen->tesla, 0x1280, 3);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00034000);
- so_method(so, screen->tesla, 0x1280, 3);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_data (so, (NV50_CB_TSC << 16) | 0x0800);
+ so_method(so, screen->tesla, 0x155c, 3);
+ so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM |
+ so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00040100);
+ so_data (so, 0x00000800);
+
+ /* Vertex array limits - max them out */
for (i = 0; i < 16; i++) {
so_method(so, screen->tesla, 0x1080 + (i * 8), 2);
so_data (so, 0x000000ff);
so_ref(NULL, &so);
}
+ if (nv50->dirty & NV50_NEW_VERTPROG_CB) {
+ so = so_new(4, 2);
+ so_method(so, tesla, 0x1280, 3);
+ so_reloc (so, nv50->constbuf[PIPE_SHADER_VERTEX], 0,
+ NOUVEAU_BO_HIGH | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
+ 0, 0);
+ so_reloc (so, nv50->constbuf[PIPE_SHADER_VERTEX], 0,
+ NOUVEAU_BO_LOW | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
+ 0, 0);
+ so_data (so, (NV50_CB_PVP << 16) | 0x1000);
+ so_emit(nvws, so);
+ so_ref(NULL, &so);
+ }
+
+ if (nv50->dirty & NV50_NEW_FRAGPROG_CB) {
+ so = so_new(4, 2);
+ so_method(so, tesla, 0x1280, 3);
+ so_reloc (so, nv50->constbuf[PIPE_SHADER_FRAGMENT], 0,
+ NOUVEAU_BO_HIGH | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
+ 0, 0);
+ so_reloc (so, nv50->constbuf[PIPE_SHADER_FRAGMENT], 0,
+ NOUVEAU_BO_LOW | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
+ 0, 0);
+ so_data (so, (NV50_CB_PFP << 16) | 0x1000);
+ so_emit(nvws, so);
+ so_ref(NULL, &so);
+ }
+
+
if (nv50->dirty & NV50_NEW_ARRAYS)
nv50_vbo_validate(nv50);