X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnv50%2Fnv50_push.c;h=04e32b7e8b9d55ad53b945ca060797ff088fddb6;hb=6d1cdec3ba151168bfc3aef222fba6265dfb41fb;hp=07034bdcf62a59420746a0825f9d0513471ecf4c;hpb=79079141fa7cbf395d1ffc77364ac301d9824211;p=mesa.git diff --git a/src/gallium/drivers/nv50/nv50_push.c b/src/gallium/drivers/nv50/nv50_push.c index 07034bdcf62..04e32b7e8b9 100644 --- a/src/gallium/drivers/nv50/nv50_push.c +++ b/src/gallium/drivers/nv50/nv50_push.c @@ -11,7 +11,7 @@ #include "nv50_3d.xml.h" struct push_context { - struct nouveau_channel *chan; + struct nouveau_pushbuf *push; void *idxbuf; @@ -74,22 +74,20 @@ emit_vertices_i08(struct push_context *ctx, unsigned start, unsigned count) size = ctx->vertex_words * nr; - BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size); + BEGIN_NI04(ctx->push, NV50_3D(VERTEX_DATA), size); ctx->translate->run_elts8(ctx->translate, elts, nr, ctx->instance_id, - ctx->chan->cur); + ctx->push->cur); - ctx->chan->cur += size; + ctx->push->cur += size; count -= nr; elts += nr; if (nr != push) { count--; elts++; - BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2); - OUT_RING (ctx->chan, 0); - OUT_RING (ctx->chan, NVA0_3D_VERTEX_BEGIN_GL_INSTANCE_CONT | - (ctx->prim & ~NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT)); + BEGIN_NV04(ctx->push, NV50_3D(VB_ELEMENT_U32), 1); + PUSH_DATA (ctx->push, ctx->restart_index); } } } @@ -109,22 +107,20 @@ emit_vertices_i16(struct push_context *ctx, unsigned start, unsigned count) size = ctx->vertex_words * nr; - BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size); + BEGIN_NI04(ctx->push, NV50_3D(VERTEX_DATA), size); ctx->translate->run_elts16(ctx->translate, elts, nr, ctx->instance_id, - ctx->chan->cur); + ctx->push->cur); - ctx->chan->cur += size; + ctx->push->cur += size; count -= nr; elts += nr; if (nr != push) { count--; elts++; - BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2); - OUT_RING (ctx->chan, 0); - OUT_RING (ctx->chan, NVA0_3D_VERTEX_BEGIN_GL_INSTANCE_CONT | - (ctx->prim & ~NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT)); + BEGIN_NV04(ctx->push, NV50_3D(VB_ELEMENT_U32), 1); + PUSH_DATA (ctx->push, ctx->restart_index); } } } @@ -144,22 +140,20 @@ emit_vertices_i32(struct push_context *ctx, unsigned start, unsigned count) size = ctx->vertex_words * nr; - BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size); + BEGIN_NI04(ctx->push, NV50_3D(VERTEX_DATA), size); ctx->translate->run_elts(ctx->translate, elts, nr, ctx->instance_id, - ctx->chan->cur); + ctx->push->cur); - ctx->chan->cur += size; + ctx->push->cur += size; count -= nr; elts += nr; if (nr != push) { count--; elts++; - BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2); - OUT_RING (ctx->chan, 0); - OUT_RING (ctx->chan, NVA0_3D_VERTEX_BEGIN_GL_INSTANCE_CONT | - (ctx->prim & ~NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT)); + BEGIN_NV04(ctx->push, NV50_3D(VB_ELEMENT_U32), 1); + PUSH_DATA (ctx->push, ctx->restart_index); } } } @@ -171,11 +165,11 @@ emit_vertices_seq(struct push_context *ctx, unsigned start, unsigned count) unsigned push = MIN2(count, ctx->packet_vertex_limit); unsigned size = ctx->vertex_words * push; - BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size); + BEGIN_NI04(ctx->push, NV50_3D(VERTEX_DATA), size); ctx->translate->run(ctx->translate, start, push, ctx->instance_id, - ctx->chan->cur); - ctx->chan->cur += size; + ctx->push->cur); + ctx->push->cur += size; count -= push; start += push; } @@ -219,7 +213,7 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info) unsigned inst = info->instance_count; boolean apply_bias = info->indexed && info->index_bias; - ctx.chan = nv50->screen->base.channel; + ctx.push = nv50->base.pushbuf; ctx.translate = nv50->vertex->translate; ctx.packet_vertex_limit = nv50->vertex->packet_vertex_limit; ctx.vertex_words = nv50->vertex->vertex_size; @@ -229,7 +223,7 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info) struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i]; struct nv04_resource *res = nv04_resource(vb->buffer); - data = nouveau_resource_map_offset(&nv50->pipe, res, + data = nouveau_resource_map_offset(&nv50->base, res, vb->buffer_offset, NOUVEAU_BO_RD); if (apply_bias && likely(!(nv50->vertex->instance_bufs & (1 << i)))) @@ -239,7 +233,7 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info) } if (info->indexed) { - ctx.idxbuf = nouveau_resource_map_offset(&nv50->pipe, + ctx.idxbuf = nouveau_resource_map_offset(&nv50->base, nv04_resource(nv50->idxbuf.buffer), nv50->idxbuf.offset, NOUVEAU_BO_RD); if (!ctx.idxbuf) @@ -257,9 +251,20 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info) ctx.instance_id = info->start_instance; ctx.prim = nv50_prim_gl(info->mode); + if (info->primitive_restart) { + BEGIN_NV04(ctx.push, NV50_3D(PRIM_RESTART_ENABLE), 2); + PUSH_DATA (ctx.push, 1); + PUSH_DATA (ctx.push, info->restart_index); + } else + if (nv50->state.prim_restart) { + BEGIN_NV04(ctx.push, NV50_3D(PRIM_RESTART_ENABLE), 1); + PUSH_DATA (ctx.push, 0); + } + nv50->state.prim_restart = info->primitive_restart; + while (inst--) { - BEGIN_RING(ctx.chan, RING_3D(VERTEX_BEGIN_GL), 1); - OUT_RING (ctx.chan, ctx.prim); + BEGIN_NV04(ctx.push, NV50_3D(VERTEX_BEGIN_GL), 1); + PUSH_DATA (ctx.push, ctx.prim); switch (index_size) { case 0: emit_vertices_seq(&ctx, info->start, info->count); @@ -277,8 +282,8 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info) assert(0); break; } - BEGIN_RING(ctx.chan, RING_3D(VERTEX_END_GL), 1); - OUT_RING (ctx.chan, 0); + BEGIN_NV04(ctx.push, NV50_3D(VERTEX_END_GL), 1); + PUSH_DATA (ctx.push, 0); ctx.instance_id++; ctx.prim |= NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;