diff options
author | Luca Barbieri <[email protected]> | 2010-02-20 18:37:43 +0100 |
---|---|---|
committer | Younes Manton <[email protected]> | 2010-03-15 00:03:01 -0400 |
commit | b8e56d4cddbd9c491b940e3ce5974c526802c752 (patch) | |
tree | 6ae0a1030c6a43c6596393b787cea3d7b7e23352 /src/gallium/drivers/nv40 | |
parent | d673c92810636dcc6de33d3618d494ce9f5717c1 (diff) |
nv30, nv40: unify all structures and headers, except shaders
This patch unifies nv[34]0_screen.h, nv[34]0_context.h and
nv[34]0_state.h
The unified files are put in a new "nvfx" directory.
nv30_context.h and nv40_context.h still exist to hold the function
prototypes and include nvfx_context.h
nv[34]0_screen.h and nv[34]0_state.h are deleted, replaced by the
unified versions.
nv40 includes some extra fields for swtnl and user clip planes
support.
These fields will be unused on nv30 until that functionality gets
added to it too (by unification with nv40).
Diffstat (limited to 'src/gallium/drivers/nv40')
25 files changed, 594 insertions, 897 deletions
diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile index 0ecae2b4913..50e5e72b4ea 100644 --- a/src/gallium/drivers/nv40/Makefile +++ b/src/gallium/drivers/nv40/Makefile @@ -26,4 +26,6 @@ C_SOURCES = \ nv40_vbo.c \ nv40_vertprog.c +LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/nvfx + include ../../Makefile.template diff --git a/src/gallium/drivers/nv40/nv40_clear.c b/src/gallium/drivers/nv40/nv40_clear.c index ddf13addf3b..79de90434de 100644 --- a/src/gallium/drivers/nv40/nv40_clear.c +++ b/src/gallium/drivers/nv40/nv40_clear.c @@ -9,6 +9,6 @@ void nv40_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil) { - util_clear(pipe, &nv40_context(pipe)->framebuffer, buffers, rgba, depth, + util_clear(pipe, &nvfx_context(pipe)->framebuffer, buffers, rgba, depth, stencil); } diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c index da35676fd57..721b5134388 100644 --- a/src/gallium/drivers/nv40/nv40_context.c +++ b/src/gallium/drivers/nv40/nv40_context.c @@ -2,14 +2,14 @@ #include "pipe/p_defines.h" #include "nv40_context.h" -#include "nv40_screen.h" +#include "nvfx_screen.h" static void nv40_flush(struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_screen *screen = nv40->screen; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -28,61 +28,61 @@ nv40_flush(struct pipe_context *pipe, unsigned flags, static void nv40_destroy(struct pipe_context *pipe) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned i; - for (i = 0; i < NV40_STATE_MAX; i++) { - if (nv40->state.hw[i]) - so_ref(NULL, &nv40->state.hw[i]); + for (i = 0; i < NVFX_STATE_MAX; i++) { + if (nvfx->state.hw[i]) + so_ref(NULL, &nvfx->state.hw[i]); } - if (nv40->draw) - draw_destroy(nv40->draw); - FREE(nv40); + if (nvfx->draw) + draw_destroy(nvfx->draw); + FREE(nvfx); } struct pipe_context * nv40_create(struct pipe_screen *pscreen, void *priv) { - struct nv40_screen *screen = nv40_screen(pscreen); + struct nvfx_screen *screen = nvfx_screen(pscreen); struct pipe_winsys *ws = pscreen->winsys; - struct nv40_context *nv40; + struct nvfx_context *nvfx; struct nouveau_winsys *nvws = screen->nvws; - nv40 = CALLOC(1, sizeof(struct nv40_context)); - if (!nv40) + nvfx = CALLOC(1, sizeof(struct nvfx_context)); + if (!nvfx) return NULL; - nv40->screen = screen; + nvfx->screen = screen; - nv40->nvws = nvws; + nvfx->nvws = nvws; - nv40->pipe.winsys = ws; - nv40->pipe.priv = priv; - nv40->pipe.screen = pscreen; - nv40->pipe.destroy = nv40_destroy; - nv40->pipe.draw_arrays = nv40_draw_arrays; - nv40->pipe.draw_elements = nv40_draw_elements; - nv40->pipe.clear = nv40_clear; - nv40->pipe.flush = nv40_flush; + nvfx->pipe.winsys = ws; + nvfx->pipe.priv = priv; + nvfx->pipe.screen = pscreen; + nvfx->pipe.destroy = nv40_destroy; + nvfx->pipe.draw_arrays = nv40_draw_arrays; + nvfx->pipe.draw_elements = nv40_draw_elements; + nvfx->pipe.clear = nv40_clear; + nvfx->pipe.flush = nv40_flush; - nv40->pipe.is_texture_referenced = nouveau_is_texture_referenced; - nv40->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; + nvfx->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nvfx->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; - screen->base.channel->user_private = nv40; + screen->base.channel->user_private = nvfx; screen->base.channel->flush_notify = nv40_state_flush_notify; - nv40_init_query_functions(nv40); - nv40_init_surface_functions(nv40); - nv40_init_state_functions(nv40); - nv40_init_transfer_functions(nv40); + nv40_init_query_functions(nvfx); + nv40_init_surface_functions(nvfx); + nv40_init_state_functions(nvfx); + nv40_init_transfer_functions(nvfx); /* Create, configure, and install fallback swtnl path */ - nv40->draw = draw_create(); - draw_wide_point_threshold(nv40->draw, 9999999.0); - draw_wide_line_threshold(nv40->draw, 9999999.0); - draw_enable_line_stipple(nv40->draw, FALSE); - draw_enable_point_sprites(nv40->draw, FALSE); - draw_set_rasterize_stage(nv40->draw, nv40_draw_render_stage(nv40)); - - return &nv40->pipe; + nvfx->draw = draw_create(); + draw_wide_point_threshold(nvfx->draw, 9999999.0); + draw_wide_line_threshold(nvfx->draw, 9999999.0); + draw_enable_line_stipple(nvfx->draw, FALSE); + draw_enable_point_sprites(nvfx->draw, FALSE); + draw_set_rasterize_stage(nvfx->draw, nv40_draw_render_stage(nvfx)); + + return &nvfx->pipe; } diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index cb5d9e2d9d4..7227c4a438b 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -1,229 +1,52 @@ #ifndef __NV40_CONTEXT_H__ #define __NV40_CONTEXT_H__ -#include <stdio.h> +#include "nvfx_context.h" -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_state.h" -#include "pipe/p_compiler.h" - -#include "util/u_memory.h" -#include "util/u_math.h" -#include "util/u_inlines.h" - -#include "draw/draw_vertex.h" - -#include "nouveau/nouveau_winsys.h" -#include "nouveau/nouveau_gldefs.h" -#include "nouveau/nouveau_context.h" -#include "nouveau/nouveau_stateobj.h" - -#include "nv40_state.h" - -#define NOUVEAU_ERR(fmt, args...) \ - fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args); -#define NOUVEAU_MSG(fmt, args...) \ - fprintf(stderr, "nouveau: "fmt, ##args); - -enum nv40_state_index { - NV40_STATE_FB = 0, - NV40_STATE_VIEWPORT = 1, - NV40_STATE_BLEND = 2, - NV40_STATE_RAST = 3, - NV40_STATE_ZSA = 4, - NV40_STATE_BCOL = 5, - NV40_STATE_CLIP = 6, - NV40_STATE_SCISSOR = 7, - NV40_STATE_STIPPLE = 8, - NV40_STATE_FRAGPROG = 9, - NV40_STATE_VERTPROG = 10, - NV40_STATE_FRAGTEX0 = 11, - NV40_STATE_FRAGTEX1 = 12, - NV40_STATE_FRAGTEX2 = 13, - NV40_STATE_FRAGTEX3 = 14, - NV40_STATE_FRAGTEX4 = 15, - NV40_STATE_FRAGTEX5 = 16, - NV40_STATE_FRAGTEX6 = 17, - NV40_STATE_FRAGTEX7 = 18, - NV40_STATE_FRAGTEX8 = 19, - NV40_STATE_FRAGTEX9 = 20, - NV40_STATE_FRAGTEX10 = 21, - NV40_STATE_FRAGTEX11 = 22, - NV40_STATE_FRAGTEX12 = 23, - NV40_STATE_FRAGTEX13 = 24, - NV40_STATE_FRAGTEX14 = 25, - NV40_STATE_FRAGTEX15 = 26, - NV40_STATE_VERTTEX0 = 27, - NV40_STATE_VERTTEX1 = 28, - NV40_STATE_VERTTEX2 = 29, - NV40_STATE_VERTTEX3 = 30, - NV40_STATE_VTXBUF = 31, - NV40_STATE_VTXFMT = 32, - NV40_STATE_VTXATTR = 33, - NV40_STATE_SR = 34, - NV40_STATE_MAX = 35 -}; - -#include "nv40_screen.h" - -#define NV40_NEW_BLEND (1 << 0) -#define NV40_NEW_RAST (1 << 1) -#define NV40_NEW_ZSA (1 << 2) -#define NV40_NEW_SAMPLER (1 << 3) -#define NV40_NEW_FB (1 << 4) -#define NV40_NEW_STIPPLE (1 << 5) -#define NV40_NEW_SCISSOR (1 << 6) -#define NV40_NEW_VIEWPORT (1 << 7) -#define NV40_NEW_BCOL (1 << 8) -#define NV40_NEW_VERTPROG (1 << 9) -#define NV40_NEW_FRAGPROG (1 << 10) -#define NV40_NEW_ARRAYS (1 << 11) -#define NV40_NEW_UCP (1 << 12) -#define NV40_NEW_SR (1 << 13) - -struct nv40_rasterizer_state { - struct pipe_rasterizer_state pipe; - struct nouveau_stateobj *so; -}; - -struct nv40_zsa_state { - struct pipe_depth_stencil_alpha_state pipe; - struct nouveau_stateobj *so; -}; - -struct nv40_blend_state { - struct pipe_blend_state pipe; - struct nouveau_stateobj *so; -}; - - -struct nv40_state { - unsigned scissor_enabled; - unsigned stipple_enabled; - unsigned fp_samplers; - - uint64_t dirty; - struct nouveau_stateobj *hw[NV40_STATE_MAX]; -}; - - -struct nv40_vtxelt_state { - struct pipe_vertex_element pipe[16]; - unsigned num_elements; -}; - -struct nv40_context { - struct pipe_context pipe; - - struct nouveau_winsys *nvws; - struct nv40_screen *screen; - - struct draw_context *draw; - - /* HW state derived from pipe states */ - struct nv40_state state; - struct { - struct nv40_vertex_program *vertprog; - - unsigned nr_attribs; - unsigned hw[PIPE_MAX_SHADER_INPUTS]; - unsigned draw[PIPE_MAX_SHADER_INPUTS]; - unsigned emit[PIPE_MAX_SHADER_INPUTS]; - } swtnl; - - enum { - HW, SWTNL, SWRAST - } render_mode; - unsigned fallback_swtnl; - unsigned fallback_swrast; - - /* Context state */ - unsigned dirty, draw_dirty; - struct pipe_scissor_state scissor; - unsigned stipple[32]; - struct pipe_clip_state clip; - struct nv40_vertex_program *vertprog; - struct nv40_fragment_program *fragprog; - struct pipe_buffer *constbuf[PIPE_SHADER_TYPES]; - unsigned constbuf_nr[PIPE_SHADER_TYPES]; - struct nv40_rasterizer_state *rasterizer; - struct nv40_zsa_state *zsa; - struct nv40_blend_state *blend; - struct pipe_blend_color blend_colour; - struct pipe_stencil_ref stencil_ref; - struct pipe_viewport_state viewport; - struct pipe_framebuffer_state framebuffer; - struct pipe_buffer *idxbuf; - unsigned idxbuf_format; - struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS]; - struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS]; - unsigned nr_samplers; - unsigned nr_textures; - unsigned dirty_samplers; - struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS]; - unsigned vtxbuf_nr; - struct nv40_vtxelt_state *vtxelt; -}; - -static INLINE struct nv40_context * -nv40_context(struct pipe_context *pipe) -{ - return (struct nv40_context *)pipe; -} - -struct nv40_state_entry { - boolean (*validate)(struct nv40_context *nv40); - struct { - unsigned pipe; - unsigned hw; - } dirty; -}; - -extern void nv40_init_state_functions(struct nv40_context *nv40); -extern void nv40_init_surface_functions(struct nv40_context *nv40); -extern void nv40_init_query_functions(struct nv40_context *nv40); -extern void nv40_init_transfer_functions(struct nv40_context *nv40); +extern void nv40_init_state_functions(struct nvfx_context *nvfx); +extern void nv40_init_surface_functions(struct nvfx_context *nvfx); +extern void nv40_init_query_functions(struct nvfx_context *nvfx); +extern void nv40_init_transfer_functions(struct nvfx_context *nvfx); extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen); /* nv40_draw.c */ -extern struct draw_stage *nv40_draw_render_stage(struct nv40_context *nv40); +extern struct draw_stage *nv40_draw_render_stage(struct nvfx_context *nvfx); extern void nv40_draw_elements_swtnl(struct pipe_context *pipe, struct pipe_buffer *idxbuf, unsigned ib_size, unsigned mode, unsigned start, unsigned count); /* nv40_vertprog.c */ -extern void nv40_vertprog_destroy(struct nv40_context *, - struct nv40_vertex_program *); +extern void nv40_vertprog_destroy(struct nvfx_context *, + struct nvfx_vertex_program *); /* nv40_fragprog.c */ -extern void nv40_fragprog_destroy(struct nv40_context *, - struct nv40_fragment_program *); +extern void nv40_fragprog_destroy(struct nvfx_context *, + struct nvfx_fragment_program *); /* nv40_fragtex.c */ -extern void nv40_fragtex_bind(struct nv40_context *); +extern void nv40_fragtex_bind(struct nvfx_context *); /* nv40_state.c and friends */ -extern boolean nv40_state_validate(struct nv40_context *nv40); -extern boolean nv40_state_validate_swtnl(struct nv40_context *nv40); -extern void nv40_state_emit(struct nv40_context *nv40); +extern boolean nv40_state_validate(struct nvfx_context *nvfx); +extern boolean nv40_state_validate_swtnl(struct nvfx_context *nvfx); +extern void nv40_state_emit(struct nvfx_context *nvfx); extern void nv40_state_flush_notify(struct nouveau_channel *chan); -extern struct nv40_state_entry nv40_state_rasterizer; -extern struct nv40_state_entry nv40_state_scissor; -extern struct nv40_state_entry nv40_state_stipple; -extern struct nv40_state_entry nv40_state_fragprog; -extern struct nv40_state_entry nv40_state_vertprog; -extern struct nv40_state_entry nv40_state_blend; -extern struct nv40_state_entry nv40_state_blend_colour; -extern struct nv40_state_entry nv40_state_zsa; -extern struct nv40_state_entry nv40_state_viewport; -extern struct nv40_state_entry nv40_state_framebuffer; -extern struct nv40_state_entry nv40_state_fragtex; -extern struct nv40_state_entry nv40_state_vbo; -extern struct nv40_state_entry nv40_state_vtxfmt; -extern struct nv40_state_entry nv40_state_sr; +extern struct nvfx_state_entry nv40_state_rasterizer; +extern struct nvfx_state_entry nv40_state_scissor; +extern struct nvfx_state_entry nv40_state_stipple; +extern struct nvfx_state_entry nv40_state_fragprog; +extern struct nvfx_state_entry nv40_state_vertprog; +extern struct nvfx_state_entry nv40_state_blend; +extern struct nvfx_state_entry nv40_state_blend_colour; +extern struct nvfx_state_entry nv40_state_zsa; +extern struct nvfx_state_entry nv40_state_viewport; +extern struct nvfx_state_entry nv40_state_framebuffer; +extern struct nvfx_state_entry nv40_state_fragtex; +extern struct nvfx_state_entry nv40_state_vbo; +extern struct nvfx_state_entry nv40_state_vtxfmt; +extern struct nvfx_state_entry nv40_state_sr; /* nv40_vbo.c */ extern void nv40_draw_arrays(struct pipe_context *, unsigned mode, @@ -238,7 +61,7 @@ extern void nv40_draw_elements(struct pipe_context *pipe, extern void nv40_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil); -/* nv40_context.c */ +/* nvfx_context.c */ struct pipe_context * nv40_create(struct pipe_screen *pscreen, void *priv); diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c index 05d237d1bb0..cce1c64621d 100644 --- a/src/gallium/drivers/nv40/nv40_draw.c +++ b/src/gallium/drivers/nv40/nv40_draw.c @@ -18,7 +18,7 @@ struct nv40_render_stage { struct draw_stage stage; - struct nv40_context *nv40; + struct nvfx_context *nvfx; unsigned prim; }; @@ -29,18 +29,18 @@ nv40_render_stage(struct draw_stage *stage) } static INLINE void -nv40_render_vertex(struct nv40_context *nv40, const struct vertex_header *v) +nv40_render_vertex(struct nvfx_context *nvfx, const struct vertex_header *v) { - struct nv40_screen *screen = nv40->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; unsigned i; - for (i = 0; i < nv40->swtnl.nr_attribs; i++) { - unsigned idx = nv40->swtnl.draw[i]; - unsigned hw = nv40->swtnl.hw[i]; + for (i = 0; i < nvfx->swtnl.nr_attribs; i++) { + unsigned idx = nvfx->swtnl.draw[i]; + unsigned hw = nvfx->swtnl.hw[i]; - switch (nv40->swtnl.emit[i]) { + switch (nvfx->swtnl.emit[i]) { case EMIT_OMIT: break; case EMIT_1F: @@ -84,9 +84,9 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim, unsigned mode, unsigned count) { struct nv40_render_stage *rs = nv40_render_stage(stage); - struct nv40_context *nv40 = rs->nv40; + struct nvfx_context *nvfx = rs->nvfx; - struct nv40_screen *screen = nv40->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; unsigned i; @@ -98,7 +98,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim, assert(0); } FIRE_RING(chan); - nv40_state_emit(nv40); + nv40_state_emit(nvfx); } /* Switch primitive modes if necessary */ @@ -115,7 +115,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim, /* Emit vertex data */ for (i = 0; i < count; i++) - nv40_render_vertex(nv40, prim->v[i]); + nv40_render_vertex(nvfx, prim->v[i]); /* If it's likely we'll need to empty the push buffer soon, finish * off the primitive now. @@ -149,8 +149,8 @@ static void nv40_render_flush(struct draw_stage *draw, unsigned flags) { struct nv40_render_stage *rs = nv40_render_stage(draw); - struct nv40_context *nv40 = rs->nv40; - struct nv40_screen *screen = nv40->screen; + struct nvfx_context *nvfx = rs->nvfx; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -173,13 +173,13 @@ nv40_render_destroy(struct draw_stage *draw) } static INLINE void -emit_mov(struct nv40_vertex_program *vp, +emit_mov(struct nvfx_vertex_program *vp, unsigned dst, unsigned src, unsigned vor, unsigned mask) { - struct nv40_vertex_program_exec *inst; + struct nvfx_vertex_program_exec *inst; vp->insns = realloc(vp->insns, - sizeof(struct nv40_vertex_program_exec) * + sizeof(struct nvfx_vertex_program_exec) * ++vp->nr_insns); inst = &vp->insns[vp->nr_insns - 1]; @@ -195,10 +195,10 @@ emit_mov(struct nv40_vertex_program *vp, vp->or |= (1 << vor); } -static struct nv40_vertex_program * -create_drawvp(struct nv40_context *nv40) +static struct nvfx_vertex_program * +create_drawvp(struct nvfx_context *nvfx) { - struct nv40_vertex_program *vp = CALLOC_STRUCT(nv40_vertex_program); + struct nvfx_vertex_program *vp = CALLOC_STRUCT(nvfx_vertex_program); unsigned i; emit_mov(vp, NV40_VP_INST_DEST_POS, 0, ~0, 0xf); @@ -216,15 +216,15 @@ create_drawvp(struct nv40_context *nv40) } struct draw_stage * -nv40_draw_render_stage(struct nv40_context *nv40) +nv40_draw_render_stage(struct nvfx_context *nvfx) { struct nv40_render_stage *render = CALLOC_STRUCT(nv40_render_stage); - if (!nv40->swtnl.vertprog) - nv40->swtnl.vertprog = create_drawvp(nv40); + if (!nvfx->swtnl.vertprog) + nvfx->swtnl.vertprog = create_drawvp(nvfx); - render->nv40 = nv40; - render->stage.draw = nv40->draw; + render->nvfx = nvfx; + render->stage.draw = nvfx->draw; render->stage.point = nv40_render_point; render->stage.line = nv40_render_line; render->stage.tri = nv40_render_tri; @@ -240,71 +240,71 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe, struct pipe_buffer *idxbuf, unsigned idxbuf_size, unsigned mode, unsigned start, unsigned count) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct pipe_screen *pscreen = pipe->screen; unsigned i; void *map; - if (!nv40_state_validate_swtnl(nv40)) + if (!nv40_state_validate_swtnl(nvfx)) return; - nv40->state.dirty &= ~(1ULL << NV40_STATE_VTXBUF); - nv40_state_emit(nv40); + nvfx->state.dirty &= ~(1ULL << NVFX_STATE_VTXBUF); + nv40_state_emit(nvfx); - for (i = 0; i < nv40->vtxbuf_nr; i++) { - map = pipe_buffer_map(pscreen, nv40->vtxbuf[i].buffer, + for (i = 0; i < nvfx->vtxbuf_nr; i++) { + map = pipe_buffer_map(pscreen, nvfx->vtxbuf[i].buffer, PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_vertex_buffer(nv40->draw, i, map); + draw_set_mapped_vertex_buffer(nvfx->draw, i, map); } if (idxbuf) { map = pipe_buffer_map(pscreen, idxbuf, PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_element_buffer(nv40->draw, idxbuf_size, map); + draw_set_mapped_element_buffer(nvfx->draw, idxbuf_size, map); } else { - draw_set_mapped_element_buffer(nv40->draw, 0, NULL); + draw_set_mapped_element_buffer(nvfx->draw, 0, NULL); } - if (nv40->constbuf[PIPE_SHADER_VERTEX]) { - const unsigned nr = nv40->constbuf_nr[PIPE_SHADER_VERTEX]; + if (nvfx->constbuf[PIPE_SHADER_VERTEX]) { + const unsigned nr = nvfx->constbuf_nr[PIPE_SHADER_VERTEX]; map = pipe_buffer_map(pscreen, - nv40->constbuf[PIPE_SHADER_VERTEX], + nvfx->constbuf[PIPE_SHADER_VERTEX], PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_constant_buffer(nv40->draw, PIPE_SHADER_VERTEX, 0, + draw_set_mapped_constant_buffer(nvfx->draw, PIPE_SHADER_VERTEX, 0, map, nr); } - draw_arrays(nv40->draw, mode, start, count); + draw_arrays(nvfx->draw, mode, start, count); - for (i = 0; i < nv40->vtxbuf_nr; i++) - pipe_buffer_unmap(pscreen, nv40->vtxbuf[i].buffer); + for (i = 0; i < nvfx->vtxbuf_nr; i++) + pipe_buffer_unmap(pscreen, nvfx->vtxbuf[i].buffer); if (idxbuf) pipe_buffer_unmap(pscreen, idxbuf); - if (nv40->constbuf[PIPE_SHADER_VERTEX]) - pipe_buffer_unmap(pscreen, nv40->constbuf[PIPE_SHADER_VERTEX]); + if (nvfx->constbuf[PIPE_SHADER_VERTEX]) + pipe_buffer_unmap(pscreen, nvfx->constbuf[PIPE_SHADER_VERTEX]); - draw_flush(nv40->draw); + draw_flush(nvfx->draw); pipe->flush(pipe, 0, NULL); } static INLINE void -emit_attrib(struct nv40_context *nv40, unsigned hw, unsigned emit, +emit_attrib(struct nvfx_context *nvfx, unsigned hw, unsigned emit, unsigned semantic, unsigned index) { - unsigned draw_out = draw_find_shader_output(nv40->draw, semantic, index); - unsigned a = nv40->swtnl.nr_attribs++; + unsigned draw_out = draw_find_shader_output(nvfx->draw, semantic, index); + unsigned a = nvfx->swtnl.nr_attribs++; - nv40->swtnl.hw[a] = hw; - nv40->swtnl.emit[a] = emit; - nv40->swtnl.draw[a] = draw_out; + nvfx->swtnl.hw[a] = hw; + nvfx->swtnl.emit[a] = emit; + nvfx->swtnl.draw[a] = draw_out; } static boolean -nv40_state_vtxfmt_validate(struct nv40_context *nv40) +nv40_state_vtxfmt_validate(struct nvfx_context *nvfx) { - struct nv40_fragment_program *fp = nv40->fragprog; + struct nvfx_fragment_program *fp = nvfx->fragprog; unsigned colour = 0, texcoords = 0, fog = 0, i; /* Determine needed fragprog inputs */ @@ -326,34 +326,34 @@ nv40_state_vtxfmt_validate(struct nv40_context *nv40) } } - nv40->swtnl.nr_attribs = 0; + nvfx->swtnl.nr_attribs = 0; /* Map draw vtxprog output to hw attribute IDs */ for (i = 0; i < 2; i++) { if (!(colour & (1 << i))) continue; - emit_attrib(nv40, 3 + i, EMIT_4UB, TGSI_SEMANTIC_COLOR, i); + emit_attrib(nvfx, 3 + i, EMIT_4UB, TGSI_SEMANTIC_COLOR, i); } for (i = 0; i < 8; i++) { if (!(texcoords & (1 << i))) continue; - emit_attrib(nv40, 8 + i, EMIT_4F, TGSI_SEMANTIC_GENERIC, i); + emit_attrib(nvfx, 8 + i, EMIT_4F, TGSI_SEMANTIC_GENERIC, i); } if (fog) { - emit_attrib(nv40, 5, EMIT_1F, TGSI_SEMANTIC_FOG, 0); + emit_attrib(nvfx, 5, EMIT_1F, TGSI_SEMANTIC_FOG, 0); } - emit_attrib(nv40, 0, EMIT_3F, TGSI_SEMANTIC_POSITION, 0); + emit_attrib(nvfx, 0, EMIT_3F, TGSI_SEMANTIC_POSITION, 0); return FALSE; } -struct nv40_state_entry nv40_state_vtxfmt = { +struct nvfx_state_entry nv40_state_vtxfmt = { .validate = nv40_state_vtxfmt_validate, .dirty = { - .pipe = NV40_NEW_ARRAYS | NV40_NEW_FRAGPROG, + .pipe = NVFX_NEW_ARRAYS | NVFX_NEW_FRAGPROG, .hw = 0 } }; diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 3d08828bea8..2a0ab0cf310 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -30,7 +30,7 @@ #define MAX_CONSTS 128 #define MAX_IMM 32 struct nv40_fpc { - struct nv40_fragment_program *fp; + struct nvfx_fragment_program *fp; uint attrib_map[PIPE_MAX_SHADER_INPUTS]; @@ -102,7 +102,7 @@ constant(struct nv40_fpc *fpc, int pipe, float vals[4]) static void grow_insns(struct nv40_fpc *fpc, int size) { - struct nv40_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; fp->insn_len += size; fp->insn = realloc(fp->insn, sizeof(uint32_t) * fp->insn_len); @@ -111,7 +111,7 @@ grow_insns(struct nv40_fpc *fpc, int size) static void emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src) { - struct nv40_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw = &fp->insn[fpc->inst_offset]; uint32_t sr = 0; @@ -135,7 +135,7 @@ emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src) hw = &fp->insn[fpc->inst_offset]; if (fpc->consts[src.index].pipe >= 0) { - struct nv40_fragment_program_data *fpd; + struct nvfx_fragment_program_data *fpd; fp->consts = realloc(fp->consts, ++fp->nr_consts * sizeof(*fpd)); @@ -175,7 +175,7 @@ emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src) static void emit_dst(struct nv40_fpc *fpc, struct nv40_sreg dst) { - struct nv40_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw = &fp->insn[fpc->inst_offset]; switch (dst.type) { @@ -205,7 +205,7 @@ nv40_fp_arith(struct nv40_fpc *fpc, int sat, int op, struct nv40_sreg dst, int mask, struct nv40_sreg s0, struct nv40_sreg s1, struct nv40_sreg s2) { - struct nv40_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw; fpc->inst_offset = fp->insn_len; @@ -242,7 +242,7 @@ nv40_fp_tex(struct nv40_fpc *fpc, int sat, int op, int unit, struct nv40_sreg dst, int mask, struct nv40_sreg s0, struct nv40_sreg s1, struct nv40_sreg s2) { - struct nv40_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; nv40_fp_arith(fpc, sat, op, dst, mask, s0, s1, s2); @@ -803,8 +803,8 @@ out_err: } static void -nv40_fragprog_translate(struct nv40_context *nv40, - struct nv40_fragment_program *fp) +nv40_fragprog_translate(struct nvfx_context *nvfx, + struct nvfx_fragment_program *fp) { struct tgsi_parse_context parse; struct nv40_fpc *fpc = NULL; @@ -862,10 +862,10 @@ out_err: } static void -nv40_fragprog_upload(struct nv40_context *nv40, - struct nv40_fragment_program *fp) +nv40_fragprog_upload(struct nvfx_context *nvfx, + struct nvfx_fragment_program *fp) { - struct pipe_screen *pscreen = nv40->pipe.screen; + struct pipe_screen *pscreen = nvfx->pipe.screen; const uint32_t le = 1; uint32_t *map; int i; @@ -896,12 +896,12 @@ nv40_fragprog_upload(struct nv40_context *nv40, } static boolean -nv40_fragprog_validate(struct nv40_context *nv40) +nv40_fragprog_validate(struct nvfx_context *nvfx) { - struct nv40_fragment_program *fp = nv40->fragprog; + struct nvfx_fragment_program *fp = nvfx->fragprog; struct pipe_buffer *constbuf = - nv40->constbuf[PIPE_SHADER_FRAGMENT]; - struct pipe_screen *pscreen = nv40->pipe.screen; + nvfx->constbuf[PIPE_SHADER_FRAGMENT]; + struct pipe_screen *pscreen = nvfx->pipe.screen; struct nouveau_stateobj *so; boolean new_consts = FALSE; int i; @@ -909,23 +909,23 @@ nv40_fragprog_validate(struct nv40_context *nv40) if (fp->translated) goto update_constants; - nv40->fallback_swrast &= ~NV40_NEW_FRAGPROG; - nv40_fragprog_translate(nv40, fp); + nvfx->fallback_swrast &= ~NVFX_NEW_FRAGPROG; + nv40_fragprog_translate(nvfx, fp); if (!fp->translated) { - nv40->fallback_swrast |= NV40_NEW_FRAGPROG; + nvfx->fallback_swrast |= NVFX_NEW_FRAGPROG; return FALSE; } fp->buffer = pscreen->buffer_create(pscreen, 0x100, 0, fp->insn_len * 4); - nv40_fragprog_upload(nv40, fp); + nv40_fragprog_upload(nvfx, fp); so = so_new(2, 2, 1); - so_method(so, nv40->screen->eng3d, NV34TCL_FP_ACTIVE_PROGRAM, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_FP_ACTIVE_PROGRAM, 1); so_reloc (so, nouveau_bo(fp->buffer), 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0, NV34TCL_FP_ACTIVE_PROGRAM_DMA1); - so_method(so, nv40->screen->eng3d, NV34TCL_FP_CONTROL, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_FP_CONTROL, 1); so_data (so, fp->fp_control); so_ref(so, &fp->so); so_ref(NULL, &so); @@ -937,7 +937,7 @@ update_constants: map = pipe_buffer_map(pscreen, constbuf, PIPE_BUFFER_USAGE_CPU_READ); for (i = 0; i < fp->nr_consts; i++) { - struct nv40_fragment_program_data *fpd = &fp->consts[i]; + struct nvfx_fragment_program_data *fpd = &fp->consts[i]; uint32_t *p = &fp->insn[fpd->offset]; uint32_t *cb = (uint32_t *)&map[fpd->index * 4]; @@ -949,11 +949,11 @@ update_constants: pipe_buffer_unmap(pscreen, constbuf); if (new_consts) - nv40_fragprog_upload(nv40, fp); + nv40_fragprog_upload(nvfx, fp); } - if (new_consts || fp->so != nv40->state.hw[NV40_STATE_FRAGPROG]) { - so_ref(fp->so, &nv40->state.hw[NV40_STATE_FRAGPROG]); + if (new_consts || fp->so != nvfx->state.hw[NVFX_STATE_FRAGPROG]) { + so_ref(fp->so, &nvfx->state.hw[NVFX_STATE_FRAGPROG]); return TRUE; } @@ -961,8 +961,8 @@ update_constants: } void -nv40_fragprog_destroy(struct nv40_context *nv40, - struct nv40_fragment_program *fp) +nv40_fragprog_destroy(struct nvfx_context *nvfx, + struct nvfx_fragment_program *fp) { if (fp->buffer) pipe_buffer_reference(&fp->buffer, NULL); @@ -974,11 +974,11 @@ nv40_fragprog_destroy(struct nv40_context *nv40, FREE(fp->insn); } -struct nv40_state_entry nv40_state_fragprog = { +struct nvfx_state_entry nv40_state_fragprog = { .validate = nv40_fragprog_validate, .dirty = { - .pipe = NV40_NEW_FRAGPROG, - .hw = NV40_STATE_FRAGPROG + .pipe = NVFX_NEW_FRAGPROG, + .hw = NVFX_STATE_FRAGPROG } }; diff --git a/src/gallium/drivers/nv40/nv40_fragtex.c b/src/gallium/drivers/nv40/nv40_fragtex.c index 4c26f3cb123..0b46a5313bd 100644 --- a/src/gallium/drivers/nv40/nv40_fragtex.c +++ b/src/gallium/drivers/nv40/nv40_fragtex.c @@ -61,10 +61,10 @@ nv40_fragtex_format(uint pipe_format) static struct nouveau_stateobj * -nv40_fragtex_build(struct nv40_context *nv40, int unit) +nv40_fragtex_build(struct nvfx_context *nvfx, int unit) { - struct nv40_sampler_state *ps = nv40->tex_sampler[unit]; - struct nv40_miptree *nv40mt = nv40->tex_miptree[unit]; + struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit]; + struct nvfx_miptree *nv40mt = nvfx->tex_miptree[unit]; struct nouveau_bo *bo = nouveau_bo(nv40mt->buffer); struct pipe_texture *pt = &nv40mt->base; struct nv40_texture_format *tf; @@ -111,7 +111,7 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit) txs = tf->swizzle; so = so_new(2, 9, 2); - so_method(so, nv40->screen->eng3d, NV34TCL_TX_OFFSET(unit), 8); + so_method(so, nvfx->screen->eng3d, NV34TCL_TX_OFFSET(unit), 8); so_reloc (so, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); so_reloc (so, bo, txf, tex_flags | NOUVEAU_BO_OR, NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); @@ -122,17 +122,17 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit) so_data (so, (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | pt->height0); so_data (so, ps->bcol); - so_method(so, nv40->screen->eng3d, NV40TCL_TEX_SIZE1(unit), 1); + so_method(so, nvfx->screen->eng3d, NV40TCL_TEX_SIZE1(unit), 1); so_data (so, (pt->depth0 << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp); return so; } static boolean -nv40_fragtex_validate(struct nv40_context *nv40) +nv40_fragtex_validate(struct nvfx_context *nvfx) { - struct nv40_fragment_program *fp = nv40->fragprog; - struct nv40_state *state = &nv40->state; + struct nvfx_fragment_program *fp = nvfx->fragprog; + struct nvfx_state *state = &nvfx->state; struct nouveau_stateobj *so; unsigned samplers, unit; @@ -142,31 +142,31 @@ nv40_fragtex_validate(struct nv40_context *nv40) samplers &= ~(1 << unit); so = so_new(1, 1, 0); - so_method(so, nv40->screen->eng3d, NV34TCL_TX_ENABLE(unit), 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_TX_ENABLE(unit), 1); so_data (so, 0); - so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]); - state->dirty |= (1ULL << (NV40_STATE_FRAGTEX0 + unit)); + so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]); + state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit)); } - samplers = nv40->dirty_samplers & fp->samplers; + samplers = nvfx->dirty_samplers & fp->samplers; while (samplers) { unit = ffs(samplers) - 1; samplers &= ~(1 << unit); - so = nv40_fragtex_build(nv40, unit); - so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]); + so = nv40_fragtex_build(nvfx, unit); + so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]); so_ref(NULL, &so); - state->dirty |= (1ULL << (NV40_STATE_FRAGTEX0 + unit)); + state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit)); } - nv40->state.fp_samplers = fp->samplers; + nvfx->state.fp_samplers = fp->samplers; return FALSE; } -struct nv40_state_entry nv40_state_fragtex = { +struct nvfx_state_entry nv40_state_fragtex = { .validate = nv40_fragtex_validate, .dirty = { - .pipe = NV40_NEW_SAMPLER | NV40_NEW_FRAGPROG, + .pipe = NVFX_NEW_SAMPLER | NVFX_NEW_FRAGPROG, .hw = 0 } }; diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index 62e97bcea48..caec47058fe 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -10,7 +10,7 @@ static void -nv40_miptree_layout(struct nv40_miptree *mt) +nv40_miptree_layout(struct nvfx_miptree *mt) { struct pipe_texture *pt = &mt->base; uint width = pt->width0; @@ -64,11 +64,11 @@ nv40_miptree_layout(struct nv40_miptree *mt) static struct pipe_texture * nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) { - struct nv40_miptree *mt; + struct nvfx_miptree *mt; unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL | NOUVEAU_BUFFER_USAGE_TEXTURE; - mt = MALLOC(sizeof(struct nv40_miptree)); + mt = MALLOC(sizeof(struct nvfx_miptree)); if (!mt) return NULL; mt->base = *pt; @@ -127,14 +127,14 @@ static struct pipe_texture * nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, const unsigned *stride, struct pipe_buffer *pb) { - struct nv40_miptree *mt; + struct nvfx_miptree *mt; /* Only supports 2D, non-mipmapped textures for the moment */ if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 || pt->depth0 != 1) return NULL; - mt = CALLOC_STRUCT(nv40_miptree); + mt = CALLOC_STRUCT(nvfx_miptree); if (!mt) return NULL; @@ -155,7 +155,7 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, static void nv40_miptree_destroy(struct pipe_texture *pt) { - struct nv40_miptree *mt = (struct nv40_miptree *)pt; + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; int l; pipe_buffer_reference(&mt->buffer, NULL); @@ -172,7 +172,7 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags) { - struct nv40_miptree *mt = (struct nv40_miptree *)pt; + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; struct nv04_surface *ns; ns = CALLOC_STRUCT(nv04_surface); @@ -202,7 +202,7 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, * Note that ns->pitch is always a multiple of 64 for linear surfaces and swizzled surfaces are POT, so * ns->pitch & 63 is equivalent to (ns->pitch < 64 && swizzled)*/ if((ns->pitch & 63) && (ns->base.usage & (PIPE_BUFFER_USAGE_GPU_WRITE | NOUVEAU_BUFFER_USAGE_NO_RENDER)) == PIPE_BUFFER_USAGE_GPU_WRITE) - return &nv04_surface_wrap_for_render(pscreen, ((struct nv40_screen*)pscreen)->eng2d, ns)->base; + return &nv04_surface_wrap_for_render(pscreen, ((struct nvfx_screen*)pscreen)->eng2d, ns)->base; return &ns->base; } @@ -213,7 +213,7 @@ nv40_miptree_surface_del(struct pipe_surface *ps) struct nv04_surface* ns = (struct nv04_surface*)ps; if(ns->backing) { - struct nv40_screen* screen = (struct nv40_screen*)ps->texture->screen; + struct nvfx_screen* screen = (struct nvfx_screen*)ps->texture->screen; if(ns->backing->base.usage & PIPE_BUFFER_USAGE_GPU_WRITE) screen->eng2d->copy(screen->eng2d, &ns->backing->base, 0, 0, ps, 0, 0, ns->base.width, ns->base.height); nv40_miptree_surface_del(&ns->backing->base); diff --git a/src/gallium/drivers/nv40/nv40_query.c b/src/gallium/drivers/nv40/nv40_query.c index 899a8dc0b2d..48cfc4d593d 100644 --- a/src/gallium/drivers/nv40/nv40_query.c +++ b/src/gallium/drivers/nv40/nv40_query.c @@ -39,9 +39,9 @@ nv40_query_destroy(struct pipe_context *pipe, struct pipe_query *pq) static void nv40_query_begin(struct pipe_context *pipe, struct pipe_query *pq) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct nv40_query *q = nv40_query(pq); - struct nv40_screen *screen = nv40->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -56,9 +56,9 @@ nv40_query_begin(struct pipe_context *pipe, struct pipe_query *pq) pipe->get_query_result(pipe, pq, 1, &tmp); } - if (nouveau_resource_alloc(nv40->screen->query_heap, 1, NULL, &q->object)) + if (nouveau_resource_alloc(nvfx->screen->query_heap, 1, NULL, &q->object)) assert(0); - nouveau_notifier_reset(nv40->screen->query, q->object->start); + nouveau_notifier_reset(nvfx->screen->query, q->object->start); BEGIN_RING(chan, eng3d, NV34TCL_QUERY_RESET, 1); OUT_RING (chan, 1); @@ -71,9 +71,9 @@ nv40_query_begin(struct pipe_context *pipe, struct pipe_query *pq) static void nv40_query_end(struct pipe_context *pipe, struct pipe_query *pq) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct nv40_query *q = nv40_query(pq); - struct nv40_screen *screen = nv40->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -87,7 +87,7 @@ static boolean nv40_query_result(struct pipe_context *pipe, struct pipe_query *pq, boolean wait, uint64_t *result) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct nv40_query *q = nv40_query(pq); assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER); @@ -95,18 +95,18 @@ nv40_query_result(struct pipe_context *pipe, struct pipe_query *pq, if (!q->ready) { unsigned status; - status = nouveau_notifier_status(nv40->screen->query, + status = nouveau_notifier_status(nvfx->screen->query, q->object->start); if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) { if (wait == FALSE) return FALSE; - nouveau_notifier_wait_status(nv40->screen->query, + nouveau_notifier_wait_status(nvfx->screen->query, q->object->start, NV_NOTIFY_STATE_STATUS_COMPLETED, 0); } - q->result = nouveau_notifier_return_val(nv40->screen->query, + q->result = nouveau_notifier_return_val(nvfx->screen->query, q->object->start); q->ready = TRUE; nouveau_resource_free(&q->object); @@ -117,11 +117,11 @@ nv40_query_result(struct pipe_context *pipe, struct pipe_query *pq, } void -nv40_init_query_functions(struct nv40_context *nv40) +nv40_init_query_functions(struct nvfx_context *nvfx) { - nv40->pipe.create_query = nv40_query_create; - nv40->pipe.destroy_query = nv40_query_destroy; - nv40->pipe.begin_query = nv40_query_begin; - nv40->pipe.end_query = nv40_query_end; - nv40->pipe.get_query_result = nv40_query_result; + nvfx->pipe.create_query = nv40_query_create; + nvfx->pipe.destroy_query = nv40_query_destroy; + nvfx->pipe.begin_query = nv40_query_begin; + nvfx->pipe.end_query = nv40_query_end; + nvfx->pipe.get_query_result = nv40_query_result; } diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index 3c901c1c535..0fc8e187504 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -1,7 +1,7 @@ #include "pipe/p_screen.h" #include "nv40_context.h" -#include "nv40_screen.h" +#include "nvfx_screen.h" #define NV4X_GRCLASS4097_CHIPSETS 0x00000baf #define NV4X_GRCLASS4497_CHIPSETS 0x00005450 @@ -10,7 +10,7 @@ static int nv40_screen_get_param(struct pipe_screen *pscreen, int param) { - struct nv40_screen *screen = nv40_screen(pscreen); + struct nvfx_screen *screen = nvfx_screen(pscreen); switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -143,7 +143,7 @@ nv40_screen_surface_format_supported(struct pipe_screen *pscreen, static struct pipe_buffer * nv40_surface_buffer(struct pipe_surface *surf) { - struct nv40_miptree *mt = (struct nv40_miptree *)surf->texture; + struct nvfx_miptree *mt = (struct nvfx_miptree *)surf->texture; return mt->buffer; } @@ -151,10 +151,10 @@ nv40_surface_buffer(struct pipe_surface *surf) static void nv40_screen_destroy(struct pipe_screen *pscreen) { - struct nv40_screen *screen = nv40_screen(pscreen); + struct nvfx_screen *screen = nvfx_screen(pscreen); unsigned i; - for (i = 0; i < NV40_STATE_MAX; i++) { + for (i = 0; i < NVFX_STATE_MAX; i++) { if (screen->state[i]) so_ref(NULL, &screen->state[i]); } @@ -175,7 +175,7 @@ nv40_screen_destroy(struct pipe_screen *pscreen) struct pipe_screen * nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { - struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen); + struct nvfx_screen *screen = CALLOC_STRUCT(nvfx_screen); struct nouveau_channel *chan; struct pipe_screen *pscreen; struct nouveau_stateobj *so; diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nv40/nv40_screen.h deleted file mode 100644 index ad0ee63da64..00000000000 --- a/src/gallium/drivers/nv40/nv40_screen.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __NV40_SCREEN_H__ -#define __NV40_SCREEN_H__ - -#include "nouveau/nouveau_screen.h" -#include "nouveau/nv04_surface_2d.h" - -struct nv40_screen { - struct nouveau_screen base; - - struct nouveau_winsys *nvws; - - struct nv40_context *cur_ctx; - - /* HW graphics objects */ - struct nv04_surface_2d *eng2d; - struct nouveau_grobj *eng3d; - struct nouveau_notifier *sync; - - /* Query object resources */ - struct nouveau_notifier *query; - struct nouveau_resource *query_heap; - - /* Vtxprog resources */ - struct nouveau_resource *vp_exec_heap; - struct nouveau_resource *vp_data_heap; - - /* Current 3D state of channel */ - struct nouveau_stateobj *state[NV40_STATE_MAX]; -}; - -static INLINE struct nv40_screen * -nv40_screen(struct pipe_screen *screen) -{ - return (struct nv40_screen *)screen; -} - -#endif diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c index e8076e059b6..a205342ac5d 100644 --- a/src/gallium/drivers/nv40/nv40_state.c +++ b/src/gallium/drivers/nv40/nv40_state.c @@ -7,15 +7,15 @@ #include "tgsi/tgsi_parse.h" #include "nv40_context.h" -#include "nv40_state.h" +#include "nvfx_state.h" static void * nv40_blend_state_create(struct pipe_context *pipe, const struct pipe_blend_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nouveau_grobj *eng3d = nv40->screen->eng3d; - struct nv40_blend_state *bso = CALLOC(1, sizeof(*bso)); + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; + struct nvfx_blend_state *bso = CALLOC(1, sizeof(*bso)); struct nouveau_stateobj *so = so_new(5, 8, 0); if (cso->rt[0].blend_enable) { @@ -60,16 +60,16 @@ nv40_blend_state_create(struct pipe_context *pipe, static void nv40_blend_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->blend = hwcso; - nv40->dirty |= NV40_NEW_BLEND; + nvfx->blend = hwcso; + nvfx->dirty |= NVFX_NEW_BLEND; } static void nv40_blend_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_blend_state *bso = hwcso; + struct nvfx_blend_state *bso = hwcso; so_ref(NULL, &bso->so); FREE(bso); @@ -118,10 +118,10 @@ static void * nv40_sampler_state_create(struct pipe_context *pipe, const struct pipe_sampler_state *cso) { - struct nv40_sampler_state *ps; + struct nvfx_sampler_state *ps; uint32_t filter = 0; - ps = MALLOC(sizeof(struct nv40_sampler_state)); + ps = MALLOC(sizeof(struct nvfx_sampler_state)); ps->fmt = 0; if (!cso->normalized_coords) @@ -258,21 +258,21 @@ nv40_sampler_state_create(struct pipe_context *pipe, static void nv40_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { - nv40->tex_sampler[unit] = sampler[unit]; - nv40->dirty_samplers |= (1 << unit); + nvfx->tex_sampler[unit] = sampler[unit]; + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv40->nr_samplers; unit++) { - nv40->tex_sampler[unit] = NULL; - nv40->dirty_samplers |= (1 << unit); + for (unit = nr; unit < nvfx->nr_samplers; unit++) { + nvfx->tex_sampler[unit] = NULL; + nvfx->dirty_samplers |= (1 << unit); } - nv40->nr_samplers = nr; - nv40->dirty |= NV40_NEW_SAMPLER; + nvfx->nr_samplers = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void @@ -285,33 +285,33 @@ static void nv40_set_sampler_texture(struct pipe_context *pipe, unsigned nr, struct pipe_texture **miptree) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv40->tex_miptree[unit], miptree[unit]); - nv40->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], miptree[unit]); + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv40->nr_textures; unit++) { + for (unit = nr; unit < nvfx->nr_textures; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv40->tex_miptree[unit], NULL); - nv40->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], NULL); + nvfx->dirty_samplers |= (1 << unit); } - nv40->nr_textures = nr; - nv40->dirty |= NV40_NEW_SAMPLER; + nvfx->nr_textures = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void * nv40_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso)); + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso)); struct nouveau_stateobj *so = so_new(9, 19, 0); - struct nouveau_grobj *eng3d = nv40->screen->eng3d; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; /*XXX: ignored: * light_twoside @@ -423,17 +423,17 @@ nv40_rasterizer_state_create(struct pipe_context *pipe, static void nv40_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->rasterizer = hwcso; - nv40->dirty |= NV40_NEW_RAST; - nv40->draw_dirty |= NV40_NEW_RAST; + nvfx->rasterizer = hwcso; + nvfx->dirty |= NVFX_NEW_RAST; + nvfx->draw_dirty |= NVFX_NEW_RAST; } static void nv40_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_rasterizer_state *rsso = hwcso; + struct nvfx_rasterizer_state *rsso = hwcso; so_ref(NULL, &rsso->so); FREE(rsso); @@ -443,10 +443,10 @@ static void * nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe, const struct pipe_depth_stencil_alpha_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso)); + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso)); struct nouveau_stateobj *so = so_new(6, 20, 0); - struct nouveau_grobj *eng3d = nv40->screen->eng3d; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; so_method(so, eng3d, NV34TCL_DEPTH_FUNC, 3); so_data (so, nvgl_comparison_op(cso->depth.func)); @@ -497,16 +497,16 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe, static void nv40_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->zsa = hwcso; - nv40->dirty |= NV40_NEW_ZSA; + nvfx->zsa = hwcso; + nvfx->dirty |= NVFX_NEW_ZSA; } static void nv40_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_zsa_state *zsaso = hwcso; + struct nvfx_zsa_state *zsaso = hwcso; so_ref(NULL, &zsaso->so); FREE(zsaso); @@ -516,12 +516,12 @@ static void * nv40_vp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_vertex_program *vp; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp; - vp = CALLOC(1, sizeof(struct nv40_vertex_program)); + vp = CALLOC(1, sizeof(struct nvfx_vertex_program)); vp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - vp->draw = draw_create_vertex_shader(nv40->draw, &vp->pipe); + vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe); return (void *)vp; } @@ -529,21 +529,21 @@ nv40_vp_state_create(struct pipe_context *pipe, static void nv40_vp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->vertprog = hwcso; - nv40->dirty |= NV40_NEW_VERTPROG; - nv40->draw_dirty |= NV40_NEW_VERTPROG; + nvfx->vertprog = hwcso; + nvfx->dirty |= NVFX_NEW_VERTPROG; + nvfx->draw_dirty |= NVFX_NEW_VERTPROG; } static void nv40_vp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_vertex_program *vp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp = hwcso; - draw_delete_vertex_shader(nv40->draw, vp->draw); - nv40_vertprog_destroy(nv40, vp); + draw_delete_vertex_shader(nvfx->draw, vp->draw); + nv40_vertprog_destroy(nvfx, vp); FREE((void*)vp->pipe.tokens); FREE(vp); } @@ -552,9 +552,9 @@ static void * nv40_fp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - struct nv40_fragment_program *fp; + struct nvfx_fragment_program *fp; - fp = CALLOC(1, sizeof(struct nv40_fragment_program)); + fp = CALLOC(1, sizeof(struct nvfx_fragment_program)); fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); tgsi_scan_shader(fp->pipe.tokens, &fp->info); @@ -565,19 +565,19 @@ nv40_fp_state_create(struct pipe_context *pipe, static void nv40_fp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->fragprog = hwcso; - nv40->dirty |= NV40_NEW_FRAGPROG; + nvfx->fragprog = hwcso; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } static void nv40_fp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_fragment_program *fp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_fragment_program *fp = hwcso; - nv40_fragprog_destroy(nv40, fp); + nv40_fragprog_destroy(nvfx, fp); FREE((void*)fp->pipe.tokens); FREE(fp); } @@ -586,47 +586,47 @@ static void nv40_set_blend_color(struct pipe_context *pipe, const struct pipe_blend_color *bcol) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->blend_colour = *bcol; - nv40->dirty |= NV40_NEW_BCOL; + nvfx->blend_colour = *bcol; + nvfx->dirty |= NVFX_NEW_BCOL; } static void nv40_set_stencil_ref(struct pipe_context *pipe, const struct pipe_stencil_ref *sr) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->stencil_ref = *sr; - nv40->dirty |= NV40_NEW_SR; + nvfx->stencil_ref = *sr; + nvfx->dirty |= NVFX_NEW_SR; } static void nv40_set_clip_state(struct pipe_context *pipe, const struct pipe_clip_state *clip) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->clip = *clip; - nv40->dirty |= NV40_NEW_UCP; - nv40->draw_dirty |= NV40_NEW_UCP; + nvfx->clip = *clip; + nvfx->dirty |= NVFX_NEW_UCP; + nvfx->draw_dirty |= NVFX_NEW_UCP; } static void nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, struct pipe_buffer *buf ) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->constbuf[shader] = buf; - nv40->constbuf_nr[shader] = buf->size / (4 * sizeof(float)); + nvfx->constbuf[shader] = buf; + nvfx->constbuf_nr[shader] = buf->size / (4 * sizeof(float)); if (shader == PIPE_SHADER_VERTEX) { - nv40->dirty |= NV40_NEW_VERTPROG; + nvfx->dirty |= NVFX_NEW_VERTPROG; } else if (shader == PIPE_SHADER_FRAGMENT) { - nv40->dirty |= NV40_NEW_FRAGPROG; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } } @@ -634,54 +634,54 @@ static void nv40_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->framebuffer = *fb; - nv40->dirty |= NV40_NEW_FB; + nvfx->framebuffer = *fb; + nvfx->dirty |= NVFX_NEW_FB; } static void nv40_set_polygon_stipple(struct pipe_context *pipe, const struct pipe_poly_stipple *stipple) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv40->stipple, stipple->stipple, 4 * 32); - nv40->dirty |= NV40_NEW_STIPPLE; + memcpy(nvfx->stipple, stipple->stipple, 4 * 32); + nvfx->dirty |= NVFX_NEW_STIPPLE; } static void nv40_set_scissor_state(struct pipe_context *pipe, const struct pipe_scissor_state *s) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->scissor = *s; - nv40->dirty |= NV40_NEW_SCISSOR; + nvfx->scissor = *s; + nvfx->dirty |= NVFX_NEW_SCISSOR; } static void nv40_set_viewport_state(struct pipe_context *pipe, const struct pipe_viewport_state *vpt) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->viewport = *vpt; - nv40->dirty |= NV40_NEW_VIEWPORT; - nv40->draw_dirty |= NV40_NEW_VIEWPORT; + nvfx->viewport = *vpt; + nvfx->dirty |= NVFX_NEW_VIEWPORT; + nvfx->draw_dirty |= NVFX_NEW_VIEWPORT; } static void nv40_set_vertex_buffers(struct pipe_context *pipe, unsigned count, const struct pipe_vertex_buffer *vb) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv40->vtxbuf, vb, sizeof(*vb) * count); - nv40->vtxbuf_nr = count; + memcpy(nvfx->vtxbuf, vb, sizeof(*vb) * count); + nvfx->vtxbuf_nr = count; - nv40->dirty |= NV40_NEW_ARRAYS; - nv40->draw_dirty |= NV40_NEW_ARRAYS; + nvfx->dirty |= NVFX_NEW_ARRAYS; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; } static void * @@ -689,7 +689,7 @@ nv40_vtxelts_state_create(struct pipe_context *pipe, unsigned num_elements, const struct pipe_vertex_element *elements) { - struct nv40_vtxelt_state *cso = CALLOC_STRUCT(nv40_vtxelt_state); + struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state); assert(num_elements < 16); /* not doing fallbacks yet */ cso->num_elements = num_elements; @@ -709,57 +709,57 @@ nv40_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso) static void nv40_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->vtxelt = hwcso; - nv40->dirty |= NV40_NEW_ARRAYS; - nv40->draw_dirty |= NV40_NEW_ARRAYS; + nvfx->vtxelt = hwcso; + nvfx->dirty |= NVFX_NEW_ARRAYS; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; } void -nv40_init_state_functions(struct nv40_context *nv40) +nv40_init_state_functions(struct nvfx_context *nvfx) { - nv40->pipe.create_blend_state = nv40_blend_state_create; - nv40->pipe.bind_blend_state = nv40_blend_state_bind; - nv40->pipe.delete_blend_state = nv40_blend_state_delete; + nvfx->pipe.create_blend_state = nv40_blend_state_create; + nvfx->pipe.bind_blend_state = nv40_blend_state_bind; + nvfx->pipe.delete_blend_state = nv40_blend_state_delete; - nv40->pipe.create_sampler_state = nv40_sampler_state_create; - nv40->pipe.bind_fragment_sampler_states = nv40_sampler_state_bind; - nv40->pipe.delete_sampler_state = nv40_sampler_state_delete; - nv40->pipe.set_fragment_sampler_textures = nv40_set_sampler_texture; + nvfx->pipe.create_sampler_state = nv40_sampler_state_create; + nvfx->pipe.bind_fragment_sampler_states = nv40_sampler_state_bind; + nvfx->pipe.delete_sampler_state = nv40_sampler_state_delete; + nvfx->pipe.set_fragment_sampler_textures = nv40_set_sampler_texture; - nv40->pipe.create_rasterizer_state = nv40_rasterizer_state_create; - nv40->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind; - nv40->pipe.delete_rasterizer_state = nv40_rasterizer_state_delete; + nvfx->pipe.create_rasterizer_state = nv40_rasterizer_state_create; + nvfx->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind; + nvfx->pipe.delete_rasterizer_state = nv40_rasterizer_state_delete; - nv40->pipe.create_depth_stencil_alpha_state = + nvfx->pipe.create_depth_stencil_alpha_state = nv40_depth_stencil_alpha_state_create; - nv40->pipe.bind_depth_stencil_alpha_state = + nvfx->pipe.bind_depth_stencil_alpha_state = nv40_depth_stencil_alpha_state_bind; - nv40->pipe.delete_depth_stencil_alpha_state = + nvfx->pipe.delete_depth_stencil_alpha_state = nv40_depth_stencil_alpha_state_delete; - nv40->pipe.create_vs_state = nv40_vp_state_create; - nv40->pipe.bind_vs_state = nv40_vp_state_bind; - nv40->pipe.delete_vs_state = nv40_vp_state_delete; + nvfx->pipe.create_vs_state = nv40_vp_state_create; + nvfx->pipe.bind_vs_state = nv40_vp_state_bind; + nvfx->pipe.delete_vs_state = nv40_vp_state_delete; - nv40->pipe.create_fs_state = nv40_fp_state_create; - nv40->pipe.bind_fs_state = nv40_fp_state_bind; - nv40->pipe.delete_fs_state = nv40_fp_state_delete; + nvfx->pipe.create_fs_state = nv40_fp_state_create; + nvfx->pipe.bind_fs_state = nv40_fp_state_bind; + nvfx->pipe.delete_fs_state = nv40_fp_state_delete; - nv40->pipe.set_blend_color = nv40_set_blend_color; - nv40->pipe.set_stencil_ref = nv40_set_stencil_ref; - nv40->pipe.set_clip_state = nv40_set_clip_state; - nv40->pipe.set_constant_buffer = nv40_set_constant_buffer; - nv40->pipe.set_framebuffer_state = nv40_set_framebuffer_state; - nv40->pipe.set_polygon_stipple = nv40_set_polygon_stipple; - nv40->pipe.set_scissor_state = nv40_set_scissor_state; - nv40->pipe.set_viewport_state = nv40_set_viewport_state; + nvfx->pipe.set_blend_color = nv40_set_blend_color; + nvfx->pipe.set_stencil_ref = nv40_set_stencil_ref; + nvfx->pipe.set_clip_state = nv40_set_clip_state; + nvfx->pipe.set_constant_buffer = nv40_set_constant_buffer; + nvfx->pipe.set_framebuffer_state = nv40_set_framebuffer_state; + nvfx->pipe.set_polygon_stipple = nv40_set_polygon_stipple; + nvfx->pipe.set_scissor_state = nv40_set_scissor_state; + nvfx->pipe.set_viewport_state = nv40_set_viewport_state; - nv40->pipe.create_vertex_elements_state = nv40_vtxelts_state_create; - nv40->pipe.delete_vertex_elements_state = nv40_vtxelts_state_delete; - nv40->pipe.bind_vertex_elements_state = nv40_vtxelts_state_bind; + nvfx->pipe.create_vertex_elements_state = nv40_vtxelts_state_create; + nvfx->pipe.delete_vertex_elements_state = nv40_vtxelts_state_delete; + nvfx->pipe.bind_vertex_elements_state = nv40_vtxelts_state_bind; - nv40->pipe.set_vertex_buffers = nv40_set_vertex_buffers; + nvfx->pipe.set_vertex_buffers = nv40_set_vertex_buffers; } diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nv40/nv40_state.h deleted file mode 100644 index e2e69420eae..00000000000 --- a/src/gallium/drivers/nv40/nv40_state.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __NV40_STATE_H__ -#define __NV40_STATE_H__ - -#include "pipe/p_state.h" -#include "tgsi/tgsi_scan.h" - -struct nv40_sampler_state { - uint32_t fmt; - uint32_t wrap; - uint32_t en; - uint32_t filt; - uint32_t bcol; -}; - -struct nv40_vertex_program_exec { - uint32_t data[4]; - boolean has_branch_offset; - int const_index; -}; - -struct nv40_vertex_program_data { - int index; /* immediates == -1 */ - float value[4]; -}; - -struct nv40_vertex_program { - struct pipe_shader_state pipe; - - struct draw_vertex_shader *draw; - - boolean translated; - - struct pipe_clip_state ucp; - - struct nv40_vertex_program_exec *insns; - unsigned nr_insns; - struct nv40_vertex_program_data *consts; - unsigned nr_consts; - - struct nouveau_resource *exec; - unsigned exec_start; - struct nouveau_resource *data; - unsigned data_start; - unsigned data_start_min; - - uint32_t ir; - uint32_t or; - uint32_t clip_ctrl; - struct nouveau_stateobj *so; -}; - -struct nv40_fragment_program_data { - unsigned offset; - unsigned index; -}; - -struct nv40_fragment_program { - struct pipe_shader_state pipe; - struct tgsi_shader_info info; - - boolean translated; - unsigned samplers; - - uint32_t *insn; - int insn_len; - - struct nv40_fragment_program_data *consts; - unsigned nr_consts; - - struct pipe_buffer *buffer; - - uint32_t fp_control; - struct nouveau_stateobj *so; -}; - -#define NV40_MAX_TEXTURE_LEVELS 16 - -struct nv40_miptree { - struct pipe_texture base; - struct nouveau_bo *bo; - - struct pipe_buffer *buffer; - uint total_size; - - struct { - uint pitch; - uint *image_offset; - } level[NV40_MAX_TEXTURE_LEVELS]; -}; - -#endif diff --git a/src/gallium/drivers/nv40/nv40_state_blend.c b/src/gallium/drivers/nv40/nv40_state_blend.c index 83202ec23c0..bb06b4888da 100644 --- a/src/gallium/drivers/nv40/nv40_state_blend.c +++ b/src/gallium/drivers/nv40/nv40_state_blend.c @@ -1,41 +1,41 @@ #include "nv40_context.h" static boolean -nv40_state_blend_validate(struct nv40_context *nv40) +nv40_state_blend_validate(struct nvfx_context *nvfx) { - so_ref(nv40->blend->so, &nv40->state.hw[NV40_STATE_BLEND]); + so_ref(nvfx->blend->so, &nvfx->state.hw[NVFX_STATE_BLEND]); return TRUE; } -struct nv40_state_entry nv40_state_blend = { +struct nvfx_state_entry nv40_state_blend = { .validate = nv40_state_blend_validate, .dirty = { - .pipe = NV40_NEW_BLEND, - .hw = NV40_STATE_BLEND + .pipe = NVFX_NEW_BLEND, + .hw = NVFX_STATE_BLEND } }; static boolean -nv40_state_blend_colour_validate(struct nv40_context *nv40) +nv40_state_blend_colour_validate(struct nvfx_context *nvfx) { struct nouveau_stateobj *so = so_new(1, 1, 0); - struct pipe_blend_color *bcol = &nv40->blend_colour; + struct pipe_blend_color *bcol = &nvfx->blend_colour; - so_method(so, nv40->screen->eng3d, NV34TCL_BLEND_COLOR, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_BLEND_COLOR, 1); so_data (so, ((float_to_ubyte(bcol->color[3]) << 24) | (float_to_ubyte(bcol->color[0]) << 16) | (float_to_ubyte(bcol->color[1]) << 8) | (float_to_ubyte(bcol->color[2]) << 0))); - so_ref(so, &nv40->state.hw[NV40_STATE_BCOL]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_BCOL]); so_ref(NULL, &so); return TRUE; } -struct nv40_state_entry nv40_state_blend_colour = { +struct nvfx_state_entry nv40_state_blend_colour = { .validate = nv40_state_blend_colour_validate, .dirty = { - .pipe = NV40_NEW_BCOL, - .hw = NV40_STATE_BCOL + .pipe = NVFX_NEW_BCOL, + .hw = NVFX_STATE_BCOL } }; diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c index 6ad7a8d4fd2..5c437f9969b 100644 --- a/src/gallium/drivers/nv40/nv40_state_emit.c +++ b/src/gallium/drivers/nv40/nv40_state_emit.c @@ -1,8 +1,8 @@ #include "nv40_context.h" -#include "nv40_state.h" +#include "nvfx_state.h" #include "draw/draw_context.h" -static struct nv40_state_entry *render_states[] = { +static struct nvfx_state_entry *render_states[] = { &nv40_state_framebuffer, &nv40_state_rasterizer, &nv40_state_scissor, @@ -19,7 +19,7 @@ static struct nv40_state_entry *render_states[] = { NULL }; -static struct nv40_state_entry *swtnl_states[] = { +static struct nvfx_state_entry *swtnl_states[] = { &nv40_state_framebuffer, &nv40_state_rasterizer, &nv40_state_scissor, @@ -37,27 +37,27 @@ static struct nv40_state_entry *swtnl_states[] = { }; static void -nv40_state_do_validate(struct nv40_context *nv40, - struct nv40_state_entry **states) +nv40_state_do_validate(struct nvfx_context *nvfx, + struct nvfx_state_entry **states) { while (*states) { - struct nv40_state_entry *e = *states; + struct nvfx_state_entry *e = *states; - if (nv40->dirty & e->dirty.pipe) { - if (e->validate(nv40)) - nv40->state.dirty |= (1ULL << e->dirty.hw); + if (nvfx->dirty & e->dirty.pipe) { + if (e->validate(nvfx)) + nvfx->state.dirty |= (1ULL << e->dirty.hw); } states++; } - nv40->dirty = 0; + nvfx->dirty = 0; } void -nv40_state_emit(struct nv40_context *nv40) +nv40_state_emit(struct nvfx_context *nvfx) { - struct nv40_state *state = &nv40->state; - struct nv40_screen *screen = nv40->screen; + struct nvfx_state *state = &nvfx->state; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; unsigned i; @@ -65,26 +65,26 @@ nv40_state_emit(struct nv40_context *nv40) /* XXX: race conditions */ - if (nv40 != screen->cur_ctx) { - for (i = 0; i < NV40_STATE_MAX; i++) { + if (nvfx != screen->cur_ctx) { + for (i = 0; i < NVFX_STATE_MAX; i++) { if (state->hw[i] && screen->state[i] != state->hw[i]) state->dirty |= (1ULL << i); } - screen->cur_ctx = nv40; + screen->cur_ctx = nvfx; } for (i = 0, states = state->dirty; states; i++) { if (!(states & (1ULL << i))) continue; - so_ref (state->hw[i], &nv40->screen->state[i]); + so_ref (state->hw[i], &nvfx->screen->state[i]); if (state->hw[i]) - so_emit(chan, nv40->screen->state[i]); + so_emit(chan, nvfx->screen->state[i]); states &= ~(1ULL << i); } - if (state->dirty & ((1ULL << NV40_STATE_FRAGPROG) | - (1ULL << NV40_STATE_FRAGTEX0))) { + if (state->dirty & ((1ULL << NVFX_STATE_FRAGPROG) | + (1ULL << NVFX_STATE_FRAGTEX0))) { BEGIN_RING(chan, eng3d, NV40TCL_TEX_CACHE_CTL, 1); OUT_RING (chan, 2); BEGIN_RING(chan, eng3d, NV40TCL_TEX_CACHE_CTL, 1); @@ -97,46 +97,46 @@ nv40_state_emit(struct nv40_context *nv40) void nv40_state_flush_notify(struct nouveau_channel *chan) { - struct nv40_context *nv40 = chan->user_private; - struct nv40_state *state = &nv40->state; + struct nvfx_context *nvfx = chan->user_private; + struct nvfx_state *state = &nvfx->state; unsigned i, samplers; - so_emit_reloc_markers(chan, state->hw[NV40_STATE_FB]); + so_emit_reloc_markers(chan, state->hw[NVFX_STATE_FB]); for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) { if (!(samplers & (1 << i))) continue; so_emit_reloc_markers(chan, - state->hw[NV40_STATE_FRAGTEX0+i]); + state->hw[NVFX_STATE_FRAGTEX0+i]); samplers &= ~(1ULL << i); } - so_emit_reloc_markers(chan, state->hw[NV40_STATE_FRAGPROG]); - if (state->hw[NV40_STATE_VTXBUF] && nv40->render_mode == HW) - so_emit_reloc_markers(chan, state->hw[NV40_STATE_VTXBUF]); + so_emit_reloc_markers(chan, state->hw[NVFX_STATE_FRAGPROG]); + if (state->hw[NVFX_STATE_VTXBUF] && nvfx->render_mode == HW) + so_emit_reloc_markers(chan, state->hw[NVFX_STATE_VTXBUF]); } boolean -nv40_state_validate(struct nv40_context *nv40) +nv40_state_validate(struct nvfx_context *nvfx) { - boolean was_sw = nv40->fallback_swtnl ? TRUE : FALSE; + boolean was_sw = nvfx->fallback_swtnl ? TRUE : FALSE; - if (nv40->render_mode != HW) { + if (nvfx->render_mode != HW) { /* Don't even bother trying to go back to hw if none * of the states that caused swtnl previously have changed. */ - if ((nv40->fallback_swtnl & nv40->dirty) - != nv40->fallback_swtnl) + if ((nvfx->fallback_swtnl & nvfx->dirty) + != nvfx->fallback_swtnl) return FALSE; /* Attempt to go to hwtnl again */ - nv40->pipe.flush(&nv40->pipe, 0, NULL); - nv40->dirty |= (NV40_NEW_VIEWPORT | - NV40_NEW_VERTPROG | - NV40_NEW_ARRAYS); - nv40->render_mode = HW; + nvfx->pipe.flush(&nvfx->pipe, 0, NULL); + nvfx->dirty |= (NVFX_NEW_VIEWPORT | + NVFX_NEW_VERTPROG | + NVFX_NEW_ARRAYS); + nvfx->render_mode = HW; } - nv40_state_do_validate(nv40, render_states); - if (nv40->fallback_swtnl || nv40->fallback_swrast) + nv40_state_do_validate(nvfx, render_states); + if (nvfx->fallback_swtnl || nvfx->fallback_swrast) return FALSE; if (was_sw) @@ -146,44 +146,44 @@ nv40_state_validate(struct nv40_context *nv40) } boolean -nv40_state_validate_swtnl(struct nv40_context *nv40) +nv40_state_validate_swtnl(struct nvfx_context *nvfx) { - struct draw_context *draw = nv40->draw; + struct draw_context *draw = nvfx->draw; /* Setup for swtnl */ - if (nv40->render_mode == HW) { - NOUVEAU_ERR("hw->swtnl 0x%08x\n", nv40->fallback_swtnl); - nv40->pipe.flush(&nv40->pipe, 0, NULL); - nv40->dirty |= (NV40_NEW_VIEWPORT | - NV40_NEW_VERTPROG | - NV40_NEW_ARRAYS); - nv40->render_mode = SWTNL; + if (nvfx->render_mode == HW) { + NOUVEAU_ERR("hw->swtnl 0x%08x\n", nvfx->fallback_swtnl); + nvfx->pipe.flush(&nvfx->pipe, 0, NULL); + nvfx->dirty |= (NVFX_NEW_VIEWPORT | + NVFX_NEW_VERTPROG | + NVFX_NEW_ARRAYS); + nvfx->render_mode = SWTNL; } - if (nv40->draw_dirty & NV40_NEW_VERTPROG) - draw_bind_vertex_shader(draw, nv40->vertprog->draw); + if (nvfx->draw_dirty & NVFX_NEW_VERTPROG) + draw_bind_vertex_shader(draw, nvfx->vertprog->draw); - if (nv40->draw_dirty & NV40_NEW_RAST) - draw_set_rasterizer_state(draw, &nv40->rasterizer->pipe); + if (nvfx->draw_dirty & NVFX_NEW_RAST) + draw_set_rasterizer_state(draw, &nvfx->rasterizer->pipe); - if (nv40->draw_dirty & NV40_NEW_UCP) - draw_set_clip_state(draw, &nv40->clip); + if (nvfx->draw_dirty & NVFX_NEW_UCP) + draw_set_clip_state(draw, &nvfx->clip); - if (nv40->draw_dirty & NV40_NEW_VIEWPORT) - draw_set_viewport_state(draw, &nv40->viewport); + if (nvfx->draw_dirty & NVFX_NEW_VIEWPORT) + draw_set_viewport_state(draw, &nvfx->viewport); - if (nv40->draw_dirty & NV40_NEW_ARRAYS) { - draw_set_vertex_buffers(draw, nv40->vtxbuf_nr, nv40->vtxbuf); - draw_set_vertex_elements(draw, nv40->vtxelt->num_elements, nv40->vtxelt->pipe); + if (nvfx->draw_dirty & NVFX_NEW_ARRAYS) { + draw_set_vertex_buffers(draw, nvfx->vtxbuf_nr, nvfx->vtxbuf); + draw_set_vertex_elements(draw, nvfx->vtxelt->num_elements, nvfx->vtxelt->pipe); } - nv40_state_do_validate(nv40, swtnl_states); - if (nv40->fallback_swrast) { - NOUVEAU_ERR("swtnl->swrast 0x%08x\n", nv40->fallback_swrast); + nv40_state_do_validate(nvfx, swtnl_states); + if (nvfx->fallback_swrast) { + NOUVEAU_ERR("swtnl->swrast 0x%08x\n", nvfx->fallback_swrast); return FALSE; } - nv40->draw_dirty = 0; + nvfx->draw_dirty = 0; return TRUE; } diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c index 207b70923e7..95735e40a38 100644 --- a/src/gallium/drivers/nv40/nv40_state_fb.c +++ b/src/gallium/drivers/nv40/nv40_state_fb.c @@ -4,18 +4,18 @@ static struct pipe_buffer * nv40_do_surface_buffer(struct pipe_surface *surface) { - struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture; + struct nvfx_miptree *mt = (struct nvfx_miptree *)surface->texture; return mt->buffer; } #define nv40_surface_buffer(ps) nouveau_bo(nv40_do_surface_buffer(ps)) static boolean -nv40_state_framebuffer_validate(struct nv40_context *nv40) +nv40_state_framebuffer_validate(struct nvfx_context *nvfx) { - struct nouveau_channel *chan = nv40->screen->base.channel; - struct nouveau_grobj *eng3d = nv40->screen->eng3d; - struct pipe_framebuffer_state *fb = &nv40->framebuffer; + struct nouveau_channel *chan = nvfx->screen->base.channel; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; + struct pipe_framebuffer_state *fb = &nvfx->framebuffer; struct nv04_surface *rt[4], *zeta; uint32_t rt_enable, rt_format; int i, colour_format = 0, zeta_format = 0; @@ -161,15 +161,15 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40) so_method(so, eng3d, 0x1d88, 1); so_data (so, (1 << 12) | h); - so_ref(so, &nv40->state.hw[NV40_STATE_FB]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_FB]); so_ref(NULL, &so); return TRUE; } -struct nv40_state_entry nv40_state_framebuffer = { +struct nvfx_state_entry nv40_state_framebuffer = { .validate = nv40_state_framebuffer_validate, .dirty = { - .pipe = NV40_NEW_FB, - .hw = NV40_STATE_FB + .pipe = NVFX_NEW_FB, + .hw = NVFX_STATE_FB } }; diff --git a/src/gallium/drivers/nv40/nv40_state_rasterizer.c b/src/gallium/drivers/nv40/nv40_state_rasterizer.c index 9ecda5990f0..d6136a26ebe 100644 --- a/src/gallium/drivers/nv40/nv40_state_rasterizer.c +++ b/src/gallium/drivers/nv40/nv40_state_rasterizer.c @@ -1,17 +1,17 @@ #include "nv40_context.h" static boolean -nv40_state_rasterizer_validate(struct nv40_context *nv40) +nv40_state_rasterizer_validate(struct nvfx_context *nvfx) { - so_ref(nv40->rasterizer->so, - &nv40->state.hw[NV40_STATE_RAST]); + so_ref(nvfx->rasterizer->so, + &nvfx->state.hw[NVFX_STATE_RAST]); return TRUE; } -struct nv40_state_entry nv40_state_rasterizer = { +struct nvfx_state_entry nv40_state_rasterizer = { .validate = nv40_state_rasterizer_validate, .dirty = { - .pipe = NV40_NEW_RAST, - .hw = NV40_STATE_RAST + .pipe = NVFX_NEW_RAST, + .hw = NVFX_STATE_RAST } }; diff --git a/src/gallium/drivers/nv40/nv40_state_scissor.c b/src/gallium/drivers/nv40/nv40_state_scissor.c index dcb068d0596..11ec5c0878b 100644 --- a/src/gallium/drivers/nv40/nv40_state_scissor.c +++ b/src/gallium/drivers/nv40/nv40_state_scissor.c @@ -1,20 +1,20 @@ #include "nv40_context.h" static boolean -nv40_state_scissor_validate(struct nv40_context *nv40) +nv40_state_scissor_validate(struct nvfx_context *nvfx) { - struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe; - struct pipe_scissor_state *s = &nv40->scissor; + struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe; + struct pipe_scissor_state *s = &nvfx->scissor; struct nouveau_stateobj *so; - if (nv40->state.hw[NV40_STATE_SCISSOR] && - (rast->scissor == 0 && nv40->state.scissor_enabled == 0)) + if (nvfx->state.hw[NVFX_STATE_SCISSOR] && + (rast->scissor == 0 && nvfx->state.scissor_enabled == 0)) return FALSE; - nv40->state.scissor_enabled = rast->scissor; + nvfx->state.scissor_enabled = rast->scissor; so = so_new(1, 2, 0); - so_method(so, nv40->screen->eng3d, NV34TCL_SCISSOR_HORIZ, 2); - if (nv40->state.scissor_enabled) { + so_method(so, nvfx->screen->eng3d, NV34TCL_SCISSOR_HORIZ, 2); + if (nvfx->state.scissor_enabled) { so_data (so, ((s->maxx - s->minx) << 16) | s->minx); so_data (so, ((s->maxy - s->miny) << 16) | s->miny); } else { @@ -22,15 +22,15 @@ nv40_state_scissor_validate(struct nv40_context *nv40) so_data (so, 4096 << 16); } - so_ref(so, &nv40->state.hw[NV40_STATE_SCISSOR]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_SCISSOR]); so_ref(NULL, &so); return TRUE; } -struct nv40_state_entry nv40_state_scissor = { +struct nvfx_state_entry nv40_state_scissor = { .validate = nv40_state_scissor_validate, .dirty = { - .pipe = NV40_NEW_SCISSOR | NV40_NEW_RAST, - .hw = NV40_STATE_SCISSOR + .pipe = NVFX_NEW_SCISSOR | NVFX_NEW_RAST, + .hw = NVFX_STATE_SCISSOR } }; diff --git a/src/gallium/drivers/nv40/nv40_state_stipple.c b/src/gallium/drivers/nv40/nv40_state_stipple.c index 4514618772a..e537e08e1d2 100644 --- a/src/gallium/drivers/nv40/nv40_state_stipple.c +++ b/src/gallium/drivers/nv40/nv40_state_stipple.c @@ -1,14 +1,14 @@ #include "nv40_context.h" static boolean -nv40_state_stipple_validate(struct nv40_context *nv40) +nv40_state_stipple_validate(struct nvfx_context *nvfx) { - struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe; - struct nouveau_grobj *eng3d = nv40->screen->eng3d; + struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; struct nouveau_stateobj *so; - if (nv40->state.hw[NV40_STATE_STIPPLE] && - (rast->poly_stipple_enable == 0 && nv40->state.stipple_enabled == 0)) + if (nvfx->state.hw[NVFX_STATE_STIPPLE] && + (rast->poly_stipple_enable == 0 && nvfx->state.stipple_enabled == 0)) return FALSE; if (rast->poly_stipple_enable) { @@ -19,21 +19,21 @@ nv40_state_stipple_validate(struct nv40_context *nv40) so_data (so, 1); so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_PATTERN(0), 32); for (i = 0; i < 32; i++) - so_data(so, nv40->stipple[i]); + so_data(so, nvfx->stipple[i]); } else { so = so_new(1, 1, 0); so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_ENABLE, 1); so_data (so, 0); } - so_ref(so, &nv40->state.hw[NV40_STATE_STIPPLE]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_STIPPLE]); return TRUE; } -struct nv40_state_entry nv40_state_stipple = { +struct nvfx_state_entry nv40_state_stipple = { .validate = nv40_state_stipple_validate, .dirty = { - .pipe = NV40_NEW_STIPPLE | NV40_NEW_RAST, - .hw = NV40_STATE_STIPPLE, + .pipe = NVFX_NEW_STIPPLE | NVFX_NEW_RAST, + .hw = NVFX_STATE_STIPPLE, } }; diff --git a/src/gallium/drivers/nv40/nv40_state_viewport.c b/src/gallium/drivers/nv40/nv40_state_viewport.c index 43cf6e5a0ad..bf73e1119e6 100644 --- a/src/gallium/drivers/nv40/nv40_state_viewport.c +++ b/src/gallium/drivers/nv40/nv40_state_viewport.c @@ -1,17 +1,17 @@ #include "nv40_context.h" static boolean -nv40_state_viewport_validate(struct nv40_context *nv40) +nv40_state_viewport_validate(struct nvfx_context *nvfx) { - struct pipe_viewport_state *vpt = &nv40->viewport; + struct pipe_viewport_state *vpt = &nvfx->viewport; struct nouveau_stateobj *so; - if (nv40->state.hw[NV40_STATE_VIEWPORT] && - !(nv40->dirty & NV40_NEW_VIEWPORT)) + if (nvfx->state.hw[NVFX_STATE_VIEWPORT] && + !(nvfx->dirty & NVFX_NEW_VIEWPORT)) return FALSE; so = so_new(2, 9, 0); - so_method(so, nv40->screen->eng3d, + so_method(so, nvfx->screen->eng3d, NV34TCL_VIEWPORT_TRANSLATE_X, 8); so_data (so, fui(vpt->translate[0])); so_data (so, fui(vpt->translate[1])); @@ -21,18 +21,18 @@ nv40_state_viewport_validate(struct nv40_context *nv40) so_data (so, fui(vpt->scale[1])); so_data (so, fui(vpt->scale[2])); so_data (so, fui(vpt->scale[3])); - so_method(so, nv40->screen->eng3d, 0x1d78, 1); + so_method(so, nvfx->screen->eng3d, 0x1d78, 1); so_data (so, 1); - so_ref(so, &nv40->state.hw[NV40_STATE_VIEWPORT]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_VIEWPORT]); so_ref(NULL, &so); return TRUE; } -struct nv40_state_entry nv40_state_viewport = { +struct nvfx_state_entry nv40_state_viewport = { .validate = nv40_state_viewport_validate, .dirty = { - .pipe = NV40_NEW_VIEWPORT | NV40_NEW_RAST, - .hw = NV40_STATE_VIEWPORT + .pipe = NVFX_NEW_VIEWPORT | NVFX_NEW_RAST, + .hw = NVFX_STATE_VIEWPORT } }; diff --git a/src/gallium/drivers/nv40/nv40_state_zsa.c b/src/gallium/drivers/nv40/nv40_state_zsa.c index cb56948a1bf..00facd520af 100644 --- a/src/gallium/drivers/nv40/nv40_state_zsa.c +++ b/src/gallium/drivers/nv40/nv40_state_zsa.c @@ -1,41 +1,41 @@ #include "nv40_context.h" static boolean -nv40_state_zsa_validate(struct nv40_context *nv40) +nv40_state_zsa_validate(struct nvfx_context *nvfx) { - so_ref(nv40->zsa->so, - &nv40->state.hw[NV40_STATE_ZSA]); + so_ref(nvfx->zsa->so, + &nvfx->state.hw[NVFX_STATE_ZSA]); return TRUE; } -struct nv40_state_entry nv40_state_zsa = { +struct nvfx_state_entry nv40_state_zsa = { .validate = nv40_state_zsa_validate, .dirty = { - .pipe = NV40_NEW_ZSA, - .hw = NV40_STATE_ZSA + .pipe = NVFX_NEW_ZSA, + .hw = NVFX_STATE_ZSA } }; static boolean -nv40_state_sr_validate(struct nv40_context *nv40) +nv40_state_sr_validate(struct nvfx_context *nvfx) { struct nouveau_stateobj *so = so_new(2, 2, 0); - struct pipe_stencil_ref *sr = &nv40->stencil_ref; + struct pipe_stencil_ref *sr = &nvfx->stencil_ref; - so_method(so, nv40->screen->eng3d, NV34TCL_STENCIL_FRONT_FUNC_REF, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_STENCIL_FRONT_FUNC_REF, 1); so_data (so, sr->ref_value[0]); - so_method(so, nv40->screen->eng3d, NV34TCL_STENCIL_BACK_FUNC_REF, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_STENCIL_BACK_FUNC_REF, 1); so_data (so, sr->ref_value[1]); - so_ref(so, &nv40->state.hw[NV40_STATE_SR]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_SR]); so_ref(NULL, &so); return TRUE; } -struct nv40_state_entry nv40_state_sr = { +struct nvfx_state_entry nv40_state_sr = { .validate = nv40_state_sr_validate, .dirty = { - .pipe = NV40_NEW_SR, - .hw = NV40_STATE_SR + .pipe = NVFX_NEW_SR, + .hw = NVFX_STATE_SR } }; diff --git a/src/gallium/drivers/nv40/nv40_surface.c b/src/gallium/drivers/nv40/nv40_surface.c index 02ecfd7bbb7..328c23b8b4f 100644 --- a/src/gallium/drivers/nv40/nv40_surface.c +++ b/src/gallium/drivers/nv40/nv40_surface.c @@ -39,8 +39,8 @@ nv40_surface_copy(struct pipe_context *pipe, struct pipe_surface *src, unsigned srcx, unsigned srcy, unsigned width, unsigned height) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv04_surface_2d *eng2d = nv40->screen->eng2d; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height); } @@ -50,15 +50,15 @@ nv40_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest, unsigned destx, unsigned desty, unsigned width, unsigned height, unsigned value) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv04_surface_2d *eng2d = nv40->screen->eng2d; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; eng2d->fill(eng2d, dest, destx, desty, width, height, value); } void -nv40_init_surface_functions(struct nv40_context *nv40) +nv40_init_surface_functions(struct nvfx_context *nvfx) { - nv40->pipe.surface_copy = nv40_surface_copy; - nv40->pipe.surface_fill = nv40_surface_fill; + nvfx->pipe.surface_copy = nv40_surface_copy; + nvfx->pipe.surface_fill = nv40_surface_fill; } diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index c552a681138..3d8c8e8c78a 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -6,8 +6,8 @@ #include "util/u_math.h" #include "nouveau/nouveau_winsys.h" #include "nv40_context.h" -#include "nv40_screen.h" -#include "nv40_state.h" +#include "nvfx_screen.h" +#include "nvfx_state.h" struct nv40_transfer { struct pipe_transfer base; @@ -39,7 +39,7 @@ nv40_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, unsigned x, unsigned y, unsigned w, unsigned h) { struct pipe_screen *pscreen = pcontext->screen; - struct nv40_miptree *mt = (struct nv40_miptree *)pt; + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; struct nv40_transfer *tx; struct pipe_texture tx_tex_template, *tx_tex; @@ -81,7 +81,7 @@ nv40_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, return NULL; } - tx->base.stride = ((struct nv40_miptree*)tx_tex)->level[0].pitch; + tx->base.stride = ((struct nvfx_miptree*)tx_tex)->level[0].pitch; tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, 0, 0, 0, @@ -97,7 +97,7 @@ nv40_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, } if (usage & PIPE_TRANSFER_READ) { - struct nv40_screen *nvscreen = nv40_screen(pscreen); + struct nvfx_screen *nvscreen = nvfx_screen(pscreen); struct pipe_surface *src; src = pscreen->get_tex_surface(pscreen, pt, @@ -124,7 +124,7 @@ nv40_transfer_del(struct pipe_context *pcontext, struct pipe_transfer *ptx) if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = pcontext->screen; - struct nv40_screen *nvscreen = nv40_screen(pscreen); + struct nvfx_screen *nvscreen = nvfx_screen(pscreen); struct pipe_surface *dst; dst = pscreen->get_tex_surface(pscreen, ptx->texture, @@ -151,7 +151,7 @@ nv40_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) struct pipe_screen *pscreen = pcontext->screen; struct nv40_transfer *tx = (struct nv40_transfer *)ptx; struct nv04_surface *ns = (struct nv04_surface *)tx->surface; - struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture; + struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; void *map = pipe_buffer_map(pscreen, mt->buffer, pipe_transfer_buffer_flags(ptx)); @@ -166,16 +166,16 @@ nv40_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx) { struct pipe_screen *pscreen = pcontext->screen; struct nv40_transfer *tx = (struct nv40_transfer *)ptx; - struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture; + struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; pipe_buffer_unmap(pscreen, mt->buffer); } void -nv40_init_transfer_functions(struct nv40_context *nv40) +nv40_init_transfer_functions(struct nvfx_context *nvfx) { - nv40->pipe.get_tex_transfer = nv40_transfer_new; - nv40->pipe.tex_transfer_destroy = nv40_transfer_del; - nv40->pipe.transfer_map = nv40_transfer_map; - nv40->pipe.transfer_unmap = nv40_transfer_unmap; + nvfx->pipe.get_tex_transfer = nv40_transfer_new; + nvfx->pipe.tex_transfer_destroy = nv40_transfer_del; + nvfx->pipe.transfer_map = nv40_transfer_map; + nvfx->pipe.transfer_unmap = nv40_transfer_unmap; } diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c index b77c9e924bd..0738d5c93b4 100644 --- a/src/gallium/drivers/nv40/nv40_vbo.c +++ b/src/gallium/drivers/nv40/nv40_vbo.c @@ -4,7 +4,7 @@ #include "util/u_format.h" #include "nv40_context.h" -#include "nv40_state.h" +#include "nvfx_state.h" #include "nouveau/nouveau_channel.h" #include "nouveau/nouveau_pushbuf.h" @@ -69,15 +69,15 @@ nv40_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp) } static boolean -nv40_vbo_set_idxbuf(struct nv40_context *nv40, struct pipe_buffer *ib, +nv40_vbo_set_idxbuf(struct nvfx_context *nvfx, struct pipe_buffer *ib, unsigned ib_size) { - struct pipe_screen *pscreen = &nv40->screen->base.base; + struct pipe_screen *pscreen = &nvfx->screen->base.base; unsigned type; if (!ib) { - nv40->idxbuf = NULL; - nv40->idxbuf_format = 0xdeadbeef; + nvfx->idxbuf = NULL; + nvfx->idxbuf_format = 0xdeadbeef; return FALSE; } @@ -95,23 +95,23 @@ nv40_vbo_set_idxbuf(struct nv40_context *nv40, struct pipe_buffer *ib, return FALSE; } - if (ib != nv40->idxbuf || - type != nv40->idxbuf_format) { - nv40->dirty |= NV40_NEW_ARRAYS; - nv40->idxbuf = ib; - nv40->idxbuf_format = type; + if (ib != nvfx->idxbuf || + type != nvfx->idxbuf_format) { + nvfx->dirty |= NVFX_NEW_ARRAYS; + nvfx->idxbuf = ib; + nvfx->idxbuf_format = type; } return TRUE; } static boolean -nv40_vbo_static_attrib(struct nv40_context *nv40, struct nouveau_stateobj *so, +nv40_vbo_static_attrib(struct nvfx_context *nvfx, struct nouveau_stateobj *so, int attrib, struct pipe_vertex_element *ve, struct pipe_vertex_buffer *vb) { - struct pipe_screen *pscreen = nv40->pipe.screen; - struct nouveau_grobj *eng3d = nv40->screen->eng3d; + struct pipe_screen *pscreen = nvfx->pipe.screen; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; unsigned type, ncomp; void *map; @@ -169,14 +169,14 @@ void nv40_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_screen *screen = nv40->screen; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; unsigned restart; - nv40_vbo_set_idxbuf(nv40, NULL, 0); - if (FORCE_SWTNL || !nv40_state_validate(nv40)) { + nv40_vbo_set_idxbuf(nvfx, NULL, 0); + if (FORCE_SWTNL || !nv40_state_validate(nvfx)) { nv40_draw_elements_swtnl(pipe, NULL, 0, mode, start, count); return; @@ -185,7 +185,7 @@ nv40_draw_arrays(struct pipe_context *pipe, while (count) { unsigned vc, nr; - nv40_state_emit(nv40); + nv40_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); @@ -228,10 +228,10 @@ nv40_draw_arrays(struct pipe_context *pipe, } static INLINE void -nv40_draw_elements_u08(struct nv40_context *nv40, void *ib, +nv40_draw_elements_u08(struct nvfx_context *nvfx, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nv40_screen *screen = nv40->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -239,7 +239,7 @@ nv40_draw_elements_u08(struct nv40_context *nv40, void *ib, uint8_t *elts = (uint8_t *)ib + start; unsigned vc, push, restart; - nv40_state_emit(nv40); + nv40_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); @@ -279,10 +279,10 @@ nv40_draw_elements_u08(struct nv40_context *nv40, void *ib, } static INLINE void -nv40_draw_elements_u16(struct nv40_context *nv40, void *ib, +nv40_draw_elements_u16(struct nvfx_context *nvfx, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nv40_screen *screen = nv40->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -290,7 +290,7 @@ nv40_draw_elements_u16(struct nv40_context *nv40, void *ib, uint16_t *elts = (uint16_t *)ib + start; unsigned vc, push, restart; - nv40_state_emit(nv40); + nv40_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); @@ -330,10 +330,10 @@ nv40_draw_elements_u16(struct nv40_context *nv40, void *ib, } static INLINE void -nv40_draw_elements_u32(struct nv40_context *nv40, void *ib, +nv40_draw_elements_u32(struct nvfx_context *nvfx, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nv40_screen *screen = nv40->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -341,7 +341,7 @@ nv40_draw_elements_u32(struct nv40_context *nv40, void *ib, uint32_t *elts = (uint32_t *)ib + start; unsigned vc, push, restart; - nv40_state_emit(nv40); + nv40_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1, mode, start, count, &restart); @@ -376,7 +376,7 @@ nv40_draw_elements_inline(struct pipe_context *pipe, struct pipe_buffer *ib, unsigned ib_size, unsigned mode, unsigned start, unsigned count) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct pipe_screen *pscreen = pipe->screen; void *map; @@ -388,13 +388,13 @@ nv40_draw_elements_inline(struct pipe_context *pipe, switch (ib_size) { case 1: - nv40_draw_elements_u08(nv40, map, mode, start, count); + nv40_draw_elements_u08(nvfx, map, mode, start, count); break; case 2: - nv40_draw_elements_u16(nv40, map, mode, start, count); + nv40_draw_elements_u16(nvfx, map, mode, start, count); break; case 4: - nv40_draw_elements_u32(nv40, map, mode, start, count); + nv40_draw_elements_u32(nvfx, map, mode, start, count); break; default: NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size); @@ -408,8 +408,8 @@ static void nv40_draw_elements_vbo(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_screen *screen = nv40->screen; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; unsigned restart; @@ -417,7 +417,7 @@ nv40_draw_elements_vbo(struct pipe_context *pipe, while (count) { unsigned nr, vc; - nv40_state_emit(nv40); + nv40_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); @@ -462,11 +462,11 @@ nv40_draw_elements(struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned mode, unsigned start, unsigned count) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); boolean idxbuf; - idxbuf = nv40_vbo_set_idxbuf(nv40, indexBuffer, indexSize); - if (FORCE_SWTNL || !nv40_state_validate(nv40)) { + idxbuf = nv40_vbo_set_idxbuf(nvfx, indexBuffer, indexSize); + if (FORCE_SWTNL || !nv40_state_validate(nvfx)) { nv40_draw_elements_swtnl(pipe, NULL, 0, mode, start, count); return; @@ -483,33 +483,33 @@ nv40_draw_elements(struct pipe_context *pipe, } static boolean -nv40_vbo_validate(struct nv40_context *nv40) +nv40_vbo_validate(struct nvfx_context *nvfx) { struct nouveau_stateobj *vtxbuf, *vtxfmt, *sattr = NULL; - struct nouveau_grobj *eng3d = nv40->screen->eng3d; - struct pipe_buffer *ib = nv40->idxbuf; - unsigned ib_format = nv40->idxbuf_format; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; + struct pipe_buffer *ib = nvfx->idxbuf; + unsigned ib_format = nvfx->idxbuf_format; unsigned vb_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD; int hw; vtxbuf = so_new(3, 17, 18); - so_method(vtxbuf, eng3d, NV34TCL_VTXBUF_ADDRESS(0), nv40->vtxelt->num_elements); + so_method(vtxbuf, eng3d, NV34TCL_VTXBUF_ADDRESS(0), nvfx->vtxelt->num_elements); vtxfmt = so_new(1, 16, 0); - so_method(vtxfmt, eng3d, NV34TCL_VTXFMT(0), nv40->vtxelt->num_elements); + so_method(vtxfmt, eng3d, NV34TCL_VTXFMT(0), nvfx->vtxelt->num_elements); - for (hw = 0; hw < nv40->vtxelt->num_elements; hw++) { + for (hw = 0; hw < nvfx->vtxelt->num_elements; hw++) { struct pipe_vertex_element *ve; struct pipe_vertex_buffer *vb; unsigned type, ncomp; - ve = &nv40->vtxelt->pipe[hw]; - vb = &nv40->vtxbuf[ve->vertex_buffer_index]; + ve = &nvfx->vtxelt->pipe[hw]; + vb = &nvfx->vtxbuf[ve->vertex_buffer_index]; if (!vb->stride) { if (!sattr) sattr = so_new(16, 16 * 4, 0); - if (nv40_vbo_static_attrib(nv40, sattr, hw, ve, vb)) { + if (nv40_vbo_static_attrib(nvfx, sattr, hw, ve, vb)) { so_data(vtxbuf, 0); so_data(vtxfmt, NV34TCL_VTXFMT_TYPE_FLOAT); continue; @@ -517,7 +517,7 @@ nv40_vbo_validate(struct nv40_context *nv40) } if (nv40_vbo_format_to_hw(ve->src_format, &type, &ncomp)) { - nv40->fallback_swtnl |= NV40_NEW_ARRAYS; + nvfx->fallback_swtnl |= NVFX_NEW_ARRAYS; so_ref(NULL, &vtxbuf); so_ref(NULL, &vtxfmt); return FALSE; @@ -543,22 +543,22 @@ nv40_vbo_validate(struct nv40_context *nv40) so_method(vtxbuf, eng3d, 0x1710, 1); so_data (vtxbuf, 0); - so_ref(vtxbuf, &nv40->state.hw[NV40_STATE_VTXBUF]); + so_ref(vtxbuf, &nvfx->state.hw[NVFX_STATE_VTXBUF]); so_ref(NULL, &vtxbuf); - nv40->state.dirty |= (1ULL << NV40_STATE_VTXBUF); - so_ref(vtxfmt, &nv40->state.hw[NV40_STATE_VTXFMT]); + nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXBUF); + so_ref(vtxfmt, &nvfx->state.hw[NVFX_STATE_VTXFMT]); so_ref(NULL, &vtxfmt); - nv40->state.dirty |= (1ULL << NV40_STATE_VTXFMT); - so_ref(sattr, &nv40->state.hw[NV40_STATE_VTXATTR]); + nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXFMT); + so_ref(sattr, &nvfx->state.hw[NVFX_STATE_VTXATTR]); so_ref(NULL, &sattr); - nv40->state.dirty |= (1ULL << NV40_STATE_VTXATTR); + nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXATTR); return FALSE; } -struct nv40_state_entry nv40_state_vbo = { +struct nvfx_state_entry nv40_state_vbo = { .validate = nv40_vbo_validate, .dirty = { - .pipe = NV40_NEW_ARRAYS, + .pipe = NVFX_NEW_ARRAYS, .hw = 0, } }; diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index 96f27434291..a199f0766e4 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -8,7 +8,7 @@ #include "tgsi/tgsi_util.h" #include "nv40_context.h" -#include "nv40_state.h" +#include "nvfx_state.h" /* TODO (at least...): * 1. Indexed consts + ARL @@ -41,9 +41,9 @@ #define NV40_VP_INST_DEST_CLIP(n) ((~0 - 6) + (n)) struct nv40_vpc { - struct nv40_vertex_program *vp; + struct nvfx_vertex_program *vp; - struct nv40_vertex_program_exec *vpi; + struct nvfx_vertex_program_exec *vpi; unsigned r_temps; unsigned r_temps_discard; @@ -83,8 +83,8 @@ release_temps(struct nv40_vpc *vpc) static struct nv40_sreg constant(struct nv40_vpc *vpc, int pipe, float x, float y, float z, float w) { - struct nv40_vertex_program *vp = vpc->vp; - struct nv40_vertex_program_data *vpd; + struct nvfx_vertex_program *vp = vpc->vp; + struct nvfx_vertex_program_data *vpd; int idx; if (pipe >= 0) { @@ -112,7 +112,7 @@ constant(struct nv40_vpc *vpc, int pipe, float x, float y, float z, float w) static void emit_src(struct nv40_vpc *vpc, uint32_t *hw, int pos, struct nv40_sreg src) { - struct nv40_vertex_program *vp = vpc->vp; + struct nvfx_vertex_program *vp = vpc->vp; uint32_t sr = 0; switch (src.type) { @@ -176,7 +176,7 @@ emit_src(struct nv40_vpc *vpc, uint32_t *hw, int pos, struct nv40_sreg src) static void emit_dst(struct nv40_vpc *vpc, uint32_t *hw, int slot, struct nv40_sreg dst) { - struct nv40_vertex_program *vp = vpc->vp; + struct nvfx_vertex_program *vp = vpc->vp; switch (dst.type) { case NV40SR_TEMP: @@ -259,7 +259,7 @@ nv40_vp_arith(struct nv40_vpc *vpc, int slot, int op, struct nv40_sreg s0, struct nv40_sreg s1, struct nv40_sreg s2) { - struct nv40_vertex_program *vp = vpc->vp; + struct nvfx_vertex_program *vp = vpc->vp; uint32_t *hw; vp->insns = realloc(vp->insns, ++vp->nr_insns * sizeof(*vpc->vpi)); @@ -723,8 +723,8 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc) } static void -nv40_vertprog_translate(struct nv40_context *nv40, - struct nv40_vertex_program *vp) +nv40_vertprog_translate(struct nvfx_context *nvfx, + struct nvfx_vertex_program *vp) { struct tgsi_parse_context parse; struct nv40_vpc *vpc = NULL; @@ -798,10 +798,10 @@ nv40_vertprog_translate(struct nv40_context *nv40, struct nv40_sreg cdst = nv40_sr(NV40SR_OUTPUT, NV40_VP_INST_DEST_CLIP(i)); struct nv40_sreg ceqn = constant(vpc, -1, - nv40->clip.ucp[i][0], - nv40->clip.ucp[i][1], - nv40->clip.ucp[i][2], - nv40->clip.ucp[i][3]); + nvfx->clip.ucp[i][0], + nvfx->clip.ucp[i][1], + nvfx->clip.ucp[i][2], + nvfx->clip.ucp[i][3]); struct nv40_sreg htmp = vpc->r_result[vpc->hpos_idx]; unsigned mask; @@ -831,28 +831,28 @@ out_err: } static boolean -nv40_vertprog_validate(struct nv40_context *nv40) +nv40_vertprog_validate(struct nvfx_context *nvfx) { - struct pipe_screen *pscreen = nv40->pipe.screen; - struct nv40_screen *screen = nv40->screen; + struct pipe_screen *pscreen = nvfx->pipe.screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; - struct nv40_vertex_program *vp; + struct nvfx_vertex_program *vp; struct pipe_buffer *constbuf; boolean upload_code = FALSE, upload_data = FALSE; int i; - if (nv40->render_mode == HW) { - vp = nv40->vertprog; - constbuf = nv40->constbuf[PIPE_SHADER_VERTEX]; + if (nvfx->render_mode == HW) { + vp = nvfx->vertprog; + constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX]; - if ((nv40->dirty & NV40_NEW_UCP) || - memcmp(&nv40->clip, &vp->ucp, sizeof(vp->ucp))) { - nv40_vertprog_destroy(nv40, vp); - memcpy(&vp->ucp, &nv40->clip, sizeof(vp->ucp)); + if ((nvfx->dirty & NVFX_NEW_UCP) || + memcmp(&nvfx->clip, &vp->ucp, sizeof(vp->ucp))) { + nv40_vertprog_destroy(nvfx, vp); + memcpy(&vp->ucp, &nvfx->clip, sizeof(vp->ucp)); } } else { - vp = nv40->swtnl.vertprog; + vp = nvfx->swtnl.vertprog; constbuf = NULL; } @@ -860,23 +860,23 @@ nv40_vertprog_validate(struct nv40_context *nv40) if (vp->translated) goto check_gpu_resources; - nv40->fallback_swtnl &= ~NV40_NEW_VERTPROG; - nv40_vertprog_translate(nv40, vp); + nvfx->fallback_swtnl &= ~NVFX_NEW_VERTPROG; + nv40_vertprog_translate(nvfx, vp); if (!vp->translated) { - nv40->fallback_swtnl |= NV40_NEW_VERTPROG; + nvfx->fallback_swtnl |= NVFX_NEW_VERTPROG; return FALSE; } check_gpu_resources: /* Allocate hw vtxprog exec slots */ if (!vp->exec) { - struct nouveau_resource *heap = nv40->screen->vp_exec_heap; + struct nouveau_resource *heap = nvfx->screen->vp_exec_heap; struct nouveau_stateobj *so; uint vplen = vp->nr_insns; if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) { while (heap->next && heap->size < vplen) { - struct nv40_vertex_program *evict; + struct nvfx_vertex_program *evict; evict = heap->next->priv; nouveau_resource_free(&evict->exec); @@ -902,11 +902,11 @@ check_gpu_resources: /* Allocate hw vtxprog const slots */ if (vp->nr_consts && !vp->data) { - struct nouveau_resource *heap = nv40->screen->vp_data_heap; + struct nouveau_resource *heap = nvfx->screen->vp_data_heap; if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) { while (heap->next && heap->size < vp->nr_consts) { - struct nv40_vertex_program *evict; + struct nvfx_vertex_program *evict; evict = heap->next->priv; nouveau_resource_free(&evict->data); @@ -929,7 +929,7 @@ check_gpu_resources: */ if (vp->exec_start != vp->exec->start) { for (i = 0; i < vp->nr_insns; i++) { - struct nv40_vertex_program_exec *vpi = &vp->insns[i]; + struct nvfx_vertex_program_exec *vpi = &vp->insns[i]; if (vpi->has_branch_offset) { assert(0); @@ -941,7 +941,7 @@ check_gpu_resources: if (vp->nr_consts && vp->data_start != vp->data->start) { for (i = 0; i < vp->nr_insns; i++) { - struct nv40_vertex_program_exec *vpi = &vp->insns[i]; + struct nvfx_vertex_program_exec *vpi = &vp->insns[i]; if (vpi->const_index >= 0) { vpi->data[1] &= ~NV40_VP_INST_CONST_SRC_MASK; @@ -965,7 +965,7 @@ check_gpu_resources: } for (i = 0; i < vp->nr_consts; i++) { - struct nv40_vertex_program_data *vpd = &vp->consts[i]; + struct nvfx_vertex_program_data *vpd = &vp->consts[i]; if (vpd->index >= 0) { if (!upload_data && @@ -1003,8 +1003,8 @@ check_gpu_resources: } } - if (vp->so != nv40->state.hw[NV40_STATE_VERTPROG]) { - so_ref(vp->so, &nv40->state.hw[NV40_STATE_VERTPROG]); + if (vp->so != nvfx->state.hw[NVFX_STATE_VERTPROG]) { + so_ref(vp->so, &nvfx->state.hw[NVFX_STATE_VERTPROG]); return TRUE; } @@ -1012,7 +1012,7 @@ check_gpu_resources: } void -nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp) +nv40_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp) { vp->translated = FALSE; @@ -1038,11 +1038,11 @@ nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp) so_ref(NULL, &vp->so); } -struct nv40_state_entry nv40_state_vertprog = { +struct nvfx_state_entry nv40_state_vertprog = { .validate = nv40_vertprog_validate, .dirty = { - .pipe = NV40_NEW_VERTPROG | NV40_NEW_UCP, - .hw = NV40_STATE_VERTPROG, + .pipe = NVFX_NEW_VERTPROG | NVFX_NEW_UCP, + .hw = NVFX_STATE_VERTPROG, } }; |