nv30_vbo.c \
nv30_vertprog.c
+LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/nvfx
+
include ../../Makefile.template
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);
}
#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;
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;
}
#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,
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);
struct nv30_draw_stage {
struct draw_stage draw;
- struct nv30_context *nv30;
+ struct nvfx_context *nvfx;
};
static void
}
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;
#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];
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);
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;
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));
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) {
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;
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);
}
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;
}
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;
}
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;
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);
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];
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;
}
}
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);
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
}
};
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;
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);
}
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;
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
}
};
#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;
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;
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;
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);
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);
* 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;
}
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);
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;
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);
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);
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);
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);
}
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;
}
#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
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;
}
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]);
}
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;
+++ /dev/null
-#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
#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) {
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);
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
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
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
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);
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));
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);
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;
}
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);
}
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);
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);
}
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
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;
}
}
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 *
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;
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;
}
+++ /dev/null
-#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
#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
}
};
#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,
};
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);
}
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)
#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;
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++) {
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);
}
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);
}
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);
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
}
};
#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
}
};
#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 {
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
}
};
#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) {
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,
}
};
#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]));
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
}
};
#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
}
};
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);
}
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;
}
#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;
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;
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,
}
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,
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,
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));
{
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;
}
#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"
}
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;
}
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;
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;
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);
}
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;
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);
}
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;
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);
}
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;
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);
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;
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);
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;
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);
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;
}
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;
}
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;
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,
}
};
#include "tgsi/tgsi_dump.h"
#include "nv30_context.h"
-#include "nv30_state.h"
+#include "nvfx_state.h"
/* TODO (at least...):
* 1. Indexed consts + ARL
#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];
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) {
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) {
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:
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));
}
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;
}
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);
/* 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);
*/
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);
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;
}
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 &&
}
}
- 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;
}
}
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;
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,
}
};
nv40_vbo.c \
nv40_vertprog.c
+LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/nvfx
+
include ../../Makefile.template
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);
}
#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;
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;
}
#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,
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);
struct nv40_render_stage {
struct draw_stage stage;
- struct nv40_context *nv40;
+ struct nvfx_context *nvfx;
unsigned prim;
};
}
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:
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;
assert(0);
}
FIRE_RING(chan);
- nv40_state_emit(nv40);
+ nv40_state_emit(nvfx);
}
/* Switch primitive modes if necessary */
/* 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.
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;
}
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];
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);
}
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;
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 */
}
}
- 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
}
};
#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];
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);
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;
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));
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) {
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;
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);
}
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;
}
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;
}
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;
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);
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];
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;
}
}
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);
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
}
};
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;
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);
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;
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
}
};
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;
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;
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;
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);
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);
* 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;
}
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);
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;
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);
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;
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);
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);
}
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;
}
#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
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:
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;
}
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]);
}
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;
+++ /dev/null
-#ifndef __NV40_SCREEN_H__
-#define __NV40_SCREEN_H__
-
-#include "nouveau/nouveau_screen.h"
-#include "nouveau/nv04_surface_2d.h"
-
-struct nv40_screen {
- struct nouveau_screen base;
-
- struct nouveau_winsys *nvws;
-
- struct nv40_context *cur_ctx;
-
- /* HW graphics objects */
- struct nv04_surface_2d *eng2d;
- struct nouveau_grobj *eng3d;
- struct nouveau_notifier *sync;
-
- /* Query object resources */
- struct nouveau_notifier *query;
- struct nouveau_resource *query_heap;
-
- /* Vtxprog resources */
- struct nouveau_resource *vp_exec_heap;
- struct nouveau_resource *vp_data_heap;
-
- /* Current 3D state of channel */
- struct nouveau_stateobj *state[NV40_STATE_MAX];
-};
-
-static INLINE struct nv40_screen *
-nv40_screen(struct pipe_screen *screen)
-{
- return (struct nv40_screen *)screen;
-}
-
-#endif
#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) {
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);
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)
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
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
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);
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));
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);
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;
}
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);
}
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);
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);
}
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;
}
}
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 *
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;
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;
}
+++ /dev/null
-#ifndef __NV40_STATE_H__
-#define __NV40_STATE_H__
-
-#include "pipe/p_state.h"
-#include "tgsi/tgsi_scan.h"
-
-struct nv40_sampler_state {
- uint32_t fmt;
- uint32_t wrap;
- uint32_t en;
- uint32_t filt;
- uint32_t bcol;
-};
-
-struct nv40_vertex_program_exec {
- uint32_t data[4];
- boolean has_branch_offset;
- int const_index;
-};
-
-struct nv40_vertex_program_data {
- int index; /* immediates == -1 */
- float value[4];
-};
-
-struct nv40_vertex_program {
- struct pipe_shader_state pipe;
-
- struct draw_vertex_shader *draw;
-
- boolean translated;
-
- struct pipe_clip_state ucp;
-
- struct nv40_vertex_program_exec *insns;
- unsigned nr_insns;
- struct nv40_vertex_program_data *consts;
- unsigned nr_consts;
-
- struct nouveau_resource *exec;
- unsigned exec_start;
- struct nouveau_resource *data;
- unsigned data_start;
- unsigned data_start_min;
-
- uint32_t ir;
- uint32_t or;
- uint32_t clip_ctrl;
- struct nouveau_stateobj *so;
-};
-
-struct nv40_fragment_program_data {
- unsigned offset;
- unsigned index;
-};
-
-struct nv40_fragment_program {
- struct pipe_shader_state pipe;
- struct tgsi_shader_info info;
-
- boolean translated;
- unsigned samplers;
-
- uint32_t *insn;
- int insn_len;
-
- struct nv40_fragment_program_data *consts;
- unsigned nr_consts;
-
- struct pipe_buffer *buffer;
-
- uint32_t fp_control;
- struct nouveau_stateobj *so;
-};
-
-#define NV40_MAX_TEXTURE_LEVELS 16
-
-struct nv40_miptree {
- struct pipe_texture base;
- struct nouveau_bo *bo;
-
- struct pipe_buffer *buffer;
- uint total_size;
-
- struct {
- uint pitch;
- uint *image_offset;
- } level[NV40_MAX_TEXTURE_LEVELS];
-};
-
-#endif
#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
}
};
#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,
NULL
};
-static struct nv40_state_entry *swtnl_states[] = {
+static struct nvfx_state_entry *swtnl_states[] = {
&nv40_state_framebuffer,
&nv40_state_rasterizer,
&nv40_state_scissor,
};
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;
/* 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);
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)
}
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;
}
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;
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
}
};
#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
}
};
#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 {
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
}
};
#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) {
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,
}
};
#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]));
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
}
};
#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
}
};
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);
}
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;
}
#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;
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;
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,
}
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,
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,
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));
{
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;
}
#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"
}
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;
}
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;
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;
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);
}
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;
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);
}
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;
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);
}
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;
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);
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;
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);
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;
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);
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;
}
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;
}
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;
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,
}
};
#include "tgsi/tgsi_util.h"
#include "nv40_context.h"
-#include "nv40_state.h"
+#include "nvfx_state.h"
/* TODO (at least...):
* 1. Indexed consts + ARL
#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;
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) {
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) {
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:
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));
}
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;
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;
}
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;
}
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);
/* 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);
*/
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);
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;
}
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 &&
}
}
- 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;
}
}
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;
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,
}
};
--- /dev/null
+#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
--- /dev/null
+#ifndef __NVFX_SCREEN_H__
+#define __NVFX_SCREEN_H__
+
+#include "nouveau/nouveau_screen.h"
+#include "nouveau/nv04_surface_2d.h"
+
+struct nvfx_screen {
+ struct nouveau_screen base;
+
+ struct nouveau_winsys *nvws;
+
+ struct nvfx_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[NVFX_STATE_MAX];
+};
+
+static INLINE struct nvfx_screen *
+nvfx_screen(struct pipe_screen *screen)
+{
+ return (struct nvfx_screen *)screen;
+}
+
+#endif
--- /dev/null
+#ifndef __NVFX_STATE_H__
+#define __NVFX_STATE_H__
+
+#include "pipe/p_state.h"
+#include "tgsi/tgsi_scan.h"
+
+struct nvfx_sampler_state {
+ uint32_t fmt;
+ uint32_t wrap;
+ uint32_t en;
+ uint32_t filt;
+ uint32_t bcol;
+};
+
+struct nvfx_vertex_program_exec {
+ uint32_t data[4];
+ boolean has_branch_offset;
+ int const_index;
+};
+
+struct nvfx_vertex_program_data {
+ int index; /* immediates == -1 */
+ float value[4];
+};
+
+struct nvfx_vertex_program {
+ struct pipe_shader_state pipe;
+
+ struct draw_vertex_shader *draw;
+
+ boolean translated;
+
+ struct pipe_clip_state ucp;
+
+ struct nvfx_vertex_program_exec *insns;
+ unsigned nr_insns;
+ struct nvfx_vertex_program_data *consts;
+ unsigned nr_consts;
+
+ struct nouveau_resource *exec;
+ unsigned exec_start;
+ struct nouveau_resource *data;
+ unsigned data_start;
+ unsigned data_start_min;
+
+ uint32_t ir;
+ uint32_t or;
+ uint32_t clip_ctrl;
+ struct nouveau_stateobj *so;
+};
+
+struct nvfx_fragment_program_data {
+ unsigned offset;
+ unsigned index;
+};
+
+struct nvfx_fragment_program {
+ struct pipe_shader_state pipe;
+ struct tgsi_shader_info info;
+
+ boolean translated;
+ unsigned samplers;
+
+ uint32_t *insn;
+ int insn_len;
+
+ struct nvfx_fragment_program_data *consts;
+ unsigned nr_consts;
+
+ struct pipe_buffer *buffer;
+
+ uint32_t fp_control;
+ struct nouveau_stateobj *so;
+};
+
+#define NVFX_MAX_TEXTURE_LEVELS 16
+
+struct nvfx_miptree {
+ struct pipe_texture base;
+ struct nouveau_bo *bo;
+
+ struct pipe_buffer *buffer;
+ uint total_size;
+
+ struct {
+ uint pitch;
+ uint *image_offset;
+ } level[NVFX_MAX_TEXTURE_LEVELS];
+};
+
+#endif