summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-02-20 18:37:43 +0100
committerYounes Manton <younes.m@gmail.com>2010-03-15 00:03:01 -0400
commitb8e56d4cddbd9c491b940e3ce5974c526802c752 (patch)
tree6ae0a1030c6a43c6596393b787cea3d7b7e23352
parentd673c92810636dcc6de33d3618d494ce9f5717c1 (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).
-rw-r--r--src/gallium/drivers/nv30/Makefile2
-rw-r--r--src/gallium/drivers/nv30/nv30_clear.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c78
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h215
-rw-r--r--src/gallium/drivers/nv30/nv30_draw.c8
-rw-r--r--src/gallium/drivers/nv30/nv30_fragprog.c66
-rw-r--r--src/gallium/drivers/nv30/nv30_fragtex.c34
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c18
-rw-r--r--src/gallium/drivers/nv30/nv30_query.c32
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c10
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.h38
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c254
-rw-r--r--src/gallium/drivers/nv30/nv30_state.h86
-rw-r--r--src/gallium/drivers/nv30/nv30_state_blend.c24
-rw-r--r--src/gallium/drivers/nv30/nv30_state_emit.c75
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c24
-rw-r--r--src/gallium/drivers/nv30/nv30_state_rasterizer.c12
-rw-r--r--src/gallium/drivers/nv30/nv30_state_scissor.c24
-rw-r--r--src/gallium/drivers/nv30/nv30_state_stipple.c20
-rw-r--r--src/gallium/drivers/nv30/nv30_state_viewport.c22
-rw-r--r--src/gallium/drivers/nv30/nv30_state_zsa.c28
-rw-r--r--src/gallium/drivers/nv30/nv30_surface.c14
-rw-r--r--src/gallium/drivers/nv30/nv30_transfer.c26
-rw-r--r--src/gallium/drivers/nv30/nv30_vbo.c112
-rw-r--r--src/gallium/drivers/nv30/nv30_vertprog.c60
-rw-r--r--src/gallium/drivers/nv40/Makefile2
-rw-r--r--src/gallium/drivers/nv40/nv40_clear.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c78
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h235
-rw-r--r--src/gallium/drivers/nv40/nv40_draw.c116
-rw-r--r--src/gallium/drivers/nv40/nv40_fragprog.c62
-rw-r--r--src/gallium/drivers/nv40/nv40_fragtex.c36
-rw-r--r--src/gallium/drivers/nv40/nv40_miptree.c18
-rw-r--r--src/gallium/drivers/nv40/nv40_query.c32
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c12
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c262
-rw-r--r--src/gallium/drivers/nv40/nv40_state_blend.c24
-rw-r--r--src/gallium/drivers/nv40/nv40_state_emit.c126
-rw-r--r--src/gallium/drivers/nv40/nv40_state_fb.c18
-rw-r--r--src/gallium/drivers/nv40/nv40_state_rasterizer.c12
-rw-r--r--src/gallium/drivers/nv40/nv40_state_scissor.c24
-rw-r--r--src/gallium/drivers/nv40/nv40_state_stipple.c20
-rw-r--r--src/gallium/drivers/nv40/nv40_state_viewport.c20
-rw-r--r--src/gallium/drivers/nv40/nv40_state_zsa.c28
-rw-r--r--src/gallium/drivers/nv40/nv40_surface.c14
-rw-r--r--src/gallium/drivers/nv40/nv40_transfer.c26
-rw-r--r--src/gallium/drivers/nv40/nv40_vbo.c112
-rw-r--r--src/gallium/drivers/nv40/nv40_vertprog.c84
-rw-r--r--src/gallium/drivers/nvfx/nvfx_context.h182
-rw-r--r--src/gallium/drivers/nvfx/nvfx_screen.h (renamed from src/gallium/drivers/nv40/nv40_screen.h)16
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.h (renamed from src/gallium/drivers/nv40/nv40_state.h)28
51 files changed, 1298 insertions, 1575 deletions
diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile
index 364c80d8f3..ed02075d13 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 c4ba926664..e7ba73de7c 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 be6407805b..628b50d8dc 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 4a164f3b1f..2fc148cded 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 74fc138c05..5d22e78abf 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 4c96e6d733..ae246ffd64 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 63b5015ed4..34e7dd5444 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 bfa27b632f..ada355a444 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 21a5e8ad7c..53b11a8943 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 40193f2795..305dfa8386 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 69a94593f9..0000000000
--- 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 330448000b..5263f894f2 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 b1c7f84a0a..0000000000
--- 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 eb0199cf65..de368e5bd7 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 deefe7fd8d..6df93618da 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 23d17c0c60..e9e215dcce 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 6d1b60e043..1a83da5204 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 f58bb0161e..e91680e2d1 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 46a6975438..eceb0c57f9 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 66fc112f3c..2e9d5b14c7 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 b0aac8ee46..0832408edf 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 bc18e577ee..613a9fa492 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 cfc109bb74..3d71df52b9 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 c7f119e90a..119fa59890 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 f0cecba4c4..cf910e34b1 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,
}
};
diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile
index 0ecae2b491..50e5e72b4e 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 ddf13addf3..79de90434d 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 da35676fd5..721b513438 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 cb5d9e2d9d..7227c4a438 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 05d237d1bb..cce1c64621 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 3d08828bea..2a0ab0cf31 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 4c26f3cb12..0b46a5313b 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 62e97bcea4..caec47058f 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 899a8dc0b2..48cfc4d593 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 3c901c1c53..0fc8e18750 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_state.c b/src/gallium/drivers/nv40/nv40_state.c
index e8076e059b..a205342ac5 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_blend.c b/src/gallium/drivers/nv40/nv40_state_blend.c
index 83202ec23c..bb06b4888d 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 6ad7a8d4fd..5c437f9969 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 207b70923e..95735e40a3 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 9ecda5990f..d6136a26eb 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 dcb068d059..11ec5c0878 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 4514618772..e537e08e1d 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 43cf6e5a0a..bf73e1119e 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 cb56948a1b..00facd520a 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 02ecfd7bbb..328c23b8b4 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 c552a68113..3d8c8e8c78 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 b77c9e924b..0738d5c93b 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 96f2743429..a199f0766e 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,
}
};
diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h
new file mode 100644
index 0000000000..9e89d8409f
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_context.h
@@ -0,0 +1,182 @@
+#ifndef __NVFX_CONTEXT_H__
+#define __NVFX_CONTEXT_H__
+
+#include <stdio.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 "nvfx_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 nvfx_state_index {
+ NVFX_STATE_FB = 0,
+ NVFX_STATE_VIEWPORT = 1,
+ NVFX_STATE_BLEND = 2,
+ NVFX_STATE_RAST = 3,
+ NVFX_STATE_ZSA = 4,
+ NVFX_STATE_BCOL = 5,
+ NVFX_STATE_CLIP = 6,
+ NVFX_STATE_SCISSOR = 7,
+ NVFX_STATE_STIPPLE = 8,
+ NVFX_STATE_FRAGPROG = 9,
+ NVFX_STATE_VERTPROG = 10,
+ NVFX_STATE_FRAGTEX0 = 11,
+ NVFX_STATE_FRAGTEX1 = 12,
+ NVFX_STATE_FRAGTEX2 = 13,
+ NVFX_STATE_FRAGTEX3 = 14,
+ NVFX_STATE_FRAGTEX4 = 15,
+ NVFX_STATE_FRAGTEX5 = 16,
+ NVFX_STATE_FRAGTEX6 = 17,
+ NVFX_STATE_FRAGTEX7 = 18,
+ NVFX_STATE_FRAGTEX8 = 19,
+ NVFX_STATE_FRAGTEX9 = 20,
+ NVFX_STATE_FRAGTEX10 = 21,
+ NVFX_STATE_FRAGTEX11 = 22,
+ NVFX_STATE_FRAGTEX12 = 23,
+ NVFX_STATE_FRAGTEX13 = 24,
+ NVFX_STATE_FRAGTEX14 = 25,
+ NVFX_STATE_FRAGTEX15 = 26,
+ NVFX_STATE_VERTTEX0 = 27,
+ NVFX_STATE_VERTTEX1 = 28,
+ NVFX_STATE_VERTTEX2 = 29,
+ NVFX_STATE_VERTTEX3 = 30,
+ NVFX_STATE_VTXBUF = 31,
+ NVFX_STATE_VTXFMT = 32,
+ NVFX_STATE_VTXATTR = 33,
+ NVFX_STATE_SR = 34,
+ NVFX_STATE_MAX = 35
+};
+
+#include "nvfx_screen.h"
+
+#define NVFX_NEW_BLEND (1 << 0)
+#define NVFX_NEW_RAST (1 << 1)
+#define NVFX_NEW_ZSA (1 << 2)
+#define NVFX_NEW_SAMPLER (1 << 3)
+#define NVFX_NEW_FB (1 << 4)
+#define NVFX_NEW_STIPPLE (1 << 5)
+#define NVFX_NEW_SCISSOR (1 << 6)
+#define NVFX_NEW_VIEWPORT (1 << 7)
+#define NVFX_NEW_BCOL (1 << 8)
+#define NVFX_NEW_VERTPROG (1 << 9)
+#define NVFX_NEW_FRAGPROG (1 << 10)
+#define NVFX_NEW_ARRAYS (1 << 11)
+#define NVFX_NEW_UCP (1 << 12)
+#define NVFX_NEW_SR (1 << 13)
+
+struct nvfx_rasterizer_state {
+ struct pipe_rasterizer_state pipe;
+ struct nouveau_stateobj *so;
+};
+
+struct nvfx_zsa_state {
+ struct pipe_depth_stencil_alpha_state pipe;
+ struct nouveau_stateobj *so;
+};
+
+struct nvfx_blend_state {
+ struct pipe_blend_state pipe;
+ struct nouveau_stateobj *so;
+};
+
+
+struct nvfx_state {
+ unsigned scissor_enabled;
+ unsigned stipple_enabled;
+ unsigned fp_samplers;
+
+ uint64_t dirty;
+ struct nouveau_stateobj *hw[NVFX_STATE_MAX];
+};
+
+struct nvfx_vtxelt_state {
+ struct pipe_vertex_element pipe[16];
+ unsigned num_elements;
+};
+
+struct nvfx_context {
+ struct pipe_context pipe;
+
+ struct nouveau_winsys *nvws;
+ struct nvfx_screen *screen;
+
+ struct draw_context *draw;
+
+ /* HW state derived from pipe states */
+ struct nvfx_state state;
+ struct {
+ struct nvfx_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 nvfx_vertex_program *vertprog;
+ struct nvfx_fragment_program *fragprog;
+ struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+ unsigned constbuf_nr[PIPE_SHADER_TYPES];
+ struct nvfx_rasterizer_state *rasterizer;
+ struct nvfx_zsa_state *zsa;
+ struct nvfx_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 nvfx_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
+ struct nvfx_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 nvfx_vtxelt_state *vtxelt;
+};
+
+static INLINE struct nvfx_context *
+nvfx_context(struct pipe_context *pipe)
+{
+ return (struct nvfx_context *)pipe;
+}
+
+struct nvfx_state_entry {
+ boolean (*validate)(struct nvfx_context *nvfx);
+ struct {
+ unsigned pipe;
+ unsigned hw;
+ } dirty;
+};
+
+#endif
diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h
index ad0ee63da6..b56f2d4b3f 100644
--- a/src/gallium/drivers/nv40/nv40_screen.h
+++ b/src/gallium/drivers/nvfx/nvfx_screen.h
@@ -1,15 +1,15 @@
-#ifndef __NV40_SCREEN_H__
-#define __NV40_SCREEN_H__
+#ifndef __NVFX_SCREEN_H__
+#define __NVFX_SCREEN_H__
#include "nouveau/nouveau_screen.h"
#include "nouveau/nv04_surface_2d.h"
-struct nv40_screen {
+struct nvfx_screen {
struct nouveau_screen base;
struct nouveau_winsys *nvws;
- struct nv40_context *cur_ctx;
+ struct nvfx_context *cur_ctx;
/* HW graphics objects */
struct nv04_surface_2d *eng2d;
@@ -25,13 +25,13 @@ struct nv40_screen {
struct nouveau_resource *vp_data_heap;
/* Current 3D state of channel */
- struct nouveau_stateobj *state[NV40_STATE_MAX];
+ struct nouveau_stateobj *state[NVFX_STATE_MAX];
};
-static INLINE struct nv40_screen *
-nv40_screen(struct pipe_screen *screen)
+static INLINE struct nvfx_screen *
+nvfx_screen(struct pipe_screen *screen)
{
- return (struct nv40_screen *)screen;
+ return (struct nvfx_screen *)screen;
}
#endif
diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nvfx/nvfx_state.h
index e2e69420ea..b243b1020f 100644
--- a/src/gallium/drivers/nv40/nv40_state.h
+++ b/src/gallium/drivers/nvfx/nvfx_state.h
@@ -1,10 +1,10 @@
-#ifndef __NV40_STATE_H__
-#define __NV40_STATE_H__
+#ifndef __NVFX_STATE_H__
+#define __NVFX_STATE_H__
#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h"
-struct nv40_sampler_state {
+struct nvfx_sampler_state {
uint32_t fmt;
uint32_t wrap;
uint32_t en;
@@ -12,18 +12,18 @@ struct nv40_sampler_state {
uint32_t bcol;
};
-struct nv40_vertex_program_exec {
+struct nvfx_vertex_program_exec {
uint32_t data[4];
boolean has_branch_offset;
int const_index;
};
-struct nv40_vertex_program_data {
+struct nvfx_vertex_program_data {
int index; /* immediates == -1 */
float value[4];
};
-struct nv40_vertex_program {
+struct nvfx_vertex_program {
struct pipe_shader_state pipe;
struct draw_vertex_shader *draw;
@@ -32,9 +32,9 @@ struct nv40_vertex_program {
struct pipe_clip_state ucp;
- struct nv40_vertex_program_exec *insns;
+ struct nvfx_vertex_program_exec *insns;
unsigned nr_insns;
- struct nv40_vertex_program_data *consts;
+ struct nvfx_vertex_program_data *consts;
unsigned nr_consts;
struct nouveau_resource *exec;
@@ -49,12 +49,12 @@ struct nv40_vertex_program {
struct nouveau_stateobj *so;
};
-struct nv40_fragment_program_data {
+struct nvfx_fragment_program_data {
unsigned offset;
unsigned index;
};
-struct nv40_fragment_program {
+struct nvfx_fragment_program {
struct pipe_shader_state pipe;
struct tgsi_shader_info info;
@@ -64,7 +64,7 @@ struct nv40_fragment_program {
uint32_t *insn;
int insn_len;
- struct nv40_fragment_program_data *consts;
+ struct nvfx_fragment_program_data *consts;
unsigned nr_consts;
struct pipe_buffer *buffer;
@@ -73,9 +73,9 @@ struct nv40_fragment_program {
struct nouveau_stateobj *so;
};
-#define NV40_MAX_TEXTURE_LEVELS 16
+#define NVFX_MAX_TEXTURE_LEVELS 16
-struct nv40_miptree {
+struct nvfx_miptree {
struct pipe_texture base;
struct nouveau_bo *bo;
@@ -85,7 +85,7 @@ struct nv40_miptree {
struct {
uint pitch;
uint *image_offset;
- } level[NV40_MAX_TEXTURE_LEVELS];
+ } level[NVFX_MAX_TEXTURE_LEVELS];
};
#endif