if (nvc0->framebuffer.cbufs[i] &&
nvc0->framebuffer.cbufs[i]->texture == res) {
nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
if (!--ref)
return ref;
}
if (nvc0->framebuffer.zsbuf &&
nvc0->framebuffer.zsbuf->texture == res) {
nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
if (!--ref)
return ref;
}
for (i = 0; i < nvc0->num_vtxbufs; ++i) {
if (nvc0->vtxbuf[i].buffer == res) {
nvc0->dirty_3d |= NVC0_NEW_3D_ARRAYS;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX);
if (!--ref)
return ref;
}
if (nvc0->idxbuf.buffer == res) {
nvc0->dirty_3d |= NVC0_NEW_3D_IDXBUF;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_IDX);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_IDX);
if (!--ref)
return ref;
}
nvc0->textures[s][i]->texture == res) {
nvc0->textures_dirty[s] |= 1 << i;
nvc0->dirty_3d |= NVC0_NEW_3D_TEXTURES;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(s, i));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(s, i));
if (!--ref)
return ref;
}
nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_CB(i));
} else {
nvc0->dirty_3d |= NVC0_NEW_3D_CONSTBUF;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_CB(s, i));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_CB(s, i));
}
if (!--ref)
return ref;
nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_BUF);
} else {
nvc0->dirty_3d |= NVC0_NEW_3D_BUFFERS;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_BUF);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_BUF);
}
if (!--ref)
return ref;
/* Do not bind the COMPUTE driver constbuf at screen initialization because
* CBs are aliased between 3D and COMPUTE, but make sure it will be bound if
* a grid is launched later. */
- nvc0->dirty_cp |= NVC0_NEW_3D_DRIVERCONST;
+ nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
/* now that there are no more opportunities for errors, set the current
* context if there isn't already one.
flags = NV_VRAM_DOMAIN(&screen->base) | NOUVEAU_BO_RD;
- BCTX_REFN_bo(nvc0->bufctx_3d, SCREEN, flags, screen->text);
- BCTX_REFN_bo(nvc0->bufctx_3d, SCREEN, flags, screen->uniform_bo);
- BCTX_REFN_bo(nvc0->bufctx_3d, SCREEN, flags, screen->txc);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_SCREEN, flags, screen->text);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_SCREEN, flags, screen->uniform_bo);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_SCREEN, flags, screen->txc);
if (screen->compute) {
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->text);
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->uniform_bo);
flags = NV_VRAM_DOMAIN(&screen->base) | NOUVEAU_BO_RDWR;
if (screen->poly_cache)
- BCTX_REFN_bo(nvc0->bufctx_3d, SCREEN, flags, screen->poly_cache);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_SCREEN, flags, screen->poly_cache);
if (screen->compute)
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->tls);
flags = NOUVEAU_BO_GART | NOUVEAU_BO_WR;
- BCTX_REFN_bo(nvc0->bufctx_3d, SCREEN, flags, screen->fence.bo);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_SCREEN, flags, screen->fence.bo);
BCTX_REFN_bo(nvc0->bufctx, FENCE, flags, screen->fence.bo);
if (screen->compute)
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->fence.bo);
#define NVC0_NEW_CP_BUFFERS (1 << 7)
/* 3d bufctx (during draw_vbo, blit_3d) */
-#define NVC0_BIND_FB 0
-#define NVC0_BIND_VTX 1
-#define NVC0_BIND_VTX_TMP 2
-#define NVC0_BIND_IDX 3
-#define NVC0_BIND_TEX(s, i) ( 4 + 32 * (s) + (i))
-#define NVC0_BIND_CB(s, i) (164 + 16 * (s) + (i))
-#define NVC0_BIND_TFB 244
-#define NVC0_BIND_SUF 245
-#define NVC0_BIND_BUF 246
-#define NVC0_BIND_SCREEN 247
-#define NVC0_BIND_TLS 249
-#define NVC0_BIND_3D_COUNT 250
+#define NVC0_BIND_3D_FB 0
+#define NVC0_BIND_3D_VTX 1
+#define NVC0_BIND_3D_VTX_TMP 2
+#define NVC0_BIND_3D_IDX 3
+#define NVC0_BIND_3D_TEX(s, i) ( 4 + 32 * (s) + (i))
+#define NVC0_BIND_3D_CB(s, i) (164 + 16 * (s) + (i))
+#define NVC0_BIND_3D_TFB 244
+#define NVC0_BIND_3D_SUF 245
+#define NVC0_BIND_3D_BUF 246
+#define NVC0_BIND_3D_SCREEN 247
+#define NVC0_BIND_3D_TLS 249
+#define NVC0_BIND_3D_COUNT 250
/* compute bufctx (during launch_grid) */
#define NVC0_BIND_CP_CB(i) ( 0 + (i))
if (prog && prog->need_tls) {
const uint32_t flags = NV_VRAM_DOMAIN(&nvc0->screen->base) | NOUVEAU_BO_RDWR;
if (!nvc0->state.tls_required)
- BCTX_REFN_bo(nvc0->bufctx_3d, TLS, flags, nvc0->screen->tls);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_TLS, flags, nvc0->screen->tls);
nvc0->state.tls_required |= 1 << stage;
} else {
if (nvc0->state.tls_required == (1 << stage))
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TLS);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TLS);
nvc0->state.tls_required &= ~(1 << stage);
}
if (!(nvc0->dirty_3d & NVC0_NEW_3D_TFB_TARGETS))
return;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TFB);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TFB);
for (b = 0; b < nvc0->num_tfbbufs; ++b) {
struct nvc0_so_target *targ = nvc0_so_target(nvc0->tfbbuf[b]);
buf = nv04_resource(targ->pipe.buffer);
- BCTX_REFN(nvc0->bufctx_3d, TFB, buf, WR);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_TFB, buf, WR);
if (!(nvc0->tfbbuf_dirty & (1 << b)))
continue;
}
if (old) {
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(s, i));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(s, i));
nvc0_screen_tic_unlock(nvc0->screen, old);
}
for (i = nr; i < nvc0->num_textures[s]; ++i) {
struct nv50_tic_entry *old = nv50_tic_entry(nvc0->textures[s][i]);
if (old) {
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(s, i));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(s, i));
nvc0_screen_tic_unlock(nvc0->screen, old);
pipe_sampler_view_reference(&nvc0->textures[s][i], NULL);
}
{
struct nouveau_bufctx *bctx = (s == 5) ? nvc0->bufctx_cp : nvc0->bufctx_3d;
const unsigned end = start + nr;
- const unsigned bin = (s == 5) ? NVC0_BIND_CP_TEX(0) : NVC0_BIND_TEX(s, 0);
+ const unsigned bin = (s == 5) ? NVC0_BIND_CP_TEX(0) : NVC0_BIND_3D_TEX(s, 0);
int last_valid = -1;
unsigned i;
nvc0->constbuf[s][i].u.buf = NULL;
else
if (nvc0->constbuf[s][i].u.buf)
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_CB(s, i));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_CB(s, i));
nvc0->dirty_3d |= NVC0_NEW_3D_CONSTBUF;
}
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
util_copy_framebuffer_state(&nvc0->framebuffer, fb);
struct nvc0_context *nvc0 = nvc0_context(pipe);
unsigned i;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX);
nvc0->dirty_3d |= NVC0_NEW_3D_ARRAYS;
util_set_vertex_buffers_count(nvc0->vtxbuf, &nvc0->num_vtxbufs, vb,
struct nvc0_context *nvc0 = nvc0_context(pipe);
if (nvc0->idxbuf.buffer)
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_IDX);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_IDX);
if (ib) {
pipe_resource_reference(&nvc0->idxbuf.buffer, ib->buffer);
nvc0->surfaces_dirty[t] |= mask;
if (t == 0)
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_SUF);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_SUF);
else
nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_SUF);
}
if (t == 5)
nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_BUF);
else
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_BUF);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_BUF);
}
unsigned ms_mode = NVC0_3D_MULTISAMPLE_MODE_MS1;
bool serialize = false;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
BEGIN_NVC0(push, NVC0_3D(RT_CONTROL), 1);
PUSH_DATA (push, (076543210 << 4) | fb->nr_cbufs);
res->status &= ~NOUVEAU_BUFFER_STATUS_GPU_READING;
/* only register for writing, otherwise we'd always serialize here */
- BCTX_REFN(nvc0->bufctx_3d, FB, res, WR);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_FB, res, WR);
}
if (fb->zsbuf) {
mt->base.status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING;
mt->base.status &= ~NOUVEAU_BUFFER_STATUS_GPU_READING;
- BCTX_REFN(nvc0->bufctx_3d, FB, &mt->base, WR);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_FB, &mt->base, WR);
} else {
BEGIN_NVC0(push, NVC0_3D(ZETA_ENABLE), 1);
PUSH_DATA (push, 0);
BEGIN_NVC0(push, NVC0_3D(CB_BIND(s)), 1);
PUSH_DATA (push, (i << 4) | 1);
- BCTX_REFN(nvc0->bufctx_3d, CB(s, i), res, RD);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_CB(s, i), res, RD);
nvc0->cb_dirty = 1; /* Force cache flush for UBO. */
res->cb_bindings[s] |= 1 << i;
PUSH_DATAh(push, res->address + nvc0->buffers[s][i].buffer_offset);
PUSH_DATA (push, nvc0->buffers[s][i].buffer_size);
PUSH_DATA (push, 0);
- BCTX_REFN(nvc0->bufctx_3d, BUF, res, RDWR);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_BUF, res, RDWR);
} else {
PUSH_DATA (push, 0);
PUSH_DATA (push, 0);
nvc0->textures_dirty[4] |= 3;
nvc0->samplers_dirty[4] |= 3;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(4, 0));
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(4, 1));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(4, 0));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(4, 1));
nvc0->dirty_3d = NVC0_NEW_3D_FRAMEBUFFER | NVC0_NEW_3D_MIN_SAMPLES |
NVC0_NEW_3D_VERTPROG | NVC0_NEW_3D_FRAGPROG |
nvc0->base.pipe.render_condition(&nvc0->base.pipe, nvc0->cond_query,
nvc0->cond_cond, nvc0->cond_mode);
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX_TMP);
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(4, 0));
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(4, 1));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX_TMP);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(4, 0));
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(4, 1));
nouveau_scratch_done(&nvc0->base);
nvc0->dirty_3d = blit->saved.dirty_3d |
return;
}
- BCTX_REFN_bo(nvc0->bufctx_3d, VTX_TMP, NOUVEAU_BO_GART | NOUVEAU_BO_RD, vtxbuf_bo);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP,
+ NOUVEAU_BO_GART | NOUVEAU_BO_RD, vtxbuf_bo);
nouveau_pushbuf_validate(push);
BEGIN_NVC0(push, NVC0_3D(VERTEX_ARRAY_FETCH(0)), 4);
if (unlikely(s == 5))
BCTX_REFN(nvc0->bufctx_cp, CP_TEX(i), res, RD);
else
- BCTX_REFN(nvc0->bufctx_3d, TEX(s, i), res, RD);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_TEX(s, i), res, RD);
}
for (; i < nvc0->state.num_textures[s]; ++i)
commands[n++] = (i << 1) | 0;
nvc0->tex_handles[s][i] &= ~NVE4_TIC_ENTRY_INVALID;
nvc0->tex_handles[s][i] |= tic->id;
if (dirty)
- BCTX_REFN(nvc0->bufctx_3d, TEX(s, i), res, RD);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_TEX(s, i), res, RD);
}
for (; i < nvc0->state.num_textures[s]; ++i) {
nvc0->tex_handles[s][i] |= NVE4_TIC_ENTRY_INVALID;
nvc0_release_user_vbufs(struct nvc0_context *nvc0)
{
if (nvc0->vbo_user) {
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX_TMP);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX_TMP);
nouveau_scratch_done(&nvc0->base);
}
}
address[b] = nouveau_scratch_data(&nvc0->base, vb->user_buffer,
base, size, &bo);
if (bo)
- BCTX_REFN_bo(nvc0->bufctx_3d, VTX_TMP, bo_flags, bo);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, bo_flags, bo);
NOUVEAU_DRV_STAT(&nvc0->screen->base, user_buffer_upload_bytes, size);
}
address = nouveau_scratch_data(&nvc0->base, nvc0->vtxbuf[b].user_buffer,
base, size, &bo);
if (bo)
- BCTX_REFN_bo(nvc0->bufctx_3d, VTX_TMP, bo_flags, bo);
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, bo_flags, bo);
BEGIN_1IC0(push, NVC0_3D(MACRO_VERTEX_ARRAY_SELECT), 5);
PUSH_DATA (push, b);
if (!(refd & (1 << b))) {
refd |= 1 << b;
- BCTX_REFN(nvc0->bufctx_3d, VTX, res, RD);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_VTX, res, RD);
}
}
if (nvc0->vbo_user)
PUSH_DATAh(push, buf->address + limit);
PUSH_DATA (push, buf->address + limit);
- BCTX_REFN(nvc0->bufctx_3d, VTX, buf, RD);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_VTX, buf, RD);
}
/* If there are more elements than buffers, we might not have unset
* fetching on the later elements.
uint8_t vbo_mode;
bool update_vertex;
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX);
assert(vertex);
if (unlikely(vertex->need_conversion) ||
PUSH_DATA (push, buf->address + buf->base.width0 - 1);
PUSH_DATA (push, nvc0->idxbuf.index_size >> 1);
- BCTX_REFN(nvc0->bufctx_3d, IDX, buf, RD);
+ BCTX_REFN(nvc0->bufctx_3d, 3D_IDX, buf, RD);
}
#define NVC0_PRIM_GL_CASE(n) \
PUSH_DATAh(push, va + size - 1);
PUSH_DATA (push, va + size - 1);
- BCTX_REFN_bo(nvc0->bufctx_3d, VTX_TMP, NOUVEAU_BO_GART | NOUVEAU_BO_RD,
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, NOUVEAU_BO_GART | NOUVEAU_BO_RD,
bo);
nouveau_pushbuf_validate(push);
prim |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
++ctx.instance_id;
}
- nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX_TMP);
+ nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX_TMP);
nouveau_scratch_done(&nvc0->base);
} while (inst_count);
data = (uint32_t *)nouveau_scratch_get(&nvc0->base,
info->count * index_size, &va, &bo);
- BCTX_REFN_bo(nvc0->bufctx_3d, VTX_TMP, NOUVEAU_BO_GART | NOUVEAU_BO_RD,
+ BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, NOUVEAU_BO_GART | NOUVEAU_BO_RD,
bo);
nouveau_pushbuf_validate(push);