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/nv30 | |
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/nv30')
25 files changed, 500 insertions, 784 deletions
diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile index 364c80d8f3e..ed02075d131 100644 --- a/src/gallium/drivers/nv30/Makefile +++ b/src/gallium/drivers/nv30/Makefile @@ -26,4 +26,6 @@ C_SOURCES = \ nv30_vbo.c \ nv30_vertprog.c +LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/nvfx + include ../../Makefile.template diff --git a/src/gallium/drivers/nv30/nv30_clear.c b/src/gallium/drivers/nv30/nv30_clear.c index c4ba9266647..e7ba73de7ca 100644 --- a/src/gallium/drivers/nv30/nv30_clear.c +++ b/src/gallium/drivers/nv30/nv30_clear.c @@ -9,6 +9,6 @@ void nv30_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil) { - util_clear(pipe, &nv30_context(pipe)->framebuffer, buffers, rgba, depth, + util_clear(pipe, &nvfx_context(pipe)->framebuffer, buffers, rgba, depth, stencil); } diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index be6407805be..628b50d8dc3 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -2,14 +2,14 @@ #include "pipe/p_defines.h" #include "nv30_context.h" -#include "nv30_screen.h" +#include "nvfx_screen.h" static void nv30_flush(struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_screen *screen = nv30->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 @@ nv30_flush(struct pipe_context *pipe, unsigned flags, static void nv30_destroy(struct pipe_context *pipe) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned i; - for (i = 0; i < NV30_STATE_MAX; i++) { - if (nv30->state.hw[i]) - so_ref(NULL, &nv30->state.hw[i]); + for (i = 0; i < NVFX_STATE_MAX; i++) { + if (nvfx->state.hw[i]) + so_ref(NULL, &nvfx->state.hw[i]); } - if (nv30->draw) - draw_destroy(nv30->draw); - FREE(nv30); + if (nvfx->draw) + draw_destroy(nvfx->draw); + FREE(nvfx); } struct pipe_context * nv30_create(struct pipe_screen *pscreen, void *priv) { - struct nv30_screen *screen = nv30_screen(pscreen); + struct nvfx_screen *screen = nvfx_screen(pscreen); struct pipe_winsys *ws = pscreen->winsys; - struct nv30_context *nv30; + struct nvfx_context *nvfx; struct nouveau_winsys *nvws = screen->nvws; - nv30 = CALLOC(1, sizeof(struct nv30_context)); - if (!nv30) + nvfx = CALLOC(1, sizeof(struct nvfx_context)); + if (!nvfx) return NULL; - nv30->screen = screen; + nvfx->screen = screen; - nv30->nvws = nvws; + nvfx->nvws = nvws; - nv30->pipe.winsys = ws; - nv30->pipe.screen = pscreen; - nv30->pipe.priv = priv; - nv30->pipe.destroy = nv30_destroy; - nv30->pipe.draw_arrays = nv30_draw_arrays; - nv30->pipe.draw_elements = nv30_draw_elements; - nv30->pipe.clear = nv30_clear; - nv30->pipe.flush = nv30_flush; + nvfx->pipe.winsys = ws; + nvfx->pipe.screen = pscreen; + nvfx->pipe.priv = priv; + nvfx->pipe.destroy = nv30_destroy; + nvfx->pipe.draw_arrays = nv30_draw_arrays; + nvfx->pipe.draw_elements = nv30_draw_elements; + nvfx->pipe.clear = nv30_clear; + nvfx->pipe.flush = nv30_flush; - nv30->pipe.is_texture_referenced = nouveau_is_texture_referenced; - nv30->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 = nv30; + screen->base.channel->user_private = nvfx; screen->base.channel->flush_notify = nv30_state_flush_notify; - nv30_init_query_functions(nv30); - nv30_init_surface_functions(nv30); - nv30_init_state_functions(nv30); - nv30_init_transfer_functions(nv30); + nv30_init_query_functions(nvfx); + nv30_init_surface_functions(nvfx); + nv30_init_state_functions(nvfx); + nv30_init_transfer_functions(nvfx); /* Create, configure, and install fallback swtnl path */ - nv30->draw = draw_create(); - draw_wide_point_threshold(nv30->draw, 9999999.0); - draw_wide_line_threshold(nv30->draw, 9999999.0); - draw_enable_line_stipple(nv30->draw, FALSE); - draw_enable_point_sprites(nv30->draw, FALSE); - draw_set_rasterize_stage(nv30->draw, nv30_draw_render_stage(nv30)); - - return &nv30->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, nv30_draw_render_stage(nvfx)); + + return &nvfx->pipe; } diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index 4a164f3b1fd..2fc148cdedb 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -1,207 +1,46 @@ #ifndef __NV30_CONTEXT_H__ #define __NV30_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 "nv30_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 nv30_state_index { - NV30_STATE_FB = 0, - NV30_STATE_VIEWPORT = 1, - NV30_STATE_BLEND = 2, - NV30_STATE_RAST = 3, - NV30_STATE_ZSA = 4, - NV30_STATE_BCOL = 5, - NV30_STATE_CLIP = 6, - NV30_STATE_SCISSOR = 7, - NV30_STATE_STIPPLE = 8, - NV30_STATE_FRAGPROG = 9, - NV30_STATE_VERTPROG = 10, - NV30_STATE_FRAGTEX0 = 11, - NV30_STATE_FRAGTEX1 = 12, - NV30_STATE_FRAGTEX2 = 13, - NV30_STATE_FRAGTEX3 = 14, - NV30_STATE_FRAGTEX4 = 15, - NV30_STATE_FRAGTEX5 = 16, - NV30_STATE_FRAGTEX6 = 17, - NV30_STATE_FRAGTEX7 = 18, - NV30_STATE_FRAGTEX8 = 19, - NV30_STATE_FRAGTEX9 = 20, - NV30_STATE_FRAGTEX10 = 21, - NV30_STATE_FRAGTEX11 = 22, - NV30_STATE_FRAGTEX12 = 23, - NV30_STATE_FRAGTEX13 = 24, - NV30_STATE_FRAGTEX14 = 25, - NV30_STATE_FRAGTEX15 = 26, - NV30_STATE_VERTTEX0 = 27, - NV30_STATE_VERTTEX1 = 28, - NV30_STATE_VERTTEX2 = 29, - NV30_STATE_VERTTEX3 = 30, - NV30_STATE_VTXBUF = 31, - NV30_STATE_VTXFMT = 32, - NV30_STATE_VTXATTR = 33, - NV30_STATE_SR = 34, - NV30_STATE_MAX = 35 -}; - -#include "nv30_screen.h" - -#define NV30_NEW_BLEND (1 << 0) -#define NV30_NEW_RAST (1 << 1) -#define NV30_NEW_ZSA (1 << 2) -#define NV30_NEW_SAMPLER (1 << 3) -#define NV30_NEW_FB (1 << 4) -#define NV30_NEW_STIPPLE (1 << 5) -#define NV30_NEW_SCISSOR (1 << 6) -#define NV30_NEW_VIEWPORT (1 << 7) -#define NV30_NEW_BCOL (1 << 8) -#define NV30_NEW_VERTPROG (1 << 9) -#define NV30_NEW_FRAGPROG (1 << 10) -#define NV30_NEW_ARRAYS (1 << 11) -#define NV30_NEW_UCP (1 << 12) -#define NV30_NEW_SR (1 << 13) - -struct nv30_rasterizer_state { - struct pipe_rasterizer_state pipe; - struct nouveau_stateobj *so; -}; - -struct nv30_zsa_state { - struct pipe_depth_stencil_alpha_state pipe; - struct nouveau_stateobj *so; -}; - -struct nv30_blend_state { - struct pipe_blend_state pipe; - struct nouveau_stateobj *so; -}; - - -struct nv30_state { - unsigned scissor_enabled; - unsigned stipple_enabled; - unsigned fp_samplers; - - uint64_t dirty; - struct nouveau_stateobj *hw[NV30_STATE_MAX]; -}; - -struct nv30_vtxelt_state { - struct pipe_vertex_element pipe[16]; - unsigned num_elements; -}; - -struct nv30_context { - struct pipe_context pipe; - - struct nouveau_winsys *nvws; - struct nv30_screen *screen; - - struct draw_context *draw; - - /* HW state derived from pipe states */ - struct nv30_state state; - - /* Context state */ - unsigned dirty; - struct pipe_scissor_state scissor; - unsigned stipple[32]; - struct nv30_vertex_program *vertprog; - struct nv30_fragment_program *fragprog; - struct pipe_buffer *constbuf[PIPE_SHADER_TYPES]; - unsigned constbuf_nr[PIPE_SHADER_TYPES]; - struct nv30_rasterizer_state *rasterizer; - struct nv30_zsa_state *zsa; - struct nv30_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 nv30_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS]; - struct nv30_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 nv30_vtxelt_state *vtxelt; -}; - -static INLINE struct nv30_context * -nv30_context(struct pipe_context *pipe) -{ - return (struct nv30_context *)pipe; -} - -struct nv30_state_entry { - boolean (*validate)(struct nv30_context *nv30); - struct { - unsigned pipe; - unsigned hw; - } dirty; -}; - -extern void nv30_init_state_functions(struct nv30_context *nv30); -extern void nv30_init_surface_functions(struct nv30_context *nv30); -extern void nv30_init_query_functions(struct nv30_context *nv30); -extern void nv30_init_transfer_functions(struct nv30_context *nv30); +extern void nv30_init_state_functions(struct nvfx_context *nvfx); +extern void nv30_init_surface_functions(struct nvfx_context *nvfx); +extern void nv30_init_query_functions(struct nvfx_context *nvfx); +extern void nv30_init_transfer_functions(struct nvfx_context *nvfx); extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen); /* nv30_draw.c */ -extern struct draw_stage *nv30_draw_render_stage(struct nv30_context *nv30); +extern struct draw_stage *nv30_draw_render_stage(struct nvfx_context *nvfx); /* nv30_vertprog.c */ -extern void nv30_vertprog_destroy(struct nv30_context *, - struct nv30_vertex_program *); +extern void nv30_vertprog_destroy(struct nvfx_context *, + struct nvfx_vertex_program *); /* nv30_fragprog.c */ -extern void nv30_fragprog_destroy(struct nv30_context *, - struct nv30_fragment_program *); +extern void nv30_fragprog_destroy(struct nvfx_context *, + struct nvfx_fragment_program *); /* nv30_fragtex.c */ -extern void nv30_fragtex_bind(struct nv30_context *); +extern void nv30_fragtex_bind(struct nvfx_context *); /* nv30_state.c and friends */ -extern boolean nv30_state_validate(struct nv30_context *nv30); -extern void nv30_state_emit(struct nv30_context *nv30); +extern boolean nv30_state_validate(struct nvfx_context *nvfx); +extern void nv30_state_emit(struct nvfx_context *nvfx); extern void nv30_state_flush_notify(struct nouveau_channel *chan); -extern struct nv30_state_entry nv30_state_rasterizer; -extern struct nv30_state_entry nv30_state_scissor; -extern struct nv30_state_entry nv30_state_stipple; -extern struct nv30_state_entry nv30_state_fragprog; -extern struct nv30_state_entry nv30_state_vertprog; -extern struct nv30_state_entry nv30_state_blend; -extern struct nv30_state_entry nv30_state_blend_colour; -extern struct nv30_state_entry nv30_state_zsa; -extern struct nv30_state_entry nv30_state_viewport; -extern struct nv30_state_entry nv30_state_framebuffer; -extern struct nv30_state_entry nv30_state_fragtex; -extern struct nv30_state_entry nv30_state_vbo; -extern struct nv30_state_entry nv30_state_sr; +extern struct nvfx_state_entry nv30_state_rasterizer; +extern struct nvfx_state_entry nv30_state_scissor; +extern struct nvfx_state_entry nv30_state_stipple; +extern struct nvfx_state_entry nv30_state_fragprog; +extern struct nvfx_state_entry nv30_state_vertprog; +extern struct nvfx_state_entry nv30_state_blend; +extern struct nvfx_state_entry nv30_state_blend_colour; +extern struct nvfx_state_entry nv30_state_zsa; +extern struct nvfx_state_entry nv30_state_viewport; +extern struct nvfx_state_entry nv30_state_framebuffer; +extern struct nvfx_state_entry nv30_state_fragtex; +extern struct nvfx_state_entry nv30_state_vbo; +extern struct nvfx_state_entry nv30_state_sr; /* nv30_vbo.c */ extern void nv30_draw_arrays(struct pipe_context *, unsigned mode, @@ -216,7 +55,7 @@ extern void nv30_draw_elements(struct pipe_context *pipe, extern void nv30_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil); -/* nv30_context.c */ +/* nvfx_context.c */ struct pipe_context * nv30_create(struct pipe_screen *pscreen, void *priv); diff --git a/src/gallium/drivers/nv30/nv30_draw.c b/src/gallium/drivers/nv30/nv30_draw.c index 74fc138c051..5d22e78abf7 100644 --- a/src/gallium/drivers/nv30/nv30_draw.c +++ b/src/gallium/drivers/nv30/nv30_draw.c @@ -4,7 +4,7 @@ struct nv30_draw_stage { struct draw_stage draw; - struct nv30_context *nv30; + struct nvfx_context *nvfx; }; static void @@ -43,12 +43,12 @@ nv30_draw_destroy(struct draw_stage *draw) } struct draw_stage * -nv30_draw_render_stage(struct nv30_context *nv30) +nv30_draw_render_stage(struct nvfx_context *nvfx) { struct nv30_draw_stage *nv30draw = CALLOC_STRUCT(nv30_draw_stage); - nv30draw->nv30 = nv30; - nv30draw->draw.draw = nv30->draw; + nv30draw->nvfx = nvfx; + nv30draw->draw.draw = nvfx->draw; nv30draw->draw.point = nv30_draw_point; nv30draw->draw.line = nv30_draw_line; nv30draw->draw.tri = nv30_draw_tri; diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 4c96e6d733d..ae246ffd647 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -31,7 +31,7 @@ #define MAX_CONSTS 128 #define MAX_IMM 32 struct nv30_fpc { - struct nv30_fragment_program *fp; + struct nvfx_fragment_program *fp; uint attrib_map[PIPE_MAX_SHADER_INPUTS]; @@ -89,7 +89,7 @@ constant(struct nv30_fpc *fpc, int pipe, float vals[4]) static void grow_insns(struct nv30_fpc *fpc, int size) { - struct nv30_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); @@ -98,7 +98,7 @@ grow_insns(struct nv30_fpc *fpc, int size) static void emit_src(struct nv30_fpc *fpc, int pos, struct nv30_sreg src) { - struct nv30_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw = &fp->insn[fpc->inst_offset]; uint32_t sr = 0; @@ -118,7 +118,7 @@ emit_src(struct nv30_fpc *fpc, int pos, struct nv30_sreg src) grow_insns(fpc, 4); hw = &fp->insn[fpc->inst_offset]; if (fpc->consts[src.index].pipe >= 0) { - struct nv30_fragment_program_data *fpd; + struct nvfx_fragment_program_data *fpd; fp->consts = realloc(fp->consts, ++fp->nr_consts * sizeof(*fpd)); @@ -158,7 +158,7 @@ emit_src(struct nv30_fpc *fpc, int pos, struct nv30_sreg src) static void emit_dst(struct nv30_fpc *fpc, struct nv30_sreg dst) { - struct nv30_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw = &fp->insn[fpc->inst_offset]; switch (dst.type) { @@ -188,7 +188,7 @@ nv30_fp_arith(struct nv30_fpc *fpc, int sat, int op, struct nv30_sreg dst, int mask, struct nv30_sreg s0, struct nv30_sreg s1, struct nv30_sreg s2) { - struct nv30_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; uint32_t *hw; fpc->inst_offset = fp->insn_len; @@ -224,7 +224,7 @@ nv30_fp_tex(struct nv30_fpc *fpc, int sat, int op, int unit, struct nv30_sreg dst, int mask, struct nv30_sreg s0, struct nv30_sreg s1, struct nv30_sreg s2) { - struct nv30_fragment_program *fp = fpc->fp; + struct nvfx_fragment_program *fp = fpc->fp; nv30_fp_arith(fpc, sat, op, dst, mask, s0, s1, s2); @@ -718,8 +718,8 @@ out_err: } static void -nv30_fragprog_translate(struct nv30_context *nv30, - struct nv30_fragment_program *fp) +nv30_fragprog_translate(struct nvfx_context *nvfx, + struct nvfx_fragment_program *fp) { struct tgsi_parse_context parse; struct nv30_fpc *fpc = NULL; @@ -778,10 +778,10 @@ out_err: } static void -nv30_fragprog_upload(struct nv30_context *nv30, - struct nv30_fragment_program *fp) +nv30_fragprog_upload(struct nvfx_context *nvfx, + struct nvfx_fragment_program *fp) { - struct pipe_screen *pscreen = nv30->pipe.screen; + struct pipe_screen *pscreen = nvfx->pipe.screen; const uint32_t le = 1; uint32_t *map; int i; @@ -812,12 +812,12 @@ nv30_fragprog_upload(struct nv30_context *nv30, } static boolean -nv30_fragprog_validate(struct nv30_context *nv30) +nv30_fragprog_validate(struct nvfx_context *nvfx) { - struct nv30_fragment_program *fp = nv30->fragprog; + struct nvfx_fragment_program *fp = nvfx->fragprog; struct pipe_buffer *constbuf = - nv30->constbuf[PIPE_SHADER_FRAGMENT]; - struct pipe_screen *pscreen = nv30->pipe.screen; + nvfx->constbuf[PIPE_SHADER_FRAGMENT]; + struct pipe_screen *pscreen = nvfx->pipe.screen; struct nouveau_stateobj *so; boolean new_consts = FALSE; int i; @@ -825,27 +825,27 @@ nv30_fragprog_validate(struct nv30_context *nv30) if (fp->translated) goto update_constants; - /*nv30->fallback_swrast &= ~NV30_NEW_FRAGPROG;*/ - nv30_fragprog_translate(nv30, fp); + /*nvfx->fallback_swrast &= ~NVFX_NEW_FRAGPROG;*/ + nv30_fragprog_translate(nvfx, fp); if (!fp->translated) { - /*nv30->fallback_swrast |= NV30_NEW_FRAGPROG;*/ + /*nvfx->fallback_swrast |= NVFX_NEW_FRAGPROG;*/ return FALSE; } fp->buffer = pscreen->buffer_create(pscreen, 0x100, 0, fp->insn_len * 4); - nv30_fragprog_upload(nv30, fp); + nv30_fragprog_upload(nvfx, fp); so = so_new(4, 4, 1); - so_method(so, nv30->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, nv30->screen->eng3d, NV34TCL_FP_CONTROL, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_FP_CONTROL, 1); so_data (so, fp->fp_control); - so_method(so, nv30->screen->eng3d, NV34TCL_FP_REG_CONTROL, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_FP_REG_CONTROL, 1); so_data (so, (1<<16)|0x4); - so_method(so, nv30->screen->eng3d, NV34TCL_TX_UNITS_ENABLE, 1); + so_method(so, nvfx->screen->eng3d, NV34TCL_TX_UNITS_ENABLE, 1); so_data (so, fp->samplers); so_ref(so, &fp->so); so_ref(NULL, &so); @@ -857,7 +857,7 @@ update_constants: map = pipe_buffer_map(pscreen, constbuf, PIPE_BUFFER_USAGE_CPU_READ); for (i = 0; i < fp->nr_consts; i++) { - struct nv30_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]; @@ -869,11 +869,11 @@ update_constants: pipe_buffer_unmap(pscreen, constbuf); if (new_consts) - nv30_fragprog_upload(nv30, fp); + nv30_fragprog_upload(nvfx, fp); } - if (new_consts || fp->so != nv30->state.hw[NV30_STATE_FRAGPROG]) { - so_ref(fp->so, &nv30->state.hw[NV30_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; } @@ -881,8 +881,8 @@ update_constants: } void -nv30_fragprog_destroy(struct nv30_context *nv30, - struct nv30_fragment_program *fp) +nv30_fragprog_destroy(struct nvfx_context *nvfx, + struct nvfx_fragment_program *fp) { if (fp->buffer) pipe_buffer_reference(&fp->buffer, NULL); @@ -894,10 +894,10 @@ nv30_fragprog_destroy(struct nv30_context *nv30, FREE(fp->insn); } -struct nv30_state_entry nv30_state_fragprog = { +struct nvfx_state_entry nv30_state_fragprog = { .validate = nv30_fragprog_validate, .dirty = { - .pipe = NV30_NEW_FRAGPROG, - .hw = NV30_STATE_FRAGPROG + .pipe = NVFX_NEW_FRAGPROG, + .hw = NVFX_STATE_FRAGPROG } }; diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index 63b5015ed4a..34e7dd54445 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -58,10 +58,10 @@ nv30_fragtex_format(uint pipe_format) static struct nouveau_stateobj * -nv30_fragtex_build(struct nv30_context *nv30, int unit) +nv30_fragtex_build(struct nvfx_context *nvfx, int unit) { - struct nv30_sampler_state *ps = nv30->tex_sampler[unit]; - struct nv30_miptree *nv30mt = nv30->tex_miptree[unit]; + struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit]; + struct nvfx_miptree *nv30mt = nvfx->tex_miptree[unit]; struct pipe_texture *pt = &nv30mt->base; struct nouveau_bo *bo = nouveau_bo(nv30mt->buffer); struct nv30_texture_format *tf; @@ -101,7 +101,7 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) txs = tf->swizzle; so = so_new(1, 8, 2); - so_method(so, nv30->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); @@ -117,10 +117,10 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) } static boolean -nv30_fragtex_validate(struct nv30_context *nv30) +nv30_fragtex_validate(struct nvfx_context *nvfx) { - struct nv30_fragment_program *fp = nv30->fragprog; - struct nv30_state *state = &nv30->state; + struct nvfx_fragment_program *fp = nvfx->fragprog; + struct nvfx_state *state = &nvfx->state; struct nouveau_stateobj *so; unsigned samplers, unit; @@ -130,32 +130,32 @@ nv30_fragtex_validate(struct nv30_context *nv30) samplers &= ~(1 << unit); so = so_new(1, 1, 0); - so_method(so, nv30->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, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]); so_ref(NULL, &so); - state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit)); + state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit)); } - samplers = nv30->dirty_samplers & fp->samplers; + samplers = nvfx->dirty_samplers & fp->samplers; while (samplers) { unit = ffs(samplers) - 1; samplers &= ~(1 << unit); - so = nv30_fragtex_build(nv30, unit); - so_ref(so, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]); + so = nv30_fragtex_build(nvfx, unit); + so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]); so_ref(NULL, &so); - state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit)); + state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit)); } - nv30->state.fp_samplers = fp->samplers; + nvfx->state.fp_samplers = fp->samplers; return FALSE; } -struct nv30_state_entry nv30_state_fragtex = { +struct nvfx_state_entry nv30_state_fragtex = { .validate = nv30_fragtex_validate, .dirty = { - .pipe = NV30_NEW_SAMPLER | NV30_NEW_FRAGPROG, + .pipe = NVFX_NEW_SAMPLER | NVFX_NEW_FRAGPROG, .hw = 0 } }; diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index bfa27b632f7..ada355a4440 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -8,7 +8,7 @@ #include "../nouveau/nv04_surface_2d.h" static void -nv30_miptree_layout(struct nv30_miptree *nv30mt) +nv30_miptree_layout(struct nvfx_miptree *nv30mt) { struct pipe_texture *pt = &nv30mt->base; uint width = pt->width0; @@ -62,11 +62,11 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt) static struct pipe_texture * nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) { - struct nv30_miptree *mt; + struct nvfx_miptree *mt; unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL | NOUVEAU_BUFFER_USAGE_TEXTURE; - mt = MALLOC(sizeof(struct nv30_miptree)); + mt = MALLOC(sizeof(struct nvfx_miptree)); if (!mt) return NULL; mt->base = *pt; @@ -132,14 +132,14 @@ static struct pipe_texture * nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, const unsigned *stride, struct pipe_buffer *pb) { - struct nv30_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(nv30_miptree); + mt = CALLOC_STRUCT(nvfx_miptree); if (!mt) return NULL; @@ -160,7 +160,7 @@ nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, static void nv30_miptree_destroy(struct pipe_texture *pt) { - struct nv30_miptree *mt = (struct nv30_miptree *)pt; + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; int l; pipe_buffer_reference(&mt->buffer, NULL); @@ -177,7 +177,7 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags) { - struct nv30_miptree *nv30mt = (struct nv30_miptree *)pt; + struct nvfx_miptree *nv30mt = (struct nvfx_miptree *)pt; struct nv04_surface *ns; ns = CALLOC_STRUCT(nv04_surface); @@ -207,7 +207,7 @@ nv30_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 nv30_screen*)pscreen)->eng2d, ns)->base; + return &nv04_surface_wrap_for_render(pscreen, ((struct nvfx_screen*)pscreen)->eng2d, ns)->base; return &ns->base; } @@ -218,7 +218,7 @@ nv30_miptree_surface_del(struct pipe_surface *ps) struct nv04_surface* ns = (struct nv04_surface*)ps; if(ns->backing) { - struct nv30_screen* screen = (struct nv30_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); nv30_miptree_surface_del(&ns->backing->base); diff --git a/src/gallium/drivers/nv30/nv30_query.c b/src/gallium/drivers/nv30/nv30_query.c index 21a5e8ad7c9..53b11a89430 100644 --- a/src/gallium/drivers/nv30/nv30_query.c +++ b/src/gallium/drivers/nv30/nv30_query.c @@ -39,9 +39,9 @@ nv30_query_destroy(struct pipe_context *pipe, struct pipe_query *pq) static void nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct nv30_query *q = nv30_query(pq); - struct nv30_screen *screen = nv30->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -56,9 +56,9 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq) pipe->get_query_result(pipe, pq, 1, &tmp); } - if (nouveau_resource_alloc(nv30->screen->query_heap, 1, NULL, &q->object)) + if (nouveau_resource_alloc(nvfx->screen->query_heap, 1, NULL, &q->object)) assert(0); - nouveau_notifier_reset(nv30->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,8 +71,8 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq) static void nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_screen *screen = nv30->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; struct nv30_query *q = nv30_query(pq); @@ -87,7 +87,7 @@ static boolean nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq, boolean wait, uint64_t *result) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct nv30_query *q = nv30_query(pq); assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER); @@ -95,18 +95,18 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq, if (!q->ready) { unsigned status; - status = nouveau_notifier_status(nv30->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(nv30->screen->query, + nouveau_notifier_wait_status(nvfx->screen->query, q->object->start, NV_NOTIFY_STATE_STATUS_COMPLETED, 0); } - q->result = nouveau_notifier_return_val(nv30->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 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq, } void -nv30_init_query_functions(struct nv30_context *nv30) +nv30_init_query_functions(struct nvfx_context *nvfx) { - nv30->pipe.create_query = nv30_query_create; - nv30->pipe.destroy_query = nv30_query_destroy; - nv30->pipe.begin_query = nv30_query_begin; - nv30->pipe.end_query = nv30_query_end; - nv30->pipe.get_query_result = nv30_query_result; + nvfx->pipe.create_query = nv30_query_create; + nvfx->pipe.destroy_query = nv30_query_destroy; + nvfx->pipe.begin_query = nv30_query_begin; + nvfx->pipe.end_query = nv30_query_end; + nvfx->pipe.get_query_result = nv30_query_result; } diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 40193f27954..305dfa83865 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -4,7 +4,7 @@ #include "nouveau/nouveau_screen.h" #include "nv30_context.h" -#include "nv30_screen.h" +#include "nvfx_screen.h" #define NV30TCL_CHIPSET_3X_MASK 0x00000003 #define NV34TCL_CHIPSET_3X_MASK 0x00000010 @@ -156,7 +156,7 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen, static struct pipe_buffer * nv30_surface_buffer(struct pipe_surface *surf) { - struct nv30_miptree *mt = (struct nv30_miptree *)surf->texture; + struct nvfx_miptree *mt = (struct nvfx_miptree *)surf->texture; return mt->buffer; } @@ -164,10 +164,10 @@ nv30_surface_buffer(struct pipe_surface *surf) static void nv30_screen_destroy(struct pipe_screen *pscreen) { - struct nv30_screen *screen = nv30_screen(pscreen); + struct nvfx_screen *screen = nvfx_screen(pscreen); unsigned i; - for (i = 0; i < NV30_STATE_MAX; i++) { + for (i = 0; i < NVFX_STATE_MAX; i++) { if (screen->state[i]) so_ref(NULL, &screen->state[i]); } @@ -188,7 +188,7 @@ nv30_screen_destroy(struct pipe_screen *pscreen) struct pipe_screen * nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { - struct nv30_screen *screen = CALLOC_STRUCT(nv30_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/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h deleted file mode 100644 index 69a94593f9d..00000000000 --- a/src/gallium/drivers/nv30/nv30_screen.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __NV30_SCREEN_H__ -#define __NV30_SCREEN_H__ - -#include "nouveau/nouveau_screen.h" - -#include "nouveau/nv04_surface_2d.h" - -struct nv30_screen { - struct nouveau_screen base; - - struct nouveau_winsys *nvws; - - struct nv30_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[NV30_STATE_MAX]; -}; - -static INLINE struct nv30_screen * -nv30_screen(struct pipe_screen *screen) -{ - return (struct nv30_screen *)screen; -} - -#endif diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c index 330448000b4..5263f894f2c 100644 --- a/src/gallium/drivers/nv30/nv30_state.c +++ b/src/gallium/drivers/nv30/nv30_state.c @@ -5,15 +5,15 @@ #include "tgsi/tgsi_parse.h" #include "nv30_context.h" -#include "nv30_state.h" +#include "nvfx_state.h" static void * nv30_blend_state_create(struct pipe_context *pipe, const struct pipe_blend_state *cso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nouveau_grobj *eng3d = nv30->screen->eng3d; - struct nv30_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) { @@ -59,16 +59,16 @@ nv30_blend_state_create(struct pipe_context *pipe, static void nv30_blend_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->blend = hwcso; - nv30->dirty |= NV30_NEW_BLEND; + nvfx->blend = hwcso; + nvfx->dirty |= NVFX_NEW_BLEND; } static void nv30_blend_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_blend_state *bso = hwcso; + struct nvfx_blend_state *bso = hwcso; so_ref(NULL, &bso->so); FREE(bso); @@ -117,10 +117,10 @@ static void * nv30_sampler_state_create(struct pipe_context *pipe, const struct pipe_sampler_state *cso) { - struct nv30_sampler_state *ps; + struct nvfx_sampler_state *ps; uint32_t filter = 0; - ps = MALLOC(sizeof(struct nv30_sampler_state)); + ps = MALLOC(sizeof(struct nvfx_sampler_state)); ps->fmt = 0; /* TODO: Not all RECTs formats have this bit set, bits 15-8 of format @@ -248,21 +248,21 @@ nv30_sampler_state_create(struct pipe_context *pipe, static void nv30_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { - nv30->tex_sampler[unit] = sampler[unit]; - nv30->dirty_samplers |= (1 << unit); + nvfx->tex_sampler[unit] = sampler[unit]; + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv30->nr_samplers; unit++) { - nv30->tex_sampler[unit] = NULL; - nv30->dirty_samplers |= (1 << unit); + for (unit = nr; unit < nvfx->nr_samplers; unit++) { + nvfx->tex_sampler[unit] = NULL; + nvfx->dirty_samplers |= (1 << unit); } - nv30->nr_samplers = nr; - nv30->dirty |= NV30_NEW_SAMPLER; + nvfx->nr_samplers = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void @@ -275,33 +275,33 @@ static void nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr, struct pipe_texture **miptree) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv30->tex_miptree[unit], miptree[unit]); - nv30->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], miptree[unit]); + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv30->nr_textures; unit++) { + for (unit = nr; unit < nvfx->nr_textures; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv30->tex_miptree[unit], NULL); - nv30->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], NULL); + nvfx->dirty_samplers |= (1 << unit); } - nv30->nr_textures = nr; - nv30->dirty |= NV30_NEW_SAMPLER; + nvfx->nr_textures = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void * nv30_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_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 = nv30->screen->eng3d; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; /*XXX: ignored: * light_twoside @@ -413,17 +413,17 @@ nv30_rasterizer_state_create(struct pipe_context *pipe, static void nv30_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->rasterizer = hwcso; - nv30->dirty |= NV30_NEW_RAST; - /*nv30->draw_dirty |= NV30_NEW_RAST;*/ + nvfx->rasterizer = hwcso; + nvfx->dirty |= NVFX_NEW_RAST; + /*nvfx->draw_dirty |= NVFX_NEW_RAST;*/ } static void nv30_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_rasterizer_state *rsso = hwcso; + struct nvfx_rasterizer_state *rsso = hwcso; so_ref(NULL, &rsso->so); FREE(rsso); @@ -433,10 +433,10 @@ static void * nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe, const struct pipe_depth_stencil_alpha_state *cso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_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 = nv30->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)); @@ -487,16 +487,16 @@ nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe, static void nv30_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->zsa = hwcso; - nv30->dirty |= NV30_NEW_ZSA; + nvfx->zsa = hwcso; + nvfx->dirty |= NVFX_NEW_ZSA; } static void nv30_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_zsa_state *zsaso = hwcso; + struct nvfx_zsa_state *zsaso = hwcso; so_ref(NULL, &zsaso->so); FREE(zsaso); @@ -506,12 +506,12 @@ static void * nv30_vp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - /*struct nv30_context *nv30 = nv30_context(pipe);*/ - struct nv30_vertex_program *vp; + /*struct nvfx_context *nvfx = nvfx_context(pipe);*/ + struct nvfx_vertex_program *vp; - vp = CALLOC(1, sizeof(struct nv30_vertex_program)); + vp = CALLOC(1, sizeof(struct nvfx_vertex_program)); vp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - /*vp->draw = draw_create_vertex_shader(nv30->draw, &vp->pipe);*/ + /*vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);*/ return (void *)vp; } @@ -519,21 +519,21 @@ nv30_vp_state_create(struct pipe_context *pipe, static void nv30_vp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->vertprog = hwcso; - nv30->dirty |= NV30_NEW_VERTPROG; - /*nv30->draw_dirty |= NV30_NEW_VERTPROG;*/ + nvfx->vertprog = hwcso; + nvfx->dirty |= NVFX_NEW_VERTPROG; + /*nvfx->draw_dirty |= NVFX_NEW_VERTPROG;*/ } static void nv30_vp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_vertex_program *vp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp = hwcso; - /*draw_delete_vertex_shader(nv30->draw, vp->draw);*/ - nv30_vertprog_destroy(nv30, vp); + /*draw_delete_vertex_shader(nvfx->draw, vp->draw);*/ + nv30_vertprog_destroy(nvfx, vp); FREE((void*)vp->pipe.tokens); FREE(vp); } @@ -542,9 +542,9 @@ static void * nv30_fp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - struct nv30_fragment_program *fp; + struct nvfx_fragment_program *fp; - fp = CALLOC(1, sizeof(struct nv30_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); @@ -555,19 +555,19 @@ nv30_fp_state_create(struct pipe_context *pipe, static void nv30_fp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->fragprog = hwcso; - nv30->dirty |= NV30_NEW_FRAGPROG; + nvfx->fragprog = hwcso; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } static void nv30_fp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_fragment_program *fp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_fragment_program *fp = hwcso; - nv30_fragprog_destroy(nv30, fp); + nv30_fragprog_destroy(nvfx, fp); FREE((void*)fp->pipe.tokens); FREE(fp); } @@ -576,20 +576,20 @@ static void nv30_set_blend_color(struct pipe_context *pipe, const struct pipe_blend_color *bcol) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->blend_colour = *bcol; - nv30->dirty |= NV30_NEW_BCOL; + nvfx->blend_colour = *bcol; + nvfx->dirty |= NVFX_NEW_BCOL; } static void nv30_set_stencil_ref(struct pipe_context *pipe, const struct pipe_stencil_ref *sr) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->stencil_ref = *sr; - nv30->dirty |= NV30_NEW_SR; + nvfx->stencil_ref = *sr; + nvfx->dirty |= NVFX_NEW_SR; } static void @@ -602,16 +602,16 @@ static void nv30_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, struct pipe_buffer *buf ) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->constbuf[shader] = buf; - nv30->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) { - nv30->dirty |= NV30_NEW_VERTPROG; + nvfx->dirty |= NVFX_NEW_VERTPROG; } else if (shader == PIPE_SHADER_FRAGMENT) { - nv30->dirty |= NV30_NEW_FRAGPROG; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } } @@ -619,54 +619,54 @@ static void nv30_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->framebuffer = *fb; - nv30->dirty |= NV30_NEW_FB; + nvfx->framebuffer = *fb; + nvfx->dirty |= NVFX_NEW_FB; } static void nv30_set_polygon_stipple(struct pipe_context *pipe, const struct pipe_poly_stipple *stipple) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv30->stipple, stipple->stipple, 4 * 32); - nv30->dirty |= NV30_NEW_STIPPLE; + memcpy(nvfx->stipple, stipple->stipple, 4 * 32); + nvfx->dirty |= NVFX_NEW_STIPPLE; } static void nv30_set_scissor_state(struct pipe_context *pipe, const struct pipe_scissor_state *s) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->scissor = *s; - nv30->dirty |= NV30_NEW_SCISSOR; + nvfx->scissor = *s; + nvfx->dirty |= NVFX_NEW_SCISSOR; } static void nv30_set_viewport_state(struct pipe_context *pipe, const struct pipe_viewport_state *vpt) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->viewport = *vpt; - nv30->dirty |= NV30_NEW_VIEWPORT; - /*nv30->draw_dirty |= NV30_NEW_VIEWPORT;*/ + nvfx->viewport = *vpt; + nvfx->dirty |= NVFX_NEW_VIEWPORT; + /*nvfx->draw_dirty |= NVFX_NEW_VIEWPORT;*/ } static void nv30_set_vertex_buffers(struct pipe_context *pipe, unsigned count, const struct pipe_vertex_buffer *vb) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv30->vtxbuf, vb, sizeof(*vb) * count); - nv30->vtxbuf_nr = count; + memcpy(nvfx->vtxbuf, vb, sizeof(*vb) * count); + nvfx->vtxbuf_nr = count; - nv30->dirty |= NV30_NEW_ARRAYS; - /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/ + nvfx->dirty |= NVFX_NEW_ARRAYS; + /*nvfx->draw_dirty |= NVFX_NEW_ARRAYS;*/ } static void * @@ -674,7 +674,7 @@ nv30_vtxelts_state_create(struct pipe_context *pipe, unsigned num_elements, const struct pipe_vertex_element *elements) { - struct nv30_vtxelt_state *cso = CALLOC_STRUCT(nv30_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; @@ -694,57 +694,57 @@ nv30_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso) static void nv30_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->vtxelt = hwcso; - nv30->dirty |= NV30_NEW_ARRAYS; - /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/ + nvfx->vtxelt = hwcso; + nvfx->dirty |= NVFX_NEW_ARRAYS; + /*nvfx->draw_dirty |= NVFX_NEW_ARRAYS;*/ } void -nv30_init_state_functions(struct nv30_context *nv30) +nv30_init_state_functions(struct nvfx_context *nvfx) { - nv30->pipe.create_blend_state = nv30_blend_state_create; - nv30->pipe.bind_blend_state = nv30_blend_state_bind; - nv30->pipe.delete_blend_state = nv30_blend_state_delete; + nvfx->pipe.create_blend_state = nv30_blend_state_create; + nvfx->pipe.bind_blend_state = nv30_blend_state_bind; + nvfx->pipe.delete_blend_state = nv30_blend_state_delete; - nv30->pipe.create_sampler_state = nv30_sampler_state_create; - nv30->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind; - nv30->pipe.delete_sampler_state = nv30_sampler_state_delete; - nv30->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture; + nvfx->pipe.create_sampler_state = nv30_sampler_state_create; + nvfx->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind; + nvfx->pipe.delete_sampler_state = nv30_sampler_state_delete; + nvfx->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture; - nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create; - nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind; - nv30->pipe.delete_rasterizer_state = nv30_rasterizer_state_delete; + nvfx->pipe.create_rasterizer_state = nv30_rasterizer_state_create; + nvfx->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind; + nvfx->pipe.delete_rasterizer_state = nv30_rasterizer_state_delete; - nv30->pipe.create_depth_stencil_alpha_state = + nvfx->pipe.create_depth_stencil_alpha_state = nv30_depth_stencil_alpha_state_create; - nv30->pipe.bind_depth_stencil_alpha_state = + nvfx->pipe.bind_depth_stencil_alpha_state = nv30_depth_stencil_alpha_state_bind; - nv30->pipe.delete_depth_stencil_alpha_state = + nvfx->pipe.delete_depth_stencil_alpha_state = nv30_depth_stencil_alpha_state_delete; - nv30->pipe.create_vs_state = nv30_vp_state_create; - nv30->pipe.bind_vs_state = nv30_vp_state_bind; - nv30->pipe.delete_vs_state = nv30_vp_state_delete; + nvfx->pipe.create_vs_state = nv30_vp_state_create; + nvfx->pipe.bind_vs_state = nv30_vp_state_bind; + nvfx->pipe.delete_vs_state = nv30_vp_state_delete; - nv30->pipe.create_fs_state = nv30_fp_state_create; - nv30->pipe.bind_fs_state = nv30_fp_state_bind; - nv30->pipe.delete_fs_state = nv30_fp_state_delete; + nvfx->pipe.create_fs_state = nv30_fp_state_create; + nvfx->pipe.bind_fs_state = nv30_fp_state_bind; + nvfx->pipe.delete_fs_state = nv30_fp_state_delete; - nv30->pipe.set_blend_color = nv30_set_blend_color; - nv30->pipe.set_stencil_ref = nv30_set_stencil_ref; - nv30->pipe.set_clip_state = nv30_set_clip_state; - nv30->pipe.set_constant_buffer = nv30_set_constant_buffer; - nv30->pipe.set_framebuffer_state = nv30_set_framebuffer_state; - nv30->pipe.set_polygon_stipple = nv30_set_polygon_stipple; - nv30->pipe.set_scissor_state = nv30_set_scissor_state; - nv30->pipe.set_viewport_state = nv30_set_viewport_state; + nvfx->pipe.set_blend_color = nv30_set_blend_color; + nvfx->pipe.set_stencil_ref = nv30_set_stencil_ref; + nvfx->pipe.set_clip_state = nv30_set_clip_state; + nvfx->pipe.set_constant_buffer = nv30_set_constant_buffer; + nvfx->pipe.set_framebuffer_state = nv30_set_framebuffer_state; + nvfx->pipe.set_polygon_stipple = nv30_set_polygon_stipple; + nvfx->pipe.set_scissor_state = nv30_set_scissor_state; + nvfx->pipe.set_viewport_state = nv30_set_viewport_state; - nv30->pipe.create_vertex_elements_state = nv30_vtxelts_state_create; - nv30->pipe.delete_vertex_elements_state = nv30_vtxelts_state_delete; - nv30->pipe.bind_vertex_elements_state = nv30_vtxelts_state_bind; + nvfx->pipe.create_vertex_elements_state = nv30_vtxelts_state_create; + nvfx->pipe.delete_vertex_elements_state = nv30_vtxelts_state_delete; + nvfx->pipe.bind_vertex_elements_state = nv30_vtxelts_state_bind; - nv30->pipe.set_vertex_buffers = nv30_set_vertex_buffers; + nvfx->pipe.set_vertex_buffers = nv30_set_vertex_buffers; } diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h deleted file mode 100644 index b1c7f84a0a0..00000000000 --- a/src/gallium/drivers/nv30/nv30_state.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __NV30_STATE_H__ -#define __NV30_STATE_H__ - -#include "pipe/p_state.h" -#include "tgsi/tgsi_scan.h" - -struct nv30_sampler_state { - uint32_t fmt; - uint32_t wrap; - uint32_t en; - uint32_t filt; - uint32_t bcol; -}; - -struct nv30_vertex_program_exec { - uint32_t data[4]; - boolean has_branch_offset; - int const_index; -}; - -struct nv30_vertex_program_data { - int index; /* immediates == -1 */ - float value[4]; -}; - -struct nv30_vertex_program { - struct pipe_shader_state pipe; - - boolean translated; - - struct nv30_vertex_program_exec *insns; - unsigned nr_insns; - struct nv30_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; - struct nouveau_stateobj *so; -}; - -struct nv30_fragment_program_data { - unsigned offset; - unsigned index; -}; - -struct nv30_fragment_program { - struct pipe_shader_state pipe; - struct tgsi_shader_info info; - - boolean translated; - unsigned samplers; - - uint32_t *insn; - int insn_len; - - struct nv30_fragment_program_data *consts; - unsigned nr_consts; - - struct pipe_buffer *buffer; - - uint32_t fp_control; - struct nouveau_stateobj *so; -}; - -#define NV30_MAX_TEXTURE_LEVELS 16 - -struct nv30_miptree { - struct pipe_texture base; - struct nouveau_bo *bo; - - struct pipe_buffer *buffer; - uint total_size; - - struct { - uint pitch; - uint *image_offset; - } level[NV30_MAX_TEXTURE_LEVELS]; -}; - -#endif diff --git a/src/gallium/drivers/nv30/nv30_state_blend.c b/src/gallium/drivers/nv30/nv30_state_blend.c index eb0199cf659..de368e5bd79 100644 --- a/src/gallium/drivers/nv30/nv30_state_blend.c +++ b/src/gallium/drivers/nv30/nv30_state_blend.c @@ -1,41 +1,41 @@ #include "nv30_context.h" static boolean -nv30_state_blend_validate(struct nv30_context *nv30) +nv30_state_blend_validate(struct nvfx_context *nvfx) { - so_ref(nv30->blend->so, &nv30->state.hw[NV30_STATE_BLEND]); + so_ref(nvfx->blend->so, &nvfx->state.hw[NVFX_STATE_BLEND]); return TRUE; } -struct nv30_state_entry nv30_state_blend = { +struct nvfx_state_entry nv30_state_blend = { .validate = nv30_state_blend_validate, .dirty = { - .pipe = NV30_NEW_BLEND, - .hw = NV30_STATE_BLEND + .pipe = NVFX_NEW_BLEND, + .hw = NVFX_STATE_BLEND } }; static boolean -nv30_state_blend_colour_validate(struct nv30_context *nv30) +nv30_state_blend_colour_validate(struct nvfx_context *nvfx) { struct nouveau_stateobj *so = so_new(1, 1, 0); - struct pipe_blend_color *bcol = &nv30->blend_colour; + struct pipe_blend_color *bcol = &nvfx->blend_colour; - so_method(so, nv30->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, &nv30->state.hw[NV30_STATE_BCOL]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_BCOL]); so_ref(NULL, &so); return TRUE; } -struct nv30_state_entry nv30_state_blend_colour = { +struct nvfx_state_entry nv30_state_blend_colour = { .validate = nv30_state_blend_colour_validate, .dirty = { - .pipe = NV30_NEW_BCOL, - .hw = NV30_STATE_BCOL + .pipe = NVFX_NEW_BCOL, + .hw = NVFX_STATE_BCOL } }; diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c index deefe7fd8db..6df93618da8 100644 --- a/src/gallium/drivers/nv30/nv30_state_emit.c +++ b/src/gallium/drivers/nv30/nv30_state_emit.c @@ -1,7 +1,7 @@ #include "nv30_context.h" -#include "nv30_state.h" +#include "nvfx_state.h" -static struct nv30_state_entry *render_states[] = { +static struct nvfx_state_entry *render_states[] = { &nv30_state_framebuffer, &nv30_state_rasterizer, &nv30_state_scissor, @@ -19,49 +19,48 @@ static struct nv30_state_entry *render_states[] = { }; static void -nv30_state_do_validate(struct nv30_context *nv30, - struct nv30_state_entry **states) +nv30_state_do_validate(struct nvfx_context *nvfx, + struct nvfx_state_entry **states) { while (*states) { - struct nv30_state_entry *e = *states; + struct nvfx_state_entry *e = *states; - if (nv30->dirty & e->dirty.pipe) { - if (e->validate(nv30)) { - nv30->state.dirty |= (1ULL << e->dirty.hw); - } + if (nvfx->dirty & e->dirty.pipe) { + if (e->validate(nvfx)) + nvfx->state.dirty |= (1ULL << e->dirty.hw); } states++; } - nv30->dirty = 0; + nvfx->dirty = 0; } void -nv30_state_emit(struct nv30_context *nv30) +nv30_state_emit(struct nvfx_context *nvfx) { - struct nouveau_channel *chan = nv30->screen->base.channel; - struct nv30_state *state = &nv30->state; - struct nv30_screen *screen = nv30->screen; + struct nouveau_channel *chan = nvfx->screen->base.channel; + struct nvfx_state *state = &nvfx->state; + struct nvfx_screen *screen = nvfx->screen; unsigned i; uint64_t states; /* XXX: racy! */ - if (nv30 != screen->cur_ctx) { - for (i = 0; i < NV30_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 = nv30; + screen->cur_ctx = nvfx; } for (i = 0, states = state->dirty; states; i++) { if (!(states & (1ULL << i))) continue; - so_ref (state->hw[i], &nv30->screen->state[i]); + so_ref (state->hw[i], &nvfx->screen->state[i]); if (state->hw[i]) - so_emit(chan, nv30->screen->state[i]); + so_emit(chan, nvfx->screen->state[i]); states &= ~(1ULL << i); } @@ -71,48 +70,48 @@ nv30_state_emit(struct nv30_context *nv30) void nv30_state_flush_notify(struct nouveau_channel *chan) { - struct nv30_context *nv30 = chan->user_private; - struct nv30_state *state = &nv30->state; + struct nvfx_context *nvfx = chan->user_private; + struct nvfx_state *state = &nvfx->state; unsigned i, samplers; - so_emit_reloc_markers(chan, state->hw[NV30_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[NV30_STATE_FRAGTEX0+i]); + state->hw[NVFX_STATE_FRAGTEX0+i]); samplers &= ~(1ULL << i); } - so_emit_reloc_markers(chan, state->hw[NV30_STATE_FRAGPROG]); - if (state->hw[NV30_STATE_VTXBUF] /*&& nv30->render_mode == HW*/) - so_emit_reloc_markers(chan, state->hw[NV30_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 -nv30_state_validate(struct nv30_context *nv30) +nv30_state_validate(struct nvfx_context *nvfx) { #if 0 - boolean was_sw = nv30->fallback_swtnl ? TRUE : FALSE; + boolean was_sw = nvfx->fallback_swtnl ? TRUE : FALSE; - if (nv30->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 ((nv30->fallback_swtnl & nv30->dirty) - != nv30->fallback_swtnl) + if ((nvfx->fallback_swtnl & nvfx->dirty) + != nvfx->fallback_swtnl) return FALSE; /* Attempt to go to hwtnl again */ - nv30->pipe.flush(&nv30->pipe, 0, NULL); - nv30->dirty |= (NV30_NEW_VIEWPORT | - NV30_NEW_VERTPROG | - NV30_NEW_ARRAYS); - nv30->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; } #endif - nv30_state_do_validate(nv30, render_states); + nv30_state_do_validate(nvfx, render_states); #if 0 - if (nv30->fallback_swtnl || nv30->fallback_swrast) + if (nvfx->fallback_swtnl || nvfx->fallback_swrast) return FALSE; if (was_sw) diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 23d17c0c608..e9e215dccea 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -2,11 +2,11 @@ #include "nouveau/nouveau_util.h" static boolean -nv30_state_framebuffer_validate(struct nv30_context *nv30) +nv30_state_framebuffer_validate(struct nvfx_context *nvfx) { - struct pipe_framebuffer_state *fb = &nv30->framebuffer; - struct nouveau_channel *chan = nv30->screen->base.channel; - struct nouveau_grobj *eng3d = nv30->screen->eng3d; + struct pipe_framebuffer_state *fb = &nvfx->framebuffer; + struct nouveau_channel *chan = nvfx->screen->base.channel; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; struct nv04_surface *rt[2], *zeta = NULL; uint32_t rt_enable = 0, rt_format = 0; int i, colour_format = 0, zeta_format = 0, depth_only = 0; @@ -14,7 +14,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM; unsigned w = fb->width; unsigned h = fb->height; - struct nv30_miptree *nv30mt; + struct nvfx_miptree *nv30mt; int colour_bits = 32, zeta_bits = 32; for (i = 0; i < fb->nr_cbufs; i++) { @@ -109,7 +109,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) pitch |= (pitch << 16); } - nv30mt = (struct nv30_miptree *) rt0->base.texture; + nv30mt = (struct nvfx_miptree *) rt0->base.texture; so_method(so, eng3d, NV34TCL_DMA_COLOR0, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, chan->vram->handle, chan->gart->handle); @@ -120,7 +120,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) } if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) { - nv30mt = (struct nv30_miptree *)rt[1]->base.texture; + nv30mt = (struct nvfx_miptree *)rt[1]->base.texture; so_method(so, eng3d, NV34TCL_DMA_COLOR1, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, chan->vram->handle, chan->gart->handle); @@ -131,7 +131,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) } if (zeta_format) { - nv30mt = (struct nv30_miptree *)zeta->base.texture; + nv30mt = (struct nvfx_miptree *)zeta->base.texture; so_method(so, eng3d, NV34TCL_DMA_ZETA, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, chan->vram->handle, chan->gart->handle); @@ -159,15 +159,15 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) so_method(so, eng3d, NV34TCL_VIEWPORT_TX_ORIGIN, 1); so_data (so, 0); - so_ref(so, &nv30->state.hw[NV30_STATE_FB]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_FB]); so_ref(NULL, &so); return TRUE; } -struct nv30_state_entry nv30_state_framebuffer = { +struct nvfx_state_entry nv30_state_framebuffer = { .validate = nv30_state_framebuffer_validate, .dirty = { - .pipe = NV30_NEW_FB, - .hw = NV30_STATE_FB + .pipe = NVFX_NEW_FB, + .hw = NVFX_STATE_FB } }; diff --git a/src/gallium/drivers/nv30/nv30_state_rasterizer.c b/src/gallium/drivers/nv30/nv30_state_rasterizer.c index 6d1b60e043d..1a83da52047 100644 --- a/src/gallium/drivers/nv30/nv30_state_rasterizer.c +++ b/src/gallium/drivers/nv30/nv30_state_rasterizer.c @@ -1,17 +1,17 @@ #include "nv30_context.h" static boolean -nv30_state_rasterizer_validate(struct nv30_context *nv30) +nv30_state_rasterizer_validate(struct nvfx_context *nvfx) { - so_ref(nv30->rasterizer->so, - &nv30->state.hw[NV30_STATE_RAST]); + so_ref(nvfx->rasterizer->so, + &nvfx->state.hw[NVFX_STATE_RAST]); return TRUE; } -struct nv30_state_entry nv30_state_rasterizer = { +struct nvfx_state_entry nv30_state_rasterizer = { .validate = nv30_state_rasterizer_validate, .dirty = { - .pipe = NV30_NEW_RAST, - .hw = NV30_STATE_RAST + .pipe = NVFX_NEW_RAST, + .hw = NVFX_STATE_RAST } }; diff --git a/src/gallium/drivers/nv30/nv30_state_scissor.c b/src/gallium/drivers/nv30/nv30_state_scissor.c index f58bb0161e6..e91680e2d19 100644 --- a/src/gallium/drivers/nv30/nv30_state_scissor.c +++ b/src/gallium/drivers/nv30/nv30_state_scissor.c @@ -1,20 +1,20 @@ #include "nv30_context.h" static boolean -nv30_state_scissor_validate(struct nv30_context *nv30) +nv30_state_scissor_validate(struct nvfx_context *nvfx) { - struct pipe_rasterizer_state *rast = &nv30->rasterizer->pipe; - struct pipe_scissor_state *s = &nv30->scissor; + struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe; + struct pipe_scissor_state *s = &nvfx->scissor; struct nouveau_stateobj *so; - if (nv30->state.hw[NV30_STATE_SCISSOR] && - (rast->scissor == 0 && nv30->state.scissor_enabled == 0)) + if (nvfx->state.hw[NVFX_STATE_SCISSOR] && + (rast->scissor == 0 && nvfx->state.scissor_enabled == 0)) return FALSE; - nv30->state.scissor_enabled = rast->scissor; + nvfx->state.scissor_enabled = rast->scissor; so = so_new(1, 2, 0); - so_method(so, nv30->screen->eng3d, NV34TCL_SCISSOR_HORIZ, 2); - if (nv30->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 @@ nv30_state_scissor_validate(struct nv30_context *nv30) so_data (so, 4096 << 16); } - so_ref(so, &nv30->state.hw[NV30_STATE_SCISSOR]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_SCISSOR]); so_ref(NULL, &so); return TRUE; } -struct nv30_state_entry nv30_state_scissor = { +struct nvfx_state_entry nv30_state_scissor = { .validate = nv30_state_scissor_validate, .dirty = { - .pipe = NV30_NEW_SCISSOR | NV30_NEW_RAST, - .hw = NV30_STATE_SCISSOR + .pipe = NVFX_NEW_SCISSOR | NVFX_NEW_RAST, + .hw = NVFX_STATE_SCISSOR } }; diff --git a/src/gallium/drivers/nv30/nv30_state_stipple.c b/src/gallium/drivers/nv30/nv30_state_stipple.c index 46a69754381..eceb0c57f97 100644 --- a/src/gallium/drivers/nv30/nv30_state_stipple.c +++ b/src/gallium/drivers/nv30/nv30_state_stipple.c @@ -1,14 +1,14 @@ #include "nv30_context.h" static boolean -nv30_state_stipple_validate(struct nv30_context *nv30) +nv30_state_stipple_validate(struct nvfx_context *nvfx) { - struct pipe_rasterizer_state *rast = &nv30->rasterizer->pipe; - struct nouveau_grobj *eng3d = nv30->screen->eng3d; + struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; struct nouveau_stateobj *so; - if (nv30->state.hw[NV30_STATE_STIPPLE] && - (rast->poly_stipple_enable == 0 && nv30->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,22 +19,22 @@ nv30_state_stipple_validate(struct nv30_context *nv30) so_data (so, 1); so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_PATTERN(0), 32); for (i = 0; i < 32; i++) - so_data(so, nv30->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, &nv30->state.hw[NV30_STATE_STIPPLE]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_STIPPLE]); so_ref(NULL, &so); return TRUE; } -struct nv30_state_entry nv30_state_stipple = { +struct nvfx_state_entry nv30_state_stipple = { .validate = nv30_state_stipple_validate, .dirty = { - .pipe = NV30_NEW_STIPPLE | NV30_NEW_RAST, - .hw = NV30_STATE_STIPPLE, + .pipe = NVFX_NEW_STIPPLE | NVFX_NEW_RAST, + .hw = NVFX_STATE_STIPPLE, } }; diff --git a/src/gallium/drivers/nv30/nv30_state_viewport.c b/src/gallium/drivers/nv30/nv30_state_viewport.c index 66fc112f3c0..2e9d5b14c7e 100644 --- a/src/gallium/drivers/nv30/nv30_state_viewport.c +++ b/src/gallium/drivers/nv30/nv30_state_viewport.c @@ -1,17 +1,17 @@ #include "nv30_context.h" static boolean -nv30_state_viewport_validate(struct nv30_context *nv30) +nv30_state_viewport_validate(struct nvfx_context *nvfx) { - struct pipe_viewport_state *vpt = &nv30->viewport; + struct pipe_viewport_state *vpt = &nvfx->viewport; struct nouveau_stateobj *so; - if (nv30->state.hw[NV30_STATE_VIEWPORT] && - !(nv30->dirty & NV30_NEW_VIEWPORT)) + if (nvfx->state.hw[NVFX_STATE_VIEWPORT] && + !(nvfx->dirty & NVFX_NEW_VIEWPORT)) return FALSE; so = so_new(3, 10, 0); - so_method(so, nv30->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,22 +21,22 @@ nv30_state_viewport_validate(struct nv30_context *nv30) so_data (so, fui(vpt->scale[1])); so_data (so, fui(vpt->scale[2])); so_data (so, fui(vpt->scale[3])); -/* so_method(so, nv30->screen->eng3d, 0x1d78, 1); +/* so_method(so, nvfx->screen->eng3d, 0x1d78, 1); so_data (so, 1); */ /* TODO/FIXME: never saw value 0x0110 in renouveau dumps, only 0x0001 */ - so_method(so, nv30->screen->eng3d, 0x1d78, 1); + so_method(so, nvfx->screen->eng3d, 0x1d78, 1); so_data (so, 1); - so_ref(so, &nv30->state.hw[NV30_STATE_VIEWPORT]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_VIEWPORT]); so_ref(NULL, &so); return TRUE; } -struct nv30_state_entry nv30_state_viewport = { +struct nvfx_state_entry nv30_state_viewport = { .validate = nv30_state_viewport_validate, .dirty = { - .pipe = NV30_NEW_VIEWPORT | NV30_NEW_RAST, - .hw = NV30_STATE_VIEWPORT + .pipe = NVFX_NEW_VIEWPORT | NVFX_NEW_RAST, + .hw = NVFX_STATE_VIEWPORT } }; diff --git a/src/gallium/drivers/nv30/nv30_state_zsa.c b/src/gallium/drivers/nv30/nv30_state_zsa.c index b0aac8ee46b..0832408edf2 100644 --- a/src/gallium/drivers/nv30/nv30_state_zsa.c +++ b/src/gallium/drivers/nv30/nv30_state_zsa.c @@ -1,41 +1,41 @@ #include "nv30_context.h" static boolean -nv30_state_zsa_validate(struct nv30_context *nv30) +nv30_state_zsa_validate(struct nvfx_context *nvfx) { - so_ref(nv30->zsa->so, - &nv30->state.hw[NV30_STATE_ZSA]); + so_ref(nvfx->zsa->so, + &nvfx->state.hw[NVFX_STATE_ZSA]); return TRUE; } -struct nv30_state_entry nv30_state_zsa = { +struct nvfx_state_entry nv30_state_zsa = { .validate = nv30_state_zsa_validate, .dirty = { - .pipe = NV30_NEW_ZSA, - .hw = NV30_STATE_ZSA + .pipe = NVFX_NEW_ZSA, + .hw = NVFX_STATE_ZSA } }; static boolean -nv30_state_sr_validate(struct nv30_context *nv30) +nv30_state_sr_validate(struct nvfx_context *nvfx) { struct nouveau_stateobj *so = so_new(2, 2, 0); - struct pipe_stencil_ref *sr = &nv30->stencil_ref; + struct pipe_stencil_ref *sr = &nvfx->stencil_ref; - so_method(so, nv30->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, nv30->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, &nv30->state.hw[NV30_STATE_SR]); + so_ref(so, &nvfx->state.hw[NVFX_STATE_SR]); so_ref(NULL, &so); return TRUE; } -struct nv30_state_entry nv30_state_sr = { +struct nvfx_state_entry nv30_state_sr = { .validate = nv30_state_sr_validate, .dirty = { - .pipe = NV30_NEW_SR, - .hw = NV30_STATE_SR + .pipe = NVFX_NEW_SR, + .hw = NVFX_STATE_SR } }; diff --git a/src/gallium/drivers/nv30/nv30_surface.c b/src/gallium/drivers/nv30/nv30_surface.c index bc18e577eee..613a9fa4921 100644 --- a/src/gallium/drivers/nv30/nv30_surface.c +++ b/src/gallium/drivers/nv30/nv30_surface.c @@ -37,8 +37,8 @@ nv30_surface_copy(struct pipe_context *pipe, struct pipe_surface *src, unsigned srcx, unsigned srcy, unsigned width, unsigned height) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv04_surface_2d *eng2d = nv30->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); } @@ -48,15 +48,15 @@ nv30_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest, unsigned destx, unsigned desty, unsigned width, unsigned height, unsigned value) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv04_surface_2d *eng2d = nv30->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 -nv30_init_surface_functions(struct nv30_context *nv30) +nv30_init_surface_functions(struct nvfx_context *nvfx) { - nv30->pipe.surface_copy = nv30_surface_copy; - nv30->pipe.surface_fill = nv30_surface_fill; + nvfx->pipe.surface_copy = nv30_surface_copy; + nvfx->pipe.surface_fill = nv30_surface_fill; } diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index cfc109bb740..3d71df52b90 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -6,8 +6,8 @@ #include "util/u_math.h" #include "nouveau/nouveau_winsys.h" #include "nv30_context.h" -#include "nv30_screen.h" -#include "nv30_state.h" +#include "nvfx_screen.h" +#include "nvfx_state.h" struct nv30_transfer { struct pipe_transfer base; @@ -39,7 +39,7 @@ nv30_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 nv30_miptree *mt = (struct nv30_miptree *)pt; + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; struct nv30_transfer *tx; struct pipe_texture tx_tex_template, *tx_tex; @@ -81,7 +81,7 @@ nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, return NULL; } - tx->base.stride = ((struct nv30_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 @@ nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt, } if (usage & PIPE_TRANSFER_READ) { - struct nv30_screen *nvscreen = nv30_screen(pscreen); + struct nvfx_screen *nvscreen = nvfx_screen(pscreen); struct pipe_surface *src; src = pscreen->get_tex_surface(pscreen, pt, @@ -125,7 +125,7 @@ nv30_transfer_del(struct pipe_context *pcontext, if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = pcontext->screen; - struct nv30_screen *nvscreen = nv30_screen(pscreen); + struct nvfx_screen *nvscreen = nvfx_screen(pscreen); struct pipe_surface *dst; dst = pscreen->get_tex_surface(pscreen, ptx->texture, @@ -152,7 +152,7 @@ nv30_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx) struct pipe_screen *pscreen = pcontext->screen; struct nv30_transfer *tx = (struct nv30_transfer *)ptx; struct nv04_surface *ns = (struct nv04_surface *)tx->surface; - struct nv30_miptree *mt = (struct nv30_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)); @@ -167,16 +167,16 @@ nv30_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx) { struct pipe_screen *pscreen = pcontext->screen; struct nv30_transfer *tx = (struct nv30_transfer *)ptx; - struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture; + struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture; pipe_buffer_unmap(pscreen, mt->buffer); } void -nv30_init_transfer_functions(struct nv30_context *nv30) +nv30_init_transfer_functions(struct nvfx_context *nvfx) { - nv30->pipe.get_tex_transfer = nv30_transfer_new; - nv30->pipe.tex_transfer_destroy = nv30_transfer_del; - nv30->pipe.transfer_map = nv30_transfer_map; - nv30->pipe.transfer_unmap = nv30_transfer_unmap; + nvfx->pipe.get_tex_transfer = nv30_transfer_new; + nvfx->pipe.tex_transfer_destroy = nv30_transfer_del; + nvfx->pipe.transfer_map = nv30_transfer_map; + nvfx->pipe.transfer_unmap = nv30_transfer_unmap; } diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c index c7f119e90a0..119fa59890e 100644 --- a/src/gallium/drivers/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nv30/nv30_vbo.c @@ -4,7 +4,7 @@ #include "util/u_format.h" #include "nv30_context.h" -#include "nv30_state.h" +#include "nvfx_state.h" #include "nouveau/nouveau_channel.h" #include "nouveau/nouveau_pushbuf.h" @@ -69,15 +69,15 @@ nv30_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp) } static boolean -nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib, +nv30_vbo_set_idxbuf(struct nvfx_context *nvfx, struct pipe_buffer *ib, unsigned ib_size) { - struct pipe_screen *pscreen = &nv30->screen->base.base; + struct pipe_screen *pscreen = &nvfx->screen->base.base; unsigned type; if (!ib) { - nv30->idxbuf = NULL; - nv30->idxbuf_format = 0xdeadbeef; + nvfx->idxbuf = NULL; + nvfx->idxbuf_format = 0xdeadbeef; return FALSE; } @@ -95,23 +95,23 @@ nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib, return FALSE; } - if (ib != nv30->idxbuf || - type != nv30->idxbuf_format) { - nv30->dirty |= NV30_NEW_ARRAYS; - nv30->idxbuf = ib; - nv30->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 -nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so, +nv30_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 = nv30->pipe.screen; - struct nouveau_grobj *eng3d = nv30->screen->eng3d; + struct pipe_screen *pscreen = nvfx->pipe.screen; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; unsigned type, ncomp; void *map; @@ -168,14 +168,14 @@ void nv30_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_screen *screen = nv30->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 = 0; - nv30_vbo_set_idxbuf(nv30, NULL, 0); - if (FORCE_SWTNL || !nv30_state_validate(nv30)) { + nv30_vbo_set_idxbuf(nvfx, NULL, 0); + if (FORCE_SWTNL || !nv30_state_validate(nvfx)) { /*return nv30_draw_elements_swtnl(pipe, NULL, 0, mode, start, count);*/ return; @@ -184,7 +184,7 @@ nv30_draw_arrays(struct pipe_context *pipe, while (count) { unsigned vc, nr; - nv30_state_emit(nv30); + nv30_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); @@ -227,10 +227,10 @@ nv30_draw_arrays(struct pipe_context *pipe, } static INLINE void -nv30_draw_elements_u08(struct nv30_context *nv30, void *ib, +nv30_draw_elements_u08(struct nvfx_context *nvfx, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nv30_screen *screen = nv30->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -238,7 +238,7 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib, uint8_t *elts = (uint8_t *)ib + start; unsigned vc, push, restart = 0; - nv30_state_emit(nv30); + nv30_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); @@ -278,10 +278,10 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib, } static INLINE void -nv30_draw_elements_u16(struct nv30_context *nv30, void *ib, +nv30_draw_elements_u16(struct nvfx_context *nvfx, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nv30_screen *screen = nv30->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -289,7 +289,7 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib, uint16_t *elts = (uint16_t *)ib + start; unsigned vc, push, restart = 0; - nv30_state_emit(nv30); + nv30_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); @@ -329,10 +329,10 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib, } static INLINE void -nv30_draw_elements_u32(struct nv30_context *nv30, void *ib, +nv30_draw_elements_u32(struct nvfx_context *nvfx, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nv30_screen *screen = nv30->screen; + struct nvfx_screen *screen = nvfx->screen; struct nouveau_channel *chan = screen->base.channel; struct nouveau_grobj *eng3d = screen->eng3d; @@ -340,7 +340,7 @@ nv30_draw_elements_u32(struct nv30_context *nv30, void *ib, uint32_t *elts = (uint32_t *)ib + start; unsigned vc, push, restart = 0; - nv30_state_emit(nv30); + nv30_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1, mode, start, count, &restart); @@ -375,7 +375,7 @@ nv30_draw_elements_inline(struct pipe_context *pipe, struct pipe_buffer *ib, unsigned ib_size, unsigned mode, unsigned start, unsigned count) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); struct pipe_screen *pscreen = pipe->screen; void *map; @@ -387,13 +387,13 @@ nv30_draw_elements_inline(struct pipe_context *pipe, switch (ib_size) { case 1: - nv30_draw_elements_u08(nv30, map, mode, start, count); + nv30_draw_elements_u08(nvfx, map, mode, start, count); break; case 2: - nv30_draw_elements_u16(nv30, map, mode, start, count); + nv30_draw_elements_u16(nvfx, map, mode, start, count); break; case 4: - nv30_draw_elements_u32(nv30, map, mode, start, count); + nv30_draw_elements_u32(nvfx, map, mode, start, count); break; default: NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size); @@ -407,8 +407,8 @@ static void nv30_draw_elements_vbo(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_screen *screen = nv30->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 = 0; @@ -416,7 +416,7 @@ nv30_draw_elements_vbo(struct pipe_context *pipe, while (count) { unsigned nr, vc; - nv30_state_emit(nv30); + nv30_state_emit(nvfx); vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); @@ -461,11 +461,11 @@ nv30_draw_elements(struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned mode, unsigned start, unsigned count) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); boolean idxbuf; - idxbuf = nv30_vbo_set_idxbuf(nv30, indexBuffer, indexSize); - if (FORCE_SWTNL || !nv30_state_validate(nv30)) { + idxbuf = nv30_vbo_set_idxbuf(nvfx, indexBuffer, indexSize); + if (FORCE_SWTNL || !nv30_state_validate(nvfx)) { /*return nv30_draw_elements_swtnl(pipe, NULL, 0, mode, start, count);*/ return; @@ -482,33 +482,33 @@ nv30_draw_elements(struct pipe_context *pipe, } static boolean -nv30_vbo_validate(struct nv30_context *nv30) +nv30_vbo_validate(struct nvfx_context *nvfx) { struct nouveau_stateobj *vtxbuf, *vtxfmt, *sattr = NULL; - struct nouveau_grobj *eng3d = nv30->screen->eng3d; - struct pipe_buffer *ib = nv30->idxbuf; - unsigned ib_format = nv30->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), nv30->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), nv30->vtxelt->num_elements); + so_method(vtxfmt, eng3d, NV34TCL_VTXFMT(0), nvfx->vtxelt->num_elements); - for (hw = 0; hw < nv30->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 = &nv30->vtxelt->pipe[hw]; - vb = &nv30->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 (nv30_vbo_static_attrib(nv30, sattr, hw, ve, vb)) { + if (nv30_vbo_static_attrib(nvfx, sattr, hw, ve, vb)) { so_data(vtxbuf, 0); so_data(vtxfmt, NV34TCL_VTXFMT_TYPE_FLOAT); continue; @@ -516,7 +516,7 @@ nv30_vbo_validate(struct nv30_context *nv30) } if (nv30_vbo_format_to_hw(ve->src_format, &type, &ncomp)) { - /*nv30->fallback_swtnl |= NV30_NEW_ARRAYS;*/ + /*nvfx->fallback_swtnl |= NVFX_NEW_ARRAYS;*/ so_ref(NULL, &vtxbuf); so_ref(NULL, &vtxfmt); return FALSE; @@ -541,22 +541,22 @@ nv30_vbo_validate(struct nv30_context *nv30) so_method(vtxbuf, eng3d, 0x1710, 1); so_data (vtxbuf, 0); - so_ref(vtxbuf, &nv30->state.hw[NV30_STATE_VTXBUF]); + so_ref(vtxbuf, &nvfx->state.hw[NVFX_STATE_VTXBUF]); so_ref(NULL, &vtxbuf); - nv30->state.dirty |= (1ULL << NV30_STATE_VTXBUF); - so_ref(vtxfmt, &nv30->state.hw[NV30_STATE_VTXFMT]); + nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXBUF); + so_ref(vtxfmt, &nvfx->state.hw[NVFX_STATE_VTXFMT]); so_ref(NULL, &vtxfmt); - nv30->state.dirty |= (1ULL << NV30_STATE_VTXFMT); - so_ref(sattr, &nv30->state.hw[NV30_STATE_VTXATTR]); + nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXFMT); + so_ref(sattr, &nvfx->state.hw[NVFX_STATE_VTXATTR]); so_ref(NULL, &sattr); - nv30->state.dirty |= (1ULL << NV30_STATE_VTXATTR); + nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXATTR); return FALSE; } -struct nv30_state_entry nv30_state_vbo = { +struct nvfx_state_entry nv30_state_vbo = { .validate = nv30_vbo_validate, .dirty = { - .pipe = NV30_NEW_ARRAYS, + .pipe = NVFX_NEW_ARRAYS, .hw = 0, } }; diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index f0cecba4c46..cf910e34b11 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -8,7 +8,7 @@ #include "tgsi/tgsi_dump.h" #include "nv30_context.h" -#include "nv30_state.h" +#include "nvfx_state.h" /* TODO (at least...): * 1. Indexed consts + ARL @@ -40,9 +40,9 @@ #define abs(s) nv30_sr_abs((s)) struct nv30_vpc { - struct nv30_vertex_program *vp; + struct nvfx_vertex_program *vp; - struct nv30_vertex_program_exec *vpi; + struct nvfx_vertex_program_exec *vpi; unsigned output_map[PIPE_MAX_SHADER_OUTPUTS]; @@ -66,8 +66,8 @@ temp(struct nv30_vpc *vpc) static struct nv30_sreg constant(struct nv30_vpc *vpc, int pipe, float x, float y, float z, float w) { - struct nv30_vertex_program *vp = vpc->vp; - struct nv30_vertex_program_data *vpd; + struct nvfx_vertex_program *vp = vpc->vp; + struct nvfx_vertex_program_data *vpd; int idx; if (pipe >= 0) { @@ -95,7 +95,7 @@ constant(struct nv30_vpc *vpc, int pipe, float x, float y, float z, float w) static void emit_src(struct nv30_vpc *vpc, uint32_t *hw, int pos, struct nv30_sreg src) { - struct nv30_vertex_program *vp = vpc->vp; + struct nvfx_vertex_program *vp = vpc->vp; uint32_t sr = 0; switch (src.type) { @@ -166,7 +166,7 @@ emit_src(struct nv30_vpc *vpc, uint32_t *hw, int pos, struct nv30_sreg src) static void emit_dst(struct nv30_vpc *vpc, uint32_t *hw, int slot, struct nv30_sreg dst) { - struct nv30_vertex_program *vp = vpc->vp; + struct nvfx_vertex_program *vp = vpc->vp; switch (dst.type) { case NV30SR_TEMP: @@ -211,7 +211,7 @@ nv30_vp_arith(struct nv30_vpc *vpc, int slot, int op, struct nv30_sreg s0, struct nv30_sreg s1, struct nv30_sreg s2) { - struct nv30_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)); @@ -572,8 +572,8 @@ nv30_vertprog_prepare(struct nv30_vpc *vpc) } static void -nv30_vertprog_translate(struct nv30_context *nv30, - struct nv30_vertex_program *vp) +nv30_vertprog_translate(struct nvfx_context *nvfx, + struct nvfx_vertex_program *vp) { struct tgsi_parse_context parse; struct nv30_vpc *vpc = NULL; @@ -647,36 +647,36 @@ out_err: } static boolean -nv30_vertprog_validate(struct nv30_context *nv30) +nv30_vertprog_validate(struct nvfx_context *nvfx) { - struct pipe_screen *pscreen = nv30->pipe.screen; - struct nv30_screen *screen = nv30->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 nv30_vertex_program *vp; + struct nvfx_vertex_program *vp; struct pipe_buffer *constbuf; boolean upload_code = FALSE, upload_data = FALSE; int i; - vp = nv30->vertprog; - constbuf = nv30->constbuf[PIPE_SHADER_VERTEX]; + vp = nvfx->vertprog; + constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX]; /* Translate TGSI shader into hw bytecode */ if (!vp->translated) { - nv30_vertprog_translate(nv30, vp); + nv30_vertprog_translate(nvfx, vp); if (!vp->translated) return FALSE; } /* Allocate hw vtxprog exec slots */ if (!vp->exec) { - struct nouveau_resource *heap = nv30->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 nv30_vertex_program *evict; + struct nvfx_vertex_program *evict; evict = heap->next->priv; nouveau_resource_free(&evict->exec); @@ -697,11 +697,11 @@ nv30_vertprog_validate(struct nv30_context *nv30) /* Allocate hw vtxprog const slots */ if (vp->nr_consts && !vp->data) { - struct nouveau_resource *heap = nv30->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 nv30_vertex_program *evict; + struct nvfx_vertex_program *evict; evict = heap->next->priv; nouveau_resource_free(&evict->data); @@ -725,7 +725,7 @@ nv30_vertprog_validate(struct nv30_context *nv30) */ if (vp->exec_start != vp->exec->start) { for (i = 0; i < vp->nr_insns; i++) { - struct nv30_vertex_program_exec *vpi = &vp->insns[i]; + struct nvfx_vertex_program_exec *vpi = &vp->insns[i]; if (vpi->has_branch_offset) { assert(0); @@ -737,7 +737,7 @@ nv30_vertprog_validate(struct nv30_context *nv30) if (vp->nr_consts && vp->data_start != vp->data->start) { for (i = 0; i < vp->nr_insns; i++) { - struct nv30_vertex_program_exec *vpi = &vp->insns[i]; + struct nvfx_vertex_program_exec *vpi = &vp->insns[i]; if (vpi->const_index >= 0) { vpi->data[1] &= ~NV30_VP_INST_CONST_SRC_MASK; @@ -761,7 +761,7 @@ nv30_vertprog_validate(struct nv30_context *nv30) } for (i = 0; i < vp->nr_consts; i++) { - struct nv30_vertex_program_data *vpd = &vp->consts[i]; + struct nvfx_vertex_program_data *vpd = &vp->consts[i]; if (vpd->index >= 0) { if (!upload_data && @@ -798,8 +798,8 @@ nv30_vertprog_validate(struct nv30_context *nv30) } } - if (vp->so != nv30->state.hw[NV30_STATE_VERTPROG]) { - so_ref(vp->so, &nv30->state.hw[NV30_STATE_VERTPROG]); + if (vp->so != nvfx->state.hw[NVFX_STATE_VERTPROG]) { + so_ref(vp->so, &nvfx->state.hw[NVFX_STATE_VERTPROG]); return TRUE; } @@ -807,7 +807,7 @@ nv30_vertprog_validate(struct nv30_context *nv30) } void -nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp) +nv30_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp) { vp->translated = FALSE; @@ -833,10 +833,10 @@ nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp) so_ref(NULL, &vp->so); } -struct nv30_state_entry nv30_state_vertprog = { +struct nvfx_state_entry nv30_state_vertprog = { .validate = nv30_vertprog_validate, .dirty = { - .pipe = NV30_NEW_VERTPROG /*| NV30_NEW_UCP*/, - .hw = NV30_STATE_VERTPROG, + .pipe = NVFX_NEW_VERTPROG /*| NVFX_NEW_UCP*/, + .hw = NVFX_STATE_VERTPROG, } }; |