From 69f54d2a7e06210f28b46d20f74a906d9750a36e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Viktor=20Novotn=C3=BD?= Date: Mon, 1 Nov 2010 01:22:44 +0100 Subject: [PATCH] dri/nouveau nv20: Use rules-ng-ng headers Signed-off-by: Francisco Jerez --- src/mesa/drivers/dri/nouveau/nv20_context.c | 231 +++++++++--------- src/mesa/drivers/dri/nouveau/nv20_render.c | 46 ++-- src/mesa/drivers/dri/nouveau/nv20_state_fb.c | 20 +- .../drivers/dri/nouveau/nv20_state_frag.c | 16 +- .../drivers/dri/nouveau/nv20_state_polygon.c | 4 +- .../drivers/dri/nouveau/nv20_state_raster.c | 4 +- src/mesa/drivers/dri/nouveau/nv20_state_tex.c | 81 +++--- src/mesa/drivers/dri/nouveau/nv20_state_tnl.c | 96 ++++---- 8 files changed, 248 insertions(+), 250 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c index 89200fb70da..e0483b261ef 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_context.c +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c @@ -28,7 +28,8 @@ #include "nouveau_context.h" #include "nouveau_fbo.h" #include "nouveau_util.h" -#include "nouveau_class.h" +#include "nv_object.xml.h" +#include "nv20_3d.xml.h" #include "nv04_driver.h" #include "nv10_driver.h" #include "nv20_driver.h" @@ -56,15 +57,15 @@ nv20_clear(struct gl_context *ctx, GLbitfield buffers) fb->_ColorDrawBuffers[0])->surface; if (ctx->Color.ColorMask[0][RCOMP]) - clear |= NV20TCL_CLEAR_BUFFERS_COLOR_R; + clear |= NV20_3D_CLEAR_BUFFERS_COLOR_R; if (ctx->Color.ColorMask[0][GCOMP]) - clear |= NV20TCL_CLEAR_BUFFERS_COLOR_G; + clear |= NV20_3D_CLEAR_BUFFERS_COLOR_G; if (ctx->Color.ColorMask[0][BCOMP]) - clear |= NV20TCL_CLEAR_BUFFERS_COLOR_B; + clear |= NV20_3D_CLEAR_BUFFERS_COLOR_B; if (ctx->Color.ColorMask[0][ACOMP]) - clear |= NV20TCL_CLEAR_BUFFERS_COLOR_A; + clear |= NV20_3D_CLEAR_BUFFERS_COLOR_A; - BEGIN_RING(chan, kelvin, NV20TCL_CLEAR_VALUE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_CLEAR_VALUE, 1); OUT_RING(chan, pack_rgba_f(s->format, ctx->Color.ClearColor)); buffers &= ~BUFFER_BITS_COLOR; @@ -75,18 +76,18 @@ nv20_clear(struct gl_context *ctx, GLbitfield buffers) fb->_DepthBuffer->Wrapped)->surface; if (buffers & BUFFER_BIT_DEPTH && ctx->Depth.Mask) - clear |= NV20TCL_CLEAR_BUFFERS_DEPTH; + clear |= NV20_3D_CLEAR_BUFFERS_DEPTH; if (buffers & BUFFER_BIT_STENCIL && ctx->Stencil.WriteMask[0]) - clear |= NV20TCL_CLEAR_BUFFERS_STENCIL; + clear |= NV20_3D_CLEAR_BUFFERS_STENCIL; - BEGIN_RING(chan, kelvin, NV20TCL_CLEAR_DEPTH_VALUE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_CLEAR_DEPTH_VALUE, 1); OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear, ctx->Stencil.Clear)); buffers &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL); } - BEGIN_RING(chan, kelvin, NV20TCL_CLEAR_BUFFERS, 1); + BEGIN_RING(chan, kelvin, NV20_3D_CLEAR_BUFFERS, 1); OUT_RING(chan, clear); nouveau_clear(ctx, buffers); @@ -100,38 +101,38 @@ nv20_hwctx_init(struct gl_context *ctx) struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; int i; - BEGIN_RING(chan, kelvin, NV20TCL_DMA_NOTIFY, 1); + BEGIN_RING(chan, kelvin, NV20_3D_DMA_NOTIFY, 1); OUT_RING (chan, hw->ntfy->handle); - BEGIN_RING(chan, kelvin, NV20TCL_DMA_TEXTURE0, 2); + BEGIN_RING(chan, kelvin, NV20_3D_DMA_TEXTURE0, 2); OUT_RING (chan, chan->vram->handle); OUT_RING (chan, chan->gart->handle); - BEGIN_RING(chan, kelvin, NV20TCL_DMA_COLOR, 2); + BEGIN_RING(chan, kelvin, NV20_3D_DMA_COLOR, 2); OUT_RING (chan, chan->vram->handle); OUT_RING (chan, chan->vram->handle); - BEGIN_RING(chan, kelvin, NV20TCL_DMA_VTXBUF0, 2); + BEGIN_RING(chan, kelvin, NV20_3D_DMA_VTXBUF0, 2); OUT_RING(chan, chan->vram->handle); OUT_RING(chan, chan->gart->handle); - BEGIN_RING(chan, kelvin, NV20TCL_DMA_QUERY, 1); + BEGIN_RING(chan, kelvin, NV20_3D_DMA_QUERY, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_RT_HORIZ, 2); + BEGIN_RING(chan, kelvin, NV20_3D_RT_HORIZ, 2); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_HORIZ(0), 1); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_CLIP_HORIZ(0), 1); OUT_RING (chan, 0xfff << 16 | 0x0); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_VERT(0), 1); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_CLIP_VERT(0), 1); OUT_RING (chan, 0xfff << 16 | 0x0); - for (i = 1; i < NV20TCL_VIEWPORT_CLIP_HORIZ__SIZE; i++) { - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_HORIZ(i), 1); + for (i = 1; i < NV20_3D_VIEWPORT_CLIP_HORIZ__LEN; i++) { + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_CLIP_HORIZ(i), 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_VERT(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_CLIP_VERT(i), 1); OUT_RING (chan, 0); } - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_MODE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_CLIP_MODE, 1); OUT_RING (chan, 0); BEGIN_RING(chan, kelvin, 0x17e0, 3); @@ -140,13 +141,13 @@ nv20_hwctx_init(struct gl_context *ctx) OUT_RINGf (chan, 1.0); if (context_chipset(ctx) >= 0x25) { - BEGIN_RING(chan, kelvin, NV20TCL_TX_RCOMP, 1); - OUT_RING (chan, NV20TCL_TX_RCOMP_LEQUAL | 0xdb0); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_RCOMP, 1); + OUT_RING (chan, NV20_3D_TEX_RCOMP_LEQUAL | 0xdb0); } else { BEGIN_RING(chan, kelvin, 0x1e68, 1); OUT_RING (chan, 0x4b800000); /* 16777216.000000 */ - BEGIN_RING(chan, kelvin, NV20TCL_TX_RCOMP, 1); - OUT_RING (chan, NV20TCL_TX_RCOMP_LEQUAL); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_RCOMP, 1); + OUT_RING (chan, NV20_3D_TEX_RCOMP_LEQUAL); } BEGIN_RING(chan, kelvin, 0x290, 1); @@ -166,19 +167,19 @@ nv20_hwctx_init(struct gl_context *ctx) BEGIN_RING(chan, kelvin, 0x1d88, 1); OUT_RING (chan, 3); - BEGIN_RING(chan, kelvin, NV25TCL_DMA_IN_MEMORY9, 1); + BEGIN_RING(chan, kelvin, NV25_3D_DMA_HIERZ, 1); OUT_RING (chan, chan->vram->handle); - BEGIN_RING(chan, kelvin, NV25TCL_DMA_IN_MEMORY8, 1); + BEGIN_RING(chan, kelvin, NV25_3D_UNK01AC, 1); OUT_RING (chan, chan->vram->handle); } - BEGIN_RING(chan, kelvin, NV20TCL_DMA_FENCE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_DMA_FENCE, 1); OUT_RING (chan, 0); BEGIN_RING(chan, kelvin, 0x1e98, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_NOTIFY, 1); + BEGIN_RING(chan, kelvin, NV01_GRAPH_NOTIFY, 1); OUT_RING (chan, 0); BEGIN_RING(chan, kelvin, 0x120, 3); @@ -191,189 +192,189 @@ nv20_hwctx_init(struct gl_context *ctx) OUT_RING (chan, 0); } - BEGIN_RING(chan, kelvin, NV20TCL_RT_HORIZ, 2); + BEGIN_RING(chan, kelvin, NV20_3D_RT_HORIZ, 2); OUT_RING (chan, 0 << 16 | 0); OUT_RING (chan, 0 << 16 | 0); - BEGIN_RING(chan, kelvin, NV20TCL_ALPHA_FUNC_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_ALPHA_FUNC_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_ALPHA_FUNC_FUNC, 2); - OUT_RING (chan, NV20TCL_ALPHA_FUNC_FUNC_ALWAYS); + BEGIN_RING(chan, kelvin, NV20_3D_ALPHA_FUNC_FUNC, 2); + OUT_RING (chan, NV20_3D_ALPHA_FUNC_FUNC_ALWAYS); OUT_RING (chan, 0); - for (i = 0; i < NV20TCL_TX_ENABLE__SIZE; i++) { - BEGIN_RING(chan, kelvin, NV20TCL_TX_ENABLE(i), 1); + for (i = 0; i < NV20_3D_TEX__LEN; i++) { + BEGIN_RING(chan, kelvin, NV20_3D_TEX_ENABLE(i), 1); OUT_RING (chan, 0); } - BEGIN_RING(chan, kelvin, NV20TCL_TX_SHADER_OP, 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_SHADER_OP, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_TX_SHADER_CULL_MODE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_SHADER_CULL_MODE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_ALPHA(0), 4); + BEGIN_RING(chan, kelvin, NV20_3D_RC_IN_ALPHA(0), 4); OUT_RING (chan, 0x30d410d0); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_RGB(0), 4); + BEGIN_RING(chan, kelvin, NV20_3D_RC_OUT_RGB(0), 4); OUT_RING (chan, 0x00000c00); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_RC_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_RC_ENABLE, 1); OUT_RING (chan, 0x00011101); - BEGIN_RING(chan, kelvin, NV20TCL_RC_FINAL0, 2); + BEGIN_RING(chan, kelvin, NV20_3D_RC_FINAL0, 2); OUT_RING (chan, 0x130e0300); OUT_RING (chan, 0x0c091c80); - BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_ALPHA(0), 4); + BEGIN_RING(chan, kelvin, NV20_3D_RC_OUT_ALPHA(0), 4); OUT_RING (chan, 0x00000c00); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_RGB(0), 4); + BEGIN_RING(chan, kelvin, NV20_3D_RC_IN_RGB(0), 4); OUT_RING (chan, 0x20c400c0); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_RC_COLOR0, 2); + BEGIN_RING(chan, kelvin, NV20_3D_RC_COLOR0, 2); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_RC_CONSTANT_COLOR0(0), 4); + BEGIN_RING(chan, kelvin, NV20_3D_RC_CONSTANT_COLOR0(0), 4); OUT_RING (chan, 0x035125a0); OUT_RING (chan, 0); OUT_RING (chan, 0x40002000); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_MULTISAMPLE_CONTROL, 1); + BEGIN_RING(chan, kelvin, NV20_3D_MULTISAMPLE_CONTROL, 1); OUT_RING (chan, 0xffff0000); - BEGIN_RING(chan, kelvin, NV20TCL_BLEND_FUNC_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_BLEND_FUNC_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_DITHER_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_DITHER_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_STENCIL_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_STENCIL_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_BLEND_FUNC_SRC, 4); - OUT_RING (chan, NV20TCL_BLEND_FUNC_SRC_ONE); - OUT_RING (chan, NV20TCL_BLEND_FUNC_DST_ZERO); + BEGIN_RING(chan, kelvin, NV20_3D_BLEND_FUNC_SRC, 4); + OUT_RING (chan, NV20_3D_BLEND_FUNC_SRC_ONE); + OUT_RING (chan, NV20_3D_BLEND_FUNC_DST_ZERO); OUT_RING (chan, 0); - OUT_RING (chan, NV20TCL_BLEND_EQUATION_FUNC_ADD); - BEGIN_RING(chan, kelvin, NV20TCL_STENCIL_MASK, 7); + OUT_RING (chan, NV20_3D_BLEND_EQUATION_FUNC_ADD); + BEGIN_RING(chan, kelvin, NV20_3D_STENCIL_MASK, 7); OUT_RING (chan, 0xff); - OUT_RING (chan, NV20TCL_STENCIL_FUNC_FUNC_ALWAYS); + OUT_RING (chan, NV20_3D_STENCIL_FUNC_FUNC_ALWAYS); OUT_RING (chan, 0); OUT_RING (chan, 0xff); - OUT_RING (chan, NV20TCL_STENCIL_OP_FAIL_KEEP); - OUT_RING (chan, NV20TCL_STENCIL_OP_ZFAIL_KEEP); - OUT_RING (chan, NV20TCL_STENCIL_OP_ZPASS_KEEP); + OUT_RING (chan, NV20_3D_STENCIL_OP_FAIL_KEEP); + OUT_RING (chan, NV20_3D_STENCIL_OP_ZFAIL_KEEP); + OUT_RING (chan, NV20_3D_STENCIL_OP_ZPASS_KEEP); - BEGIN_RING(chan, kelvin, NV20TCL_COLOR_LOGIC_OP_ENABLE, 2); + BEGIN_RING(chan, kelvin, NV20_3D_COLOR_LOGIC_OP_ENABLE, 2); OUT_RING (chan, 0); - OUT_RING (chan, NV20TCL_COLOR_LOGIC_OP_OP_COPY); + OUT_RING (chan, NV20_3D_COLOR_LOGIC_OP_OP_COPY); BEGIN_RING(chan, kelvin, 0x17cc, 1); OUT_RING (chan, 0); if (context_chipset(ctx) >= 0x25) { BEGIN_RING(chan, kelvin, 0x1d84, 1); OUT_RING (chan, 1); } - BEGIN_RING(chan, kelvin, NV20TCL_LIGHTING_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHTING_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_MODEL, 1); - OUT_RING (chan, NV20TCL_LIGHT_MODEL_VIEWER_NONLOCAL); - BEGIN_RING(chan, kelvin, NV20TCL_SEPARATE_SPECULAR_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_MODEL, 1); + OUT_RING (chan, NV20_3D_LIGHT_MODEL_VIEWER_NONLOCAL); + BEGIN_RING(chan, kelvin, NV20_3D_SEPARATE_SPECULAR_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_MODEL_TWO_SIDE_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_MODEL_TWO_SIDE_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_ENABLED_LIGHTS, 1); + BEGIN_RING(chan, kelvin, NV20_3D_ENABLED_LIGHTS, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_NORMALIZE_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_NORMALIZE_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_POLYGON_STIPPLE_PATTERN(0), - NV20TCL_POLYGON_STIPPLE_PATTERN__SIZE); - for (i = 0; i < NV20TCL_POLYGON_STIPPLE_PATTERN__SIZE; i++) { + BEGIN_RING(chan, kelvin, NV20_3D_POLYGON_STIPPLE_PATTERN(0), + NV20_3D_POLYGON_STIPPLE_PATTERN__LEN); + for (i = 0; i < NV20_3D_POLYGON_STIPPLE_PATTERN__LEN; i++) { OUT_RING(chan, 0xffffffff); } - BEGIN_RING(chan, kelvin, NV20TCL_POLYGON_OFFSET_POINT_ENABLE, 3); + BEGIN_RING(chan, kelvin, NV20_3D_POLYGON_OFFSET_POINT_ENABLE, 3); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_DEPTH_FUNC, 1); - OUT_RING (chan, NV20TCL_DEPTH_FUNC_LESS); - BEGIN_RING(chan, kelvin, NV20TCL_DEPTH_WRITE_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_DEPTH_FUNC, 1); + OUT_RING (chan, NV20_3D_DEPTH_FUNC_LESS); + BEGIN_RING(chan, kelvin, NV20_3D_DEPTH_WRITE_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_DEPTH_TEST_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_DEPTH_TEST_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_POLYGON_OFFSET_FACTOR, 2); + BEGIN_RING(chan, kelvin, NV20_3D_POLYGON_OFFSET_FACTOR, 2); OUT_RINGf (chan, 0.0); OUT_RINGf (chan, 0.0); - BEGIN_RING(chan, kelvin, NV20TCL_DEPTH_UNK17D8, 1); + BEGIN_RING(chan, kelvin, NV20_3D_DEPTH_CLAMP, 1); OUT_RING (chan, 1); if (context_chipset(ctx) < 0x25) { BEGIN_RING(chan, kelvin, 0x1d84, 1); OUT_RING (chan, 3); } - BEGIN_RING(chan, kelvin, NV20TCL_POINT_SIZE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_POINT_SIZE, 1); if (context_chipset(ctx) >= 0x25) OUT_RINGf (chan, 1.0); else OUT_RING (chan, 8); if (context_chipset(ctx) >= 0x25) { - BEGIN_RING(chan, kelvin, NV20TCL_POINT_PARAMETERS_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_POINT_PARAMETERS_ENABLE, 1); OUT_RING (chan, 0); BEGIN_RING(chan, kelvin, 0x0a1c, 1); OUT_RING (chan, 0x800); } else { - BEGIN_RING(chan, kelvin, NV20TCL_POINT_PARAMETERS_ENABLE, 2); + BEGIN_RING(chan, kelvin, NV20_3D_POINT_PARAMETERS_ENABLE, 2); OUT_RING (chan, 0); OUT_RING (chan, 0); } - BEGIN_RING(chan, kelvin, NV20TCL_LINE_WIDTH, 1); + BEGIN_RING(chan, kelvin, NV20_3D_LINE_WIDTH, 1); OUT_RING (chan, 8); - BEGIN_RING(chan, kelvin, NV20TCL_LINE_SMOOTH_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_LINE_SMOOTH_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_POLYGON_MODE_FRONT, 2); - OUT_RING (chan, NV20TCL_POLYGON_MODE_FRONT_FILL); - OUT_RING (chan, NV20TCL_POLYGON_MODE_BACK_FILL); - BEGIN_RING(chan, kelvin, NV20TCL_CULL_FACE, 2); - OUT_RING (chan, NV20TCL_CULL_FACE_BACK); - OUT_RING (chan, NV20TCL_FRONT_FACE_CCW); - BEGIN_RING(chan, kelvin, NV20TCL_POLYGON_SMOOTH_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_POLYGON_MODE_FRONT, 2); + OUT_RING (chan, NV20_3D_POLYGON_MODE_FRONT_FILL); + OUT_RING (chan, NV20_3D_POLYGON_MODE_BACK_FILL); + BEGIN_RING(chan, kelvin, NV20_3D_CULL_FACE, 2); + OUT_RING (chan, NV20_3D_CULL_FACE_BACK); + OUT_RING (chan, NV20_3D_FRONT_FACE_CCW); + BEGIN_RING(chan, kelvin, NV20_3D_POLYGON_SMOOTH_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_CULL_FACE_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_CULL_FACE_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_SHADE_MODEL, 1); - OUT_RING (chan, NV20TCL_SHADE_MODEL_SMOOTH); - BEGIN_RING(chan, kelvin, NV20TCL_POLYGON_STIPPLE_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_SHADE_MODEL, 1); + OUT_RING (chan, NV20_3D_SHADE_MODEL_SMOOTH); + BEGIN_RING(chan, kelvin, NV20_3D_POLYGON_STIPPLE_ENABLE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_TX_GEN_MODE_S(0), - 4 * NV20TCL_TX_GEN_MODE_S__SIZE); - for (i=0; i < 4 * NV20TCL_TX_GEN_MODE_S__SIZE; i++) + BEGIN_RING(chan, kelvin, NV20_3D_TEX_GEN_MODE(0,0), + 4 * NV20_3D_TEX_GEN_MODE__ESIZE); + for (i=0; i < 4 * NV20_3D_TEX_GEN_MODE__LEN; i++) OUT_RING(chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_FOG_EQUATION_CONSTANT, 3); + BEGIN_RING(chan, kelvin, NV20_3D_FOG_COEFF(0), 3); OUT_RINGf (chan, 1.5); OUT_RINGf (chan, -0.090168); OUT_RINGf (chan, 0.0); - BEGIN_RING(chan, kelvin, NV20TCL_FOG_MODE, 2); - OUT_RING (chan, NV20TCL_FOG_MODE_EXP_SIGNED); - OUT_RING (chan, NV20TCL_FOG_COORD_FOG); - BEGIN_RING(chan, kelvin, NV20TCL_FOG_ENABLE, 2); + BEGIN_RING(chan, kelvin, NV20_3D_FOG_MODE, 2); + OUT_RING (chan, NV20_3D_FOG_MODE_EXP_SIGNED); + OUT_RING (chan, NV20_3D_FOG_COORD_FOG); + BEGIN_RING(chan, kelvin, NV20_3D_FOG_ENABLE, 2); OUT_RING (chan, 0); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_ENGINE, 1); - OUT_RING (chan, NV20TCL_ENGINE_FIXED); + BEGIN_RING(chan, kelvin, NV20_3D_ENGINE, 1); + OUT_RING (chan, NV20_3D_ENGINE_FIXED); - for (i = 0; i < NV20TCL_TX_MATRIX_ENABLE__SIZE; i++) { - BEGIN_RING(chan, kelvin, NV20TCL_TX_MATRIX_ENABLE(i), 1); + for (i = 0; i < NV20_3D_TEX_MATRIX_ENABLE__LEN; i++) { + BEGIN_RING(chan, kelvin, NV20_3D_TEX_MATRIX_ENABLE(i), 1); OUT_RING (chan, 0); } - BEGIN_RING(chan, kelvin, NV20TCL_VTX_ATTR_4F_X(1), 4 * 15); + BEGIN_RING(chan, kelvin, NV20_3D_VERTEX_ATTR_4F_X(1), 4 * 15); OUT_RINGf(chan, 1.0); OUT_RINGf(chan, 0.0); OUT_RINGf(chan, 0.0); @@ -393,24 +394,24 @@ nv20_hwctx_init(struct gl_context *ctx) OUT_RINGf(chan, 1.0); } - BEGIN_RING(chan, kelvin, NV20TCL_EDGEFLAG_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_EDGEFLAG_ENABLE, 1); OUT_RING (chan, 1); - BEGIN_RING(chan, kelvin, NV20TCL_COLOR_MASK, 1); + BEGIN_RING(chan, kelvin, NV20_3D_COLOR_MASK, 1); OUT_RING (chan, 0x00010101); - BEGIN_RING(chan, kelvin, NV20TCL_CLEAR_VALUE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_CLEAR_VALUE, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, kelvin, NV20TCL_DEPTH_RANGE_NEAR, 2); + BEGIN_RING(chan, kelvin, NV20_3D_DEPTH_RANGE_NEAR, 2); OUT_RINGf (chan, 0.0); OUT_RINGf (chan, 16777216.0); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_TRANSLATE_X, 4); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_TRANSLATE_X, 4); OUT_RINGf (chan, 0.0); OUT_RINGf (chan, 0.0); OUT_RINGf (chan, 0.0); OUT_RINGf (chan, 16777215.0); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_SCALE_X, 4); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_SCALE_X, 4); OUT_RINGf (chan, 0.0); OUT_RINGf (chan, 0.0); OUT_RINGf (chan, 16777215.0 * 0.5); @@ -469,9 +470,9 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua /* 3D engine. */ if (context_chipset(ctx) >= 0x25) - kelvin_class = NV25TCL; + kelvin_class = NV25_3D; else - kelvin_class = NV20TCL; + kelvin_class = NV20_3D; ret = nouveau_grobj_alloc(context_chan(ctx), 0xbeef0001, kelvin_class, &nctx->hw.eng3d); diff --git a/src/mesa/drivers/dri/nouveau/nv20_render.c b/src/mesa/drivers/dri/nouveau/nv20_render.c index dbdb85da203..2bdc85cda4e 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_render.c +++ b/src/mesa/drivers/dri/nouveau/nv20_render.c @@ -26,7 +26,7 @@ #include "nouveau_driver.h" #include "nouveau_context.h" -#include "nouveau_class.h" +#include "nv20_3d.xml.h" #include "nv20_driver.h" #define NUM_VERTEX_ATTRS 16 @@ -39,47 +39,47 @@ nv20_emit_material(struct gl_context *ctx, struct nouveau_array *a, static struct nouveau_attr_info nv20_vertex_attrs[VERT_ATTRIB_MAX] = { [VERT_ATTRIB_POS] = { .vbo_index = 0, - .imm_method = NV20TCL_VERTEX_POS_4F_X, + .imm_method = NV20_3D_VERTEX_POS_4F_X, .imm_fields = 4, }, [VERT_ATTRIB_NORMAL] = { .vbo_index = 2, - .imm_method = NV20TCL_VERTEX_NOR_3F_X, + .imm_method = NV20_3D_VERTEX_NOR_3F_X, .imm_fields = 3, }, [VERT_ATTRIB_COLOR0] = { .vbo_index = 3, - .imm_method = NV20TCL_VERTEX_COL_4F_X, + .imm_method = NV20_3D_VERTEX_COL_4F, .imm_fields = 4, }, [VERT_ATTRIB_COLOR1] = { .vbo_index = 4, - .imm_method = NV20TCL_VERTEX_COL2_3F_X, + .imm_method = NV20_3D_VERTEX_COL2_3F, .imm_fields = 3, }, [VERT_ATTRIB_FOG] = { .vbo_index = 5, - .imm_method = NV20TCL_VERTEX_FOG_1F, + .imm_method = NV20_3D_VERTEX_FOG_1F, .imm_fields = 1, }, [VERT_ATTRIB_TEX0] = { .vbo_index = 9, - .imm_method = NV20TCL_VERTEX_TX0_4F_S, + .imm_method = NV20_3D_VERTEX_TX0_4F_S, .imm_fields = 4, }, [VERT_ATTRIB_TEX1] = { .vbo_index = 10, - .imm_method = NV20TCL_VERTEX_TX1_4F_S, + .imm_method = NV20_3D_VERTEX_TX1_4F_S, .imm_fields = 4, }, [VERT_ATTRIB_TEX2] = { .vbo_index = 11, - .imm_method = NV20TCL_VERTEX_TX2_4F_S, + .imm_method = NV20_3D_VERTEX_TX2_4F_S, .imm_fields = 4, }, [VERT_ATTRIB_TEX3] = { .vbo_index = 12, - .imm_method = NV20TCL_VERTEX_TX3_4F_S, + .imm_method = NV20_3D_VERTEX_TX3_4F_S, .imm_fields = 4, }, [VERT_ATTRIB_GENERIC0] = { @@ -119,11 +119,11 @@ get_hw_format(int type) { switch (type) { case GL_FLOAT: - return NV20TCL_VTXFMT_TYPE_FLOAT; + return NV20_3D_VTXBUF_FMT_TYPE_FLOAT; case GL_UNSIGNED_SHORT: - return NV20TCL_VTXFMT_TYPE_USHORT; + return NV20_3D_VTXBUF_FMT_TYPE_USHORT; case GL_UNSIGNED_BYTE: - return NV20TCL_VTXFMT_TYPE_UBYTE; + return NV20_3D_VTXBUF_FMT_TYPE_UBYTE; default: assert(0); } @@ -147,10 +147,10 @@ nv20_render_set_format(struct gl_context *ctx) } else { /* Unused attribute. */ - hw_format = NV10TCL_VTXFMT_TYPE_FLOAT; + hw_format = NV20_3D_VTXBUF_FMT_TYPE_FLOAT; } - BEGIN_RING(chan, kelvin, NV20TCL_VTXFMT(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_VTXBUF_FMT(i), 1); OUT_RING(chan, hw_format); } } @@ -167,9 +167,9 @@ nv20_render_bind_vertices(struct gl_context *ctx) struct nouveau_array *a = &render->attrs[attr]; nouveau_bo_mark(bctx, kelvin, - NV20TCL_VTXBUF_ADDRESS(i), + NV20_3D_VTXBUF_OFFSET(i), a->bo, a->offset, 0, - 0, NV20TCL_VTXBUF_ADDRESS_DMA1, + 0, NV20_3D_VTXBUF_OFFSET_DMA1, NOUVEAU_BO_LOW | NOUVEAU_BO_OR | NOUVEAU_BO_GART | NOUVEAU_BO_RD); } @@ -180,33 +180,33 @@ nv20_render_bind_vertices(struct gl_context *ctx) struct nouveau_grobj *kelvin = context_eng3d(ctx) #define BATCH_VALIDATE() \ - BEGIN_RING(chan, kelvin, NV20TCL_VTX_CACHE_INVALIDATE, 1); \ + BEGIN_RING(chan, kelvin, NV20_3D_VTXBUF_VALIDATE, 1); \ OUT_RING(chan, 0) #define BATCH_BEGIN(prim) \ - BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1); \ + BEGIN_RING(chan, kelvin, NV20_3D_VERTEX_BEGIN_END, 1); \ OUT_RING(chan, prim) #define BATCH_END() \ - BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1); \ + BEGIN_RING(chan, kelvin, NV20_3D_VERTEX_BEGIN_END, 1); \ OUT_RING(chan, 0) #define MAX_PACKET 0x400 #define MAX_OUT_L 0x100 #define BATCH_PACKET_L(n) \ - BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_VERTEX_BATCH, n) + BEGIN_RING_NI(chan, kelvin, NV20_3D_VTXBUF_BATCH, n) #define BATCH_OUT_L(i, n) \ OUT_RING(chan, ((n) - 1) << 24 | (i)) #define MAX_OUT_I16 0x2 #define BATCH_PACKET_I16(n) \ - BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U16, n) + BEGIN_RING_NI(chan, kelvin, NV20_3D_VTXBUF_ELEMENT_U16, n) #define BATCH_OUT_I16(i0, i1) \ OUT_RING(chan, (i1) << 16 | (i0)) #define MAX_OUT_I32 0x1 #define BATCH_PACKET_I32(n) \ - BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U32, n) + BEGIN_RING_NI(chan, kelvin, NV20_3D_VTXBUF_ELEMENT_U32, n) #define BATCH_OUT_I32(i) \ OUT_RING(chan, i) diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c index 854392f9ff3..8cabb5546fb 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c @@ -29,7 +29,7 @@ #include "nouveau_fbo.h" #include "nouveau_gldefs.h" #include "nouveau_util.h" -#include "nouveau_class.h" +#include "nv20_3d.xml.h" #include "nv20_driver.h" static inline unsigned @@ -69,10 +69,10 @@ setup_hierz_buffer(struct gl_context *ctx) &nfb->hierz.bo); } - BEGIN_RING(chan, kelvin, NV25TCL_HIERZ_PITCH, 1); + BEGIN_RING(chan, kelvin, NV25_3D_HIERZ_PITCH, 1); OUT_RING(chan, pitch); - nouveau_bo_markl(bctx, kelvin, NV25TCL_HIERZ_OFFSET, nfb->hierz.bo, + nouveau_bo_markl(bctx, kelvin, NV25_3D_HIERZ_OFFSET, nfb->hierz.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); } @@ -84,7 +84,7 @@ nv20_emit_framebuffer(struct gl_context *ctx, int emit) struct nouveau_bo_context *bctx = context_bctx(ctx, FRAMEBUFFER); struct gl_framebuffer *fb = ctx->DrawBuffer; struct nouveau_surface *s; - unsigned rt_format = NV20TCL_RT_FORMAT_TYPE_LINEAR; + unsigned rt_format = NV20_3D_RT_FORMAT_TYPE_LINEAR; unsigned rt_pitch = 0, zeta_pitch = 0; unsigned bo_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR; @@ -99,7 +99,7 @@ nv20_emit_framebuffer(struct gl_context *ctx, int emit) rt_format |= get_rt_format(s->format); rt_pitch = s->pitch; - nouveau_bo_markl(bctx, kelvin, NV20TCL_COLOR_OFFSET, + nouveau_bo_markl(bctx, kelvin, NV20_3D_COLOR_OFFSET, s->bo, 0, bo_flags); } @@ -111,7 +111,7 @@ nv20_emit_framebuffer(struct gl_context *ctx, int emit) rt_format |= get_rt_format(s->format); zeta_pitch = s->pitch; - nouveau_bo_markl(bctx, kelvin, NV20TCL_ZETA_OFFSET, + nouveau_bo_markl(bctx, kelvin, NV20_3D_ZETA_OFFSET, s->bo, 0, bo_flags); if (context_chipset(ctx) >= 0x25) @@ -121,7 +121,7 @@ nv20_emit_framebuffer(struct gl_context *ctx, int emit) zeta_pitch = rt_pitch; } - BEGIN_RING(chan, kelvin, NV20TCL_RT_FORMAT, 2); + BEGIN_RING(chan, kelvin, NV20_3D_RT_FORMAT, 2); OUT_RING(chan, rt_format); OUT_RING(chan, zeta_pitch << 16 | rt_pitch); @@ -140,12 +140,12 @@ nv20_emit_viewport(struct gl_context *ctx, int emit) get_viewport_translate(ctx, a); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_TRANSLATE_X, 4); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_TRANSLATE_X, 4); OUT_RINGp(chan, a, 4); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_HORIZ(0), 1); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_CLIP_HORIZ(0), 1); OUT_RING(chan, (fb->Width - 1) << 16); - BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_VERT(0), 1); + BEGIN_RING(chan, kelvin, NV20_3D_VIEWPORT_CLIP_VERT(0), 1); OUT_RING(chan, (fb->Height - 1) << 16); context_dirty(ctx, PROJECTION); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_frag.c b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c index f9212d8b396..0624de442b9 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c @@ -26,7 +26,7 @@ #include "nouveau_driver.h" #include "nouveau_context.h" -#include "nouveau_class.h" +#include "nv20_3d.xml.h" #include "nv10_driver.h" #include "nv20_driver.h" @@ -40,15 +40,15 @@ nv20_emit_tex_env(struct gl_context *ctx, int emit) nv10_get_general_combiner(ctx, i, &a_in, &a_out, &c_in, &c_out, &k); - BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_ALPHA(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_RC_IN_ALPHA(i), 1); OUT_RING(chan, a_in); - BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_ALPHA(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_RC_OUT_ALPHA(i), 1); OUT_RING(chan, a_out); - BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_RGB(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_RC_IN_RGB(i), 1); OUT_RING(chan, c_in); - BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_RGB(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_RC_OUT_RGB(i), 1); OUT_RING(chan, c_out); - BEGIN_RING(chan, kelvin, NV20TCL_RC_CONSTANT_COLOR0(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_RC_CONSTANT_COLOR0(i), 1); OUT_RING(chan, k); context_dirty(ctx, FRAG); @@ -64,10 +64,10 @@ nv20_emit_frag(struct gl_context *ctx, int emit) nv10_get_final_combiner(ctx, &in, &n); - BEGIN_RING(chan, kelvin, NV20TCL_RC_FINAL0, 2); + BEGIN_RING(chan, kelvin, NV20_3D_RC_FINAL0, 2); OUT_RING(chan, in); OUT_RING(chan, in >> 32); - BEGIN_RING(chan, kelvin, NV20TCL_RC_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_RC_ENABLE, 1); OUT_RING(chan, n); } diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c b/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c index a6e237f8c42..85f30dc4d41 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c @@ -27,7 +27,7 @@ #include "nouveau_driver.h" #include "nouveau_context.h" #include "nouveau_gldefs.h" -#include "nouveau_class.h" +#include "nv20_3d.xml.h" #include "nv20_driver.h" void @@ -36,7 +36,7 @@ nv20_emit_point_mode(struct gl_context *ctx, int emit) struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); - BEGIN_RING(chan, kelvin, NV20TCL_POINT_SIZE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_POINT_SIZE, 1); if (context_chipset(ctx) >= 0x25) OUT_RINGf(chan, ctx->Point.Size); else diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_raster.c b/src/mesa/drivers/dri/nouveau/nv20_state_raster.c index 0fc7a3259d7..4716952e17a 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_raster.c @@ -27,7 +27,7 @@ #include "nouveau_driver.h" #include "nouveau_context.h" #include "nouveau_gldefs.h" -#include "nouveau_class.h" +#include "nv20_3d.xml.h" #include "nv20_driver.h" void @@ -36,7 +36,7 @@ nv20_emit_logic_opcode(struct gl_context *ctx, int emit) struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); - BEGIN_RING(chan, kelvin, NV20TCL_COLOR_LOGIC_OP_ENABLE, 2); + BEGIN_RING(chan, kelvin, NV20_3D_COLOR_LOGIC_OP_ENABLE, 2); OUT_RING(chan, ctx->Color.ColorLogicOpEnabled ? 1 : 0); OUT_RING(chan, nvgl_logicop_func(ctx->Color.LogicOp)); } diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c index cfff1fe8397..c362aca0fdb 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c @@ -28,14 +28,10 @@ #include "nouveau_context.h" #include "nouveau_gldefs.h" #include "nouveau_texture.h" -#include "nouveau_class.h" +#include "nv20_3d.xml.h" #include "nouveau_util.h" #include "nv20_driver.h" -#define TX_GEN_MODE(i, j) (NV20TCL_TX_GEN_MODE_S(i) + 4 * (j)) -#define TX_GEN_COEFF(i, j) (NV20TCL_TX_GEN_COEFF_S_A(i) + 16 * (j)) -#define TX_MATRIX(i) (NV20TCL_TX0_MATRIX(0) + 64 * (i)) - void nv20_emit_tex_gen(struct gl_context *ctx, int emit) { @@ -52,15 +48,16 @@ nv20_emit_tex_gen(struct gl_context *ctx, int emit) float *k = get_texgen_coeff(coord); if (k) { - BEGIN_RING(chan, kelvin, TX_GEN_COEFF(i, j), 4); + BEGIN_RING(chan, kelvin, + NV20_3D_TEX_GEN_COEFF(i, j), 4); OUT_RINGp(chan, k, 4); } - BEGIN_RING(chan, kelvin, TX_GEN_MODE(i, j), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_GEN_MODE(i, j), 1); OUT_RING(chan, nvgl_texgen_mode(coord->Mode)); } else { - BEGIN_RING(chan, kelvin, TX_GEN_MODE(i, j), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_GEN_MODE(i, j), 1); OUT_RING(chan, 0); } } @@ -76,14 +73,14 @@ nv20_emit_tex_mat(struct gl_context *ctx, int emit) if (nctx->fallback == HWTNL && (ctx->Texture._TexMatEnabled & 1 << i)) { - BEGIN_RING(chan, kelvin, NV20TCL_TX_MATRIX_ENABLE(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_MATRIX_ENABLE(i), 1); OUT_RING(chan, 1); - BEGIN_RING(chan, kelvin, TX_MATRIX(i), 16); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_MATRIX(i,0), 16); OUT_RINGm(chan, ctx->TextureMatrixStack[i].Top->m); } else { - BEGIN_RING(chan, kelvin, NV20TCL_TX_MATRIX_ENABLE(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_MATRIX_ENABLE(i), 1); OUT_RING(chan, 0); } } @@ -93,29 +90,29 @@ get_tex_format_pot(struct gl_texture_image *ti) { switch (ti->TexFormat) { case MESA_FORMAT_ARGB8888: - return NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8; + return NV20_3D_TEX_FORMAT_FORMAT_A8R8G8B8; case MESA_FORMAT_ARGB1555: - return NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5; + return NV20_3D_TEX_FORMAT_FORMAT_A1R5G5B5; case MESA_FORMAT_ARGB4444: - return NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4; + return NV20_3D_TEX_FORMAT_FORMAT_A4R4G4B4; case MESA_FORMAT_XRGB8888: - return NV20TCL_TX_FORMAT_FORMAT_X8R8G8B8; + return NV20_3D_TEX_FORMAT_FORMAT_X8R8G8B8; case MESA_FORMAT_RGB565: - return NV20TCL_TX_FORMAT_FORMAT_R5G6B5; + return NV20_3D_TEX_FORMAT_FORMAT_R5G6B5; case MESA_FORMAT_A8: case MESA_FORMAT_I8: - return NV20TCL_TX_FORMAT_FORMAT_A8; + return NV20_3D_TEX_FORMAT_FORMAT_I8; case MESA_FORMAT_L8: - return NV20TCL_TX_FORMAT_FORMAT_L8; + return NV20_3D_TEX_FORMAT_FORMAT_L8; case MESA_FORMAT_CI8: - return NV20TCL_TX_FORMAT_FORMAT_INDEX8; + return NV20_3D_TEX_FORMAT_FORMAT_INDEX8; default: assert(0); @@ -127,26 +124,26 @@ get_tex_format_rect(struct gl_texture_image *ti) { switch (ti->TexFormat) { case MESA_FORMAT_ARGB8888: - return NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT; + return NV20_3D_TEX_FORMAT_FORMAT_A8R8G8B8_RECT; case MESA_FORMAT_ARGB1555: - return NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT; + return NV20_3D_TEX_FORMAT_FORMAT_A1R5G5B5_RECT; case MESA_FORMAT_ARGB4444: - return NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4_RECT; + return NV20_3D_TEX_FORMAT_FORMAT_A4R4G4B4_RECT; case MESA_FORMAT_XRGB8888: - return NV20TCL_TX_FORMAT_FORMAT_R8G8B8_RECT; + return NV20_3D_TEX_FORMAT_FORMAT_R8G8B8_RECT; case MESA_FORMAT_RGB565: - return NV20TCL_TX_FORMAT_FORMAT_R5G6B5_RECT; + return NV20_3D_TEX_FORMAT_FORMAT_R5G6B5_RECT; case MESA_FORMAT_L8: - return NV20TCL_TX_FORMAT_FORMAT_L8_RECT; + return NV20_3D_TEX_FORMAT_FORMAT_L8_RECT; case MESA_FORMAT_A8: case MESA_FORMAT_I8: - return NV20TCL_TX_FORMAT_FORMAT_A8_RECT; + return NV20_3D_TEX_FORMAT_FORMAT_I8_RECT; default: assert(0); @@ -167,7 +164,7 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) uint32_t tx_format, tx_filter, tx_wrap, tx_enable; if (!ctx->Texture.Unit[i]._ReallyEnabled) { - BEGIN_RING(chan, kelvin, NV20TCL_TX_ENABLE(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_ENABLE(i), 1); OUT_RING(chan, 0); context_dirty(ctx, TEX_SHADER); @@ -185,8 +182,8 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) tx_format = ti->DepthLog2 << 28 | ti->HeightLog2 << 24 | ti->WidthLog2 << 20 - | NV20TCL_TX_FORMAT_DIMS_2D - | NV20TCL_TX_FORMAT_NO_BORDER + | NV20_3D_TEX_FORMAT_DIMS_2D + | NV20_3D_TEX_FORMAT_NO_BORDER | 1 << 16; tx_wrap = nvgl_wrap_mode(t->WrapR) << 16 @@ -197,13 +194,13 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) | nvgl_filter_mode(t->MinFilter) << 16 | 2 << 12; - tx_enable = NV20TCL_TX_ENABLE_ENABLE + tx_enable = NV20_3D_TEX_ENABLE_ENABLE | log2i(t->MaxAnisotropy) << 4; if (t->Target == GL_TEXTURE_RECTANGLE) { - BEGIN_RING(chan, kelvin, NV20TCL_TX_NPOT_PITCH(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_NPOT_PITCH(i), 1); OUT_RING(chan, s->pitch << 16); - BEGIN_RING(chan, kelvin, NV20TCL_TX_NPOT_SIZE(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_NPOT_SIZE(i), 1); OUT_RING(chan, s->width << 16 | s->height); tx_format |= get_tex_format_rect(ti); @@ -222,29 +219,29 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit) lod_min = CLAMP(lod_min, 0, 15); lod_bias = CLAMP(lod_bias, 0, 15); - tx_format |= NV20TCL_TX_FORMAT_MIPMAP; + tx_format |= NV20_3D_TEX_FORMAT_MIPMAP; tx_filter |= lod_bias << 8; tx_enable |= lod_min << 26 | lod_max << 14; } /* Write it to the hardware. */ - nouveau_bo_mark(bctx, kelvin, NV20TCL_TX_FORMAT(i), + nouveau_bo_mark(bctx, kelvin, NV20_3D_TEX_FORMAT(i), s->bo, tx_format, 0, - NV20TCL_TX_FORMAT_DMA0, - NV20TCL_TX_FORMAT_DMA1, + NV20_3D_TEX_FORMAT_DMA0, + NV20_3D_TEX_FORMAT_DMA1, bo_flags | NOUVEAU_BO_OR); - nouveau_bo_markl(bctx, kelvin, NV20TCL_TX_OFFSET(i), + nouveau_bo_markl(bctx, kelvin, NV20_3D_TEX_OFFSET(i), s->bo, s->offset, bo_flags); - BEGIN_RING(chan, kelvin, NV20TCL_TX_WRAP(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_WRAP(i), 1); OUT_RING(chan, tx_wrap); - BEGIN_RING(chan, kelvin, NV20TCL_TX_FILTER(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_FILTER(i), 1); OUT_RING(chan, tx_filter); - BEGIN_RING(chan, kelvin, NV20TCL_TX_ENABLE(i), 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_ENABLE(i), 1); OUT_RING(chan, tx_enable); context_dirty(ctx, TEX_SHADER); @@ -262,9 +259,9 @@ nv20_emit_tex_shader(struct gl_context *ctx, int emit) if (!ctx->Texture.Unit[i]._ReallyEnabled) continue; - tx_shader_op |= NV20TCL_TX_SHADER_OP_TX0_TEXTURE_2D << 5 * i; + tx_shader_op |= NV20_3D_TEX_SHADER_OP_TX0_TEXTURE_2D << 5 * i; } - BEGIN_RING(chan, kelvin, NV20TCL_TX_SHADER_OP, 1); + BEGIN_RING(chan, kelvin, NV20_3D_TEX_SHADER_OP, 1); OUT_RING(chan, tx_shader_op); } diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c index b65cd9ad871..28745849d43 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c @@ -28,31 +28,31 @@ #include "nouveau_context.h" #include "nouveau_gldefs.h" #include "nouveau_util.h" -#include "nouveau_class.h" +#include "nv20_3d.xml.h" #include "nv10_driver.h" #include "nv20_driver.h" #define LIGHT_MODEL_AMBIENT_R(side) \ - ((side) ? NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R : \ - NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R) + ((side) ? NV20_3D_LIGHT_MODEL_BACK_AMBIENT_R : \ + NV20_3D_LIGHT_MODEL_FRONT_AMBIENT_R) #define LIGHT_AMBIENT_R(side, i) \ - ((side) ? NV20TCL_LIGHT_BACK_AMBIENT_R(i) : \ - NV20TCL_LIGHT_FRONT_AMBIENT_R(i)) + ((side) ? NV20_3D_LIGHT_BACK_AMBIENT_R(i) : \ + NV20_3D_LIGHT_FRONT_AMBIENT_R(i)) #define LIGHT_DIFFUSE_R(side, i) \ - ((side) ? NV20TCL_LIGHT_BACK_DIFFUSE_R(i) : \ - NV20TCL_LIGHT_FRONT_DIFFUSE_R(i)) + ((side) ? NV20_3D_LIGHT_BACK_DIFFUSE_R(i) : \ + NV20_3D_LIGHT_FRONT_DIFFUSE_R(i)) #define LIGHT_SPECULAR_R(side, i) \ - ((side) ? NV20TCL_LIGHT_BACK_SPECULAR_R(i) : \ - NV20TCL_LIGHT_FRONT_SPECULAR_R(i)) + ((side) ? NV20_3D_LIGHT_BACK_SPECULAR_R(i) : \ + NV20_3D_LIGHT_FRONT_SPECULAR_R(i)) #define MATERIAL_FACTOR_R(side) \ - ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_R : \ - NV20TCL_MATERIAL_FACTOR_FRONT_R) + ((side) ? NV20_3D_MATERIAL_FACTOR_BACK_R : \ + NV20_3D_MATERIAL_FACTOR_FRONT_R) #define MATERIAL_FACTOR_A(side) \ - ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_A : \ - NV20TCL_MATERIAL_FACTOR_FRONT_A) + ((side) ? NV20_3D_MATERIAL_FACTOR_BACK_A : \ + NV20_3D_MATERIAL_FACTOR_FRONT_A) #define MATERIAL_SHININESS(side) \ - ((side) ? NV20TCL_BACK_MATERIAL_SHININESS(0) : \ - NV20TCL_FRONT_MATERIAL_SHININESS(0)) + ((side) ? NV20_3D_BACK_MATERIAL_SHININESS(0) : \ + NV20_3D_FRONT_MATERIAL_SHININESS(0)) void nv20_emit_clip_plane(struct gl_context *ctx, int emit) @@ -65,22 +65,22 @@ get_material_bitmask(unsigned m) unsigned ret = 0; if (m & MAT_BIT_FRONT_EMISSION) - ret |= NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_COL1; + ret |= NV20_3D_COLOR_MATERIAL_FRONT_EMISSION_COL1; if (m & MAT_BIT_FRONT_AMBIENT) - ret |= NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_COL1; + ret |= NV20_3D_COLOR_MATERIAL_FRONT_AMBIENT_COL1; if (m & MAT_BIT_FRONT_DIFFUSE) - ret |= NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_COL1; + ret |= NV20_3D_COLOR_MATERIAL_FRONT_DIFFUSE_COL1; if (m & MAT_BIT_FRONT_SPECULAR) - ret |= NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_COL1; + ret |= NV20_3D_COLOR_MATERIAL_FRONT_SPECULAR_COL1; if (m & MAT_BIT_BACK_EMISSION) - ret |= NV20TCL_COLOR_MATERIAL_BACK_EMISSION_COL1; + ret |= NV20_3D_COLOR_MATERIAL_BACK_EMISSION_COL1; if (m & MAT_BIT_BACK_AMBIENT) - ret |= NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_COL1; + ret |= NV20_3D_COLOR_MATERIAL_BACK_AMBIENT_COL1; if (m & MAT_BIT_BACK_DIFFUSE) - ret |= NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_COL1; + ret |= NV20_3D_COLOR_MATERIAL_BACK_DIFFUSE_COL1; if (m & MAT_BIT_BACK_SPECULAR) - ret |= NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_COL1; + ret |= NV20_3D_COLOR_MATERIAL_BACK_SPECULAR_COL1; return ret; } @@ -92,7 +92,7 @@ nv20_emit_color_material(struct gl_context *ctx, int emit) struct nouveau_grobj *kelvin = context_eng3d(ctx); unsigned mask = get_material_bitmask(ctx->Light.ColorMaterialBitmask); - BEGIN_RING(chan, kelvin, NV20TCL_COLOR_MATERIAL, 1); + BEGIN_RING(chan, kelvin, NV20_3D_COLOR_MATERIAL, 1); OUT_RING(chan, ctx->Light.ColorMaterialEnabled ? mask : 0); } @@ -101,11 +101,11 @@ get_fog_mode_signed(unsigned mode) { switch (mode) { case GL_LINEAR: - return NV20TCL_FOG_MODE_LINEAR_SIGNED; + return NV20_3D_FOG_MODE_LINEAR_SIGNED; case GL_EXP: - return NV20TCL_FOG_MODE_EXP_SIGNED; + return NV20_3D_FOG_MODE_EXP_SIGNED; case GL_EXP2: - return NV20TCL_FOG_MODE_EXP2_SIGNED; + return NV20_3D_FOG_MODE_EXP2_SIGNED; default: assert(0); } @@ -116,11 +116,11 @@ get_fog_mode_unsigned(unsigned mode) { switch (mode) { case GL_LINEAR: - return NV20TCL_FOG_MODE_LINEAR_UNSIGNED; + return NV20_3D_FOG_MODE_LINEAR_UNSIGNED; case GL_EXP: - return NV20TCL_FOG_MODE_EXP_UNSIGNED; + return NV20_3D_FOG_MODE_EXP_UNSIGNED; case GL_EXP2: - return NV20TCL_FOG_MODE_EXP2_UNSIGNED; + return NV20_3D_FOG_MODE_EXP2_UNSIGNED; default: assert(0); } @@ -131,9 +131,9 @@ get_fog_source(unsigned source) { switch (source) { case GL_FOG_COORDINATE_EXT: - return NV20TCL_FOG_COORD_FOG; + return NV20_3D_FOG_COORD_FOG; case GL_FRAGMENT_DEPTH_EXT: - return NV20TCL_FOG_COORD_DIST_ORTHOGONAL_ABS; + return NV20_3D_FOG_COORD_DIST_ORTHOGONAL_ABS; default: assert(0); } @@ -152,7 +152,7 @@ nv20_emit_fog(struct gl_context *ctx, int emit) nv10_get_fog_coeff(ctx, k); - BEGIN_RING(chan, kelvin, NV20TCL_FOG_MODE, 4); + BEGIN_RING(chan, kelvin, NV20_3D_FOG_MODE, 4); OUT_RING(chan, (source == GL_FOG_COORDINATE_EXT ? get_fog_mode_signed(f->Mode) : get_fog_mode_unsigned(f->Mode))); @@ -160,7 +160,7 @@ nv20_emit_fog(struct gl_context *ctx, int emit) OUT_RING(chan, f->Enabled ? 1 : 0); OUT_RING(chan, pack_rgba_f(MESA_FORMAT_RGBA8888_REV, f->Color)); - BEGIN_RING(chan, kelvin, NV20TCL_FOG_EQUATION_CONSTANT, 3); + BEGIN_RING(chan, kelvin, NV20_3D_FOG_COEFF(0), 3); OUT_RINGp(chan, k, 3); } @@ -171,18 +171,18 @@ nv20_emit_light_model(struct gl_context *ctx, int emit) struct nouveau_grobj *kelvin = context_eng3d(ctx); struct gl_lightmodel *m = &ctx->Light.Model; - BEGIN_RING(chan, kelvin, NV20TCL_SEPARATE_SPECULAR_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_SEPARATE_SPECULAR_ENABLE, 1); OUT_RING(chan, m->ColorControl == GL_SEPARATE_SPECULAR_COLOR ? 1 : 0); - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_MODEL, 1); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_MODEL, 1); OUT_RING(chan, ((m->LocalViewer ? - NV20TCL_LIGHT_MODEL_VIEWER_LOCAL : - NV20TCL_LIGHT_MODEL_VIEWER_NONLOCAL) | + NV20_3D_LIGHT_MODEL_VIEWER_LOCAL : + NV20_3D_LIGHT_MODEL_VIEWER_NONLOCAL) | (NEED_SECONDARY_COLOR(ctx) ? - NV20TCL_LIGHT_MODEL_SEPARATE_SPECULAR : + NV20_3D_LIGHT_MODEL_SEPARATE_SPECULAR : 0))); - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_MODEL_TWO_SIDE_ENABLE, 1); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_MODEL_TWO_SIDE_ENABLE, 1); OUT_RING(chan, ctx->Light.Model.TwoSide ? 1 : 0); } @@ -195,19 +195,19 @@ nv20_emit_light_source(struct gl_context *ctx, int emit) struct gl_light *l = &ctx->Light.Light[i]; if (l->_Flags & LIGHT_POSITIONAL) { - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_POSITION_X(i), 3); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_POSITION_X(i), 3); OUT_RINGp(chan, l->_Position, 3); - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_ATTENUATION_CONSTANT(i), 3); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_ATTENUATION_CONSTANT(i), 3); OUT_RINGf(chan, l->ConstantAttenuation); OUT_RINGf(chan, l->LinearAttenuation); OUT_RINGf(chan, l->QuadraticAttenuation); } else { - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_DIRECTION_X(i), 3); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_DIRECTION_X(i), 3); OUT_RINGp(chan, l->_VP_inf_norm, 3); - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_HALF_VECTOR_X(i), 3); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_HALF_VECTOR_X(i), 3); OUT_RINGp(chan, l->_h_inf_norm, 3); } @@ -216,7 +216,7 @@ nv20_emit_light_source(struct gl_context *ctx, int emit) nv10_get_spot_coeff(l, k); - BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_SPOT_CUTOFF_A(i), 7); + BEGIN_RING(chan, kelvin, NV20_3D_LIGHT_SPOT_CUTOFF(i, 0), 7); OUT_RINGp(chan, k, 7); } } @@ -340,7 +340,7 @@ nv20_emit_modelview(struct gl_context *ctx, int emit) if (ctx->Light._NeedEyeCoords || ctx->Fog.Enabled || (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)) { - BEGIN_RING(chan, kelvin, NV20TCL_MODELVIEW0_MATRIX(0), 16); + BEGIN_RING(chan, kelvin, NV20_3D_MODELVIEW_MATRIX(0, 0), 16); OUT_RINGm(chan, m->m); } @@ -349,7 +349,7 @@ nv20_emit_modelview(struct gl_context *ctx, int emit) int i, j; BEGIN_RING(chan, kelvin, - NV20TCL_INVERSE_MODELVIEW0_MATRIX(0), 12); + NV20_3D_INVERSE_MODELVIEW_MATRIX(0, 0), 12); for (i = 0; i < 3; i++) for (j = 0; j < 4; j++) OUT_RINGf(chan, m->inv[4*i + j]); @@ -370,7 +370,7 @@ nv20_emit_projection(struct gl_context *ctx, int emit) if (nctx->fallback == HWTNL) _math_matrix_mul_matrix(&m, &m, &ctx->_ModelProjectMatrix); - BEGIN_RING(chan, kelvin, NV20TCL_PROJECTION_MATRIX(0), 16); + BEGIN_RING(chan, kelvin, NV20_3D_PROJECTION_MATRIX(0), 16); OUT_RINGm(chan, m.m); _math_matrix_dtr(&m); -- 2.30.2