static int nv50_validate_textures(struct nv50_context *nv50, struct nouveau_stateobj *so, unsigned p) { struct nouveau_grobj *eng2d = nv50->screen->eng2d; struct nouveau_grobj *tesla = nv50->screen->tesla; unsigned unit, j; const unsigned rll = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW; const unsigned rlh = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH | NOUVEAU_BO_OR; nv50_so_init_sifc(nv50, so, nv50->screen->tic, NOUVEAU_BO_VRAM, p * (32 * 8 * 4), nv50->sampler_view_nr[p] * 8 * 4); for (unit = 0; unit < nv50->sampler_view_nr[p]; ++unit) { struct nv50_sampler_view *view = nv50_sampler_view(nv50->sampler_views[p][unit]); so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8); if (view) { uint32_t tic2 = view->tic[2]; struct nv50_miptree *mt = nv50_miptree(view->pipe.texture); tic2 &= ~NV50TIC_0_2_NORMALIZED_COORDS; if (nv50->sampler[p][unit]->normalized) tic2 |= NV50TIC_0_2_NORMALIZED_COORDS; view->tic[2] = tic2; so_data (so, view->tic[0]); so_reloc (so, mt->base.bo, 0, rll, 0, 0); so_reloc (so, mt->base.bo, 0, rlh, tic2, tic2); so_datap (so, &view->tic[3], 5); /* Set TEX insn $t src binding $unit in program type p * to TIC, TSC entry (32 * p + unit), mark valid (1). */ so_method(so, tesla, NV50TCL_BIND_TIC(p), 1); so_data (so, ((32 * p + unit) << 9) | (unit << 1) | 1); } else { for (j = 0; j < 8; ++j) so_data(so, 0); so_method(so, tesla, NV50TCL_BIND_TIC(p), 1); so_data (so, (unit << 1) | 0); } } for (; unit < nv50->state.sampler_view_nr[p]; unit++) { /* Make other bindings invalid. */ so_method(so, tesla, NV50TCL_BIND_TIC(p), 1); so_data (so, (unit << 1) | 0); } nv50->state.sampler_view_nr[p] = nv50->sampler_view_nr[p]; return TRUE; }
static boolean nv50_validate_textures(struct nv50_context *nv50, struct nouveau_stateobj *so, unsigned p) { static const unsigned p_remap[PIPE_SHADER_TYPES] = { 0, 2, 1 }; struct nouveau_grobj *eng2d = nv50->screen->eng2d; struct nouveau_grobj *tesla = nv50->screen->tesla; unsigned unit, j, p_hw = p_remap[p]; nv50_so_init_sifc(nv50, so, nv50->screen->tic, NOUVEAU_BO_VRAM, p * (32 * 8 * 4), nv50->miptree_nr[p] * 8 * 4); for (unit = 0; unit < nv50->miptree_nr[p]; ++unit) { struct nv50_miptree *mt = nv50->miptree[p][unit]; so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8); if (mt) { if (nv50_tex_construct(nv50, so, mt, unit, p)) return FALSE; /* Set TEX insn $t src binding $unit in program type p * to TIC, TSC entry (32 * p + unit), mark valid (1). */ so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1); so_data (so, ((32 * p + unit) << 9) | (unit << 1) | 1); } else { for (j = 0; j < 8; ++j) so_data(so, 0); so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1); so_data (so, (unit << 1) | 0); } } for (; unit < nv50->state.miptree_nr[p]; unit++) { /* Make other bindings invalid. */ so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1); so_data (so, (unit << 1) | 0); } nv50->state.miptree_nr[p] = nv50->miptree_nr[p]; return TRUE; }