diff options
author | Ben Skeggs <[email protected]> | 2011-12-23 14:03:49 +1000 |
---|---|---|
committer | Ben Skeggs <[email protected]> | 2012-04-14 02:56:12 +1000 |
commit | 2e47d01c9e5325906cf3bb979279599991c6328e (patch) | |
tree | 03f161f671bf350d5455669679c98c46192f9be6 /src/mesa/drivers/dri/nouveau/nv20_state_tex.c | |
parent | 7308b6e75fe64f4e3f318bc7b5d276585e4f6957 (diff) |
nouveau/vieux: switch to libdrm_nouveau-2.0
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nv20_state_tex.c')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv20_state_tex.c | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c index 0b1bd856bc3..799510daa69 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c @@ -37,8 +37,7 @@ nv20_emit_tex_gen(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_GEN0; struct nouveau_context *nctx = to_nouveau_context(ctx); - struct nouveau_channel *chan = context_chan(ctx); - struct nouveau_grobj *kelvin = context_eng3d(ctx); + struct nouveau_pushbuf *push = context_push(ctx); struct gl_texture_unit *unit = &ctx->Texture.Unit[i]; int j; @@ -48,17 +47,16 @@ nv20_emit_tex_gen(struct gl_context *ctx, int emit) float *k = get_texgen_coeff(coord); if (k) { - BEGIN_RING(chan, kelvin, - NV20_3D_TEX_GEN_COEFF(i, j), 4); - OUT_RINGp(chan, k, 4); + BEGIN_NV04(push, NV20_3D(TEX_GEN_COEFF(i, j)), 4); + PUSH_DATAp(push, k, 4); } - BEGIN_RING(chan, kelvin, NV20_3D_TEX_GEN_MODE(i, j), 1); - OUT_RING(chan, nvgl_texgen_mode(coord->Mode)); + BEGIN_NV04(push, NV20_3D(TEX_GEN_MODE(i, j)), 1); + PUSH_DATA (push, nvgl_texgen_mode(coord->Mode)); } else { - BEGIN_RING(chan, kelvin, NV20_3D_TEX_GEN_MODE(i, j), 1); - OUT_RING(chan, 0); + BEGIN_NV04(push, NV20_3D(TEX_GEN_MODE(i, j)), 1); + PUSH_DATA (push, 0); } } } @@ -68,20 +66,19 @@ nv20_emit_tex_mat(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_MAT0; struct nouveau_context *nctx = to_nouveau_context(ctx); - struct nouveau_channel *chan = context_chan(ctx); - struct nouveau_grobj *kelvin = context_eng3d(ctx); + struct nouveau_pushbuf *push = context_push(ctx); if (nctx->fallback == HWTNL && (ctx->Texture._TexMatEnabled & 1 << i)) { - BEGIN_RING(chan, kelvin, NV20_3D_TEX_MATRIX_ENABLE(i), 1); - OUT_RING(chan, 1); + BEGIN_NV04(push, NV20_3D(TEX_MATRIX_ENABLE(i)), 1); + PUSH_DATA (push, 1); - BEGIN_RING(chan, kelvin, NV20_3D_TEX_MATRIX(i,0), 16); - OUT_RINGm(chan, ctx->TextureMatrixStack[i].Top->m); + BEGIN_NV04(push, NV20_3D(TEX_MATRIX(i,0)), 16); + PUSH_DATAm(push, ctx->TextureMatrixStack[i].Top->m); } else { - BEGIN_RING(chan, kelvin, NV20_3D_TEX_MATRIX_ENABLE(i), 1); - OUT_RING(chan, 0); + BEGIN_NV04(push, NV20_3D(TEX_MATRIX_ENABLE(i)), 1); + PUSH_DATA (push, 0); } } @@ -151,18 +148,18 @@ void nv20_emit_tex_obj(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_OBJ0; - struct nouveau_channel *chan = context_chan(ctx); - struct nouveau_grobj *kelvin = context_eng3d(ctx); - struct nouveau_bo_context *bctx = context_bctx_i(ctx, TEXTURE, i); + struct nouveau_pushbuf *push = context_push(ctx); const int bo_flags = NOUVEAU_BO_RD | NOUVEAU_BO_GART | NOUVEAU_BO_VRAM; struct gl_texture_object *t; struct nouveau_surface *s; struct gl_texture_image *ti; uint32_t tx_format, tx_filter, tx_wrap, tx_enable; + PUSH_RESET(push, BUFCTX_TEX(i)); + if (!ctx->Texture.Unit[i]._ReallyEnabled) { - BEGIN_RING(chan, kelvin, NV20_3D_TEX_ENABLE(i), 1); - OUT_RING(chan, 0); + BEGIN_NV04(push, NV20_3D(TEX_ENABLE(i)), 1); + PUSH_DATA (push, 0); context_dirty(ctx, TEX_SHADER); return; @@ -195,10 +192,10 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) | log2i(t->Sampler.MaxAnisotropy) << 4; if (t->Target == GL_TEXTURE_RECTANGLE) { - BEGIN_RING(chan, kelvin, NV20_3D_TEX_NPOT_PITCH(i), 1); - OUT_RING(chan, s->pitch << 16); - BEGIN_RING(chan, kelvin, NV20_3D_TEX_NPOT_SIZE(i), 1); - OUT_RING(chan, s->width << 16 | s->height); + BEGIN_NV04(push, NV20_3D(TEX_NPOT_PITCH(i)), 1); + PUSH_DATA (push, s->pitch << 16); + BEGIN_NV04(push, NV20_3D(TEX_NPOT_SIZE(i)), 1); + PUSH_DATA (push, s->width << 16 | s->height); tx_format |= get_tex_format_rect(ti); } else { @@ -223,23 +220,24 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) } /* Write it to the hardware. */ - nouveau_bo_mark(bctx, kelvin, NV20_3D_TEX_FORMAT(i), - s->bo, tx_format, 0, - NV20_3D_TEX_FORMAT_DMA0, - NV20_3D_TEX_FORMAT_DMA1, - bo_flags | NOUVEAU_BO_OR); - - nouveau_bo_markl(bctx, kelvin, NV20_3D_TEX_OFFSET(i), + BEGIN_NV04(push, NV20_3D(TEX_FORMAT(i)), 1); + PUSH_MTHD (push, NV20_3D(TEX_FORMAT(i)), BUFCTX_TEX(i), + s->bo, tx_format, bo_flags | NOUVEAU_BO_OR, + NV20_3D_TEX_FORMAT_DMA0, + NV20_3D_TEX_FORMAT_DMA1); + + BEGIN_NV04(push, NV20_3D(TEX_OFFSET(i)), 1); + PUSH_MTHDl(push, NV20_3D(TEX_OFFSET(i)), BUFCTX_TEX(i), s->bo, s->offset, bo_flags); - BEGIN_RING(chan, kelvin, NV20_3D_TEX_WRAP(i), 1); - OUT_RING(chan, tx_wrap); + BEGIN_NV04(push, NV20_3D(TEX_WRAP(i)), 1); + PUSH_DATA (push, tx_wrap); - BEGIN_RING(chan, kelvin, NV20_3D_TEX_FILTER(i), 1); - OUT_RING(chan, tx_filter); + BEGIN_NV04(push, NV20_3D(TEX_FILTER(i)), 1); + PUSH_DATA (push, tx_filter); - BEGIN_RING(chan, kelvin, NV20_3D_TEX_ENABLE(i), 1); - OUT_RING(chan, tx_enable); + BEGIN_NV04(push, NV20_3D(TEX_ENABLE(i)), 1); + PUSH_DATA (push, tx_enable); context_dirty(ctx, TEX_SHADER); } @@ -247,8 +245,7 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) void nv20_emit_tex_shader(struct gl_context *ctx, int emit) { - struct nouveau_channel *chan = context_chan(ctx); - struct nouveau_grobj *kelvin = context_eng3d(ctx); + struct nouveau_pushbuf *push = context_push(ctx); uint32_t tx_shader_op = 0; int i; @@ -259,6 +256,6 @@ nv20_emit_tex_shader(struct gl_context *ctx, int emit) tx_shader_op |= NV20_3D_TEX_SHADER_OP_TX0_TEXTURE_2D << 5 * i; } - BEGIN_RING(chan, kelvin, NV20_3D_TEX_SHADER_OP, 1); - OUT_RING(chan, tx_shader_op); + BEGIN_NV04(push, NV20_3D(TEX_SHADER_OP), 1); + PUSH_DATA (push, tx_shader_op); } |