summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <darktama@beleth.(none)>2008-02-22 14:46:48 +1100
committerBen Skeggs <darktama@beleth.(none)>2008-02-22 14:46:48 +1100
commit7b938431d0ab5ccce1e7e2b1c38e1dcbdc6001e8 (patch)
tree38cc708d5414c4ba6165995bf9b45c722f265d70
parentc2e36bdd1a58ba6f58c4e72db1f7f64e8bd05901 (diff)
nv40: stateobj start out with 0 refcount
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h2
-rw-r--r--src/gallium/drivers/nv40/nv40_fragprog.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_fragtex.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c12
-rw-r--r--src/gallium/drivers/nv40/nv40_state_blend.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_state_fb.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_state_scissor.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_state_stipple.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_state_viewport.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_vbo.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_vertprog.c1
11 files changed, 7 insertions, 17 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 459cc7d77a..439c7e4734 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -32,7 +32,7 @@ so_new(unsigned push, unsigned reloc)
struct nouveau_stateobj *so;
so = MALLOC(sizeof(struct nouveau_stateobj));
- so->refcount = 1;
+ so->refcount = 0;
so->push = MALLOC(sizeof(unsigned) * push);
so->reloc = MALLOC(sizeof(struct nouveau_stateobj_reloc) * reloc);
diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c
index db2613ef8b..a4a1ea01e0 100644
--- a/src/gallium/drivers/nv40/nv40_fragprog.c
+++ b/src/gallium/drivers/nv40/nv40_fragprog.c
@@ -817,7 +817,6 @@ nv40_fragprog_validate(struct nv40_context *nv40)
so_method(so, nv40->hw->curie, NV40TCL_FP_CONTROL, 1);
so_data (so, fp->fp_control);
so_ref(so, &fp->so);
- so_ref(NULL, &so);
update_constants:
if (fp->nr_consts) {
diff --git a/src/gallium/drivers/nv40/nv40_fragtex.c b/src/gallium/drivers/nv40/nv40_fragtex.c
index 3d27a9bf13..c8a8120f30 100644
--- a/src/gallium/drivers/nv40/nv40_fragtex.c
+++ b/src/gallium/drivers/nv40/nv40_fragtex.c
@@ -137,7 +137,6 @@ nv40_fragtex_validate(struct nv40_context *nv40)
so_method(so, nv40->hw->curie, NV40TCL_TEX_ENABLE(unit), 1);
so_data (so, 0);
so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
state->dirty |= (1 << (NV40_STATE_FRAGTEX0 + unit));
}
@@ -148,7 +147,6 @@ nv40_fragtex_validate(struct nv40_context *nv40)
so = nv40_fragtex_build(nv40, unit);
so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
state->dirty |= (1 << (NV40_STATE_FRAGTEX0 + unit));
}
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
index 74cbabb023..107e60f179 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -11,7 +11,7 @@ nv40_blend_state_create(struct pipe_context *pipe,
{
struct nv40_context *nv40 = nv40_context(pipe);
struct nouveau_grobj *curie = nv40->hw->curie;
- struct nv40_blend_state *bso = MALLOC(sizeof(*bso));
+ struct nv40_blend_state *bso = CALLOC(1, sizeof(*bso));
struct nouveau_stateobj *so = so_new(16, 0);
if (cso->blend_enable) {
@@ -47,7 +47,7 @@ nv40_blend_state_create(struct pipe_context *pipe,
so_method(so, curie, NV40TCL_DITHER_ENABLE, 1);
so_data (so, cso->dither ? 1 : 0);
- bso->so = so;
+ so_ref(so, &bso->so);
bso->pipe = *cso;
return (void *)bso;
}
@@ -284,7 +284,7 @@ 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 = MALLOC(sizeof(*rsso));
+ struct nv40_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso));
struct nouveau_stateobj *so = so_new(32, 0);
struct nouveau_grobj *curie = nv40->hw->curie;
@@ -389,7 +389,7 @@ nv40_rasterizer_state_create(struct pipe_context *pipe,
so_data(so, 0);
}
- rsso->so = so;
+ so_ref(so, &rsso->so);
rsso->pipe = *cso;
return (void *)rsso;
}
@@ -417,7 +417,7 @@ 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 = MALLOC(sizeof(*zsaso));
+ struct nv40_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso));
struct nouveau_stateobj *so = so_new(32, 0);
so_method(so, nv40->hw->curie, NV40TCL_DEPTH_FUNC, 3);
@@ -460,7 +460,7 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe,
so_data (so, 0);
}
- zsaso->so = so;
+ so_ref(so, &zsaso->so);
zsaso->pipe = *cso;
return (void *)zsaso;
}
diff --git a/src/gallium/drivers/nv40/nv40_state_blend.c b/src/gallium/drivers/nv40/nv40_state_blend.c
index b12f8b03dd..81b927a67a 100644
--- a/src/gallium/drivers/nv40/nv40_state_blend.c
+++ b/src/gallium/drivers/nv40/nv40_state_blend.c
@@ -28,7 +28,6 @@ nv40_state_blend_colour_validate(struct nv40_context *nv40)
(float_to_ubyte(bcol->color[2]) << 0)));
so_ref(so, &nv40->state.hw[NV40_STATE_BCOL]);
- so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c
index d3032f1be5..c3bf4d43a3 100644
--- a/src/gallium/drivers/nv40/nv40_state_fb.c
+++ b/src/gallium/drivers/nv40/nv40_state_fb.c
@@ -143,7 +143,6 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
so_data (so, ((h - 1) << 16) | 0);
so_ref(so, &nv40->state.hw[NV40_STATE_FB]);
- so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv40/nv40_state_scissor.c b/src/gallium/drivers/nv40/nv40_state_scissor.c
index 2871fa2516..ee797094d3 100644
--- a/src/gallium/drivers/nv40/nv40_state_scissor.c
+++ b/src/gallium/drivers/nv40/nv40_state_scissor.c
@@ -22,7 +22,6 @@ nv40_state_scissor_validate(struct nv40_context *nv40)
}
so_ref(so, &nv40->state.hw[NV40_STATE_SCISSOR]);
- so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv40/nv40_state_stipple.c b/src/gallium/drivers/nv40/nv40_state_stipple.c
index bd163582a3..aad4d179ac 100644
--- a/src/gallium/drivers/nv40/nv40_state_stipple.c
+++ b/src/gallium/drivers/nv40/nv40_state_stipple.c
@@ -27,7 +27,6 @@ nv40_state_stipple_validate(struct nv40_context *nv40)
}
so_ref(so, &nv40->state.hw[NV40_STATE_STIPPLE]);
- so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv40/nv40_state_viewport.c b/src/gallium/drivers/nv40/nv40_state_viewport.c
index 79fcc31a8b..68820d3133 100644
--- a/src/gallium/drivers/nv40/nv40_state_viewport.c
+++ b/src/gallium/drivers/nv40/nv40_state_viewport.c
@@ -17,7 +17,6 @@ nv40_state_viewport_validate(struct nv40_context *nv40)
so_data (so, fui(vpt->scale[3]));
so_ref(so, &nv40->state.hw[NV40_STATE_VIEWPORT]);
- so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c
index 3bfcb264db..5abe4c9af1 100644
--- a/src/gallium/drivers/nv40/nv40_vbo.c
+++ b/src/gallium/drivers/nv40/nv40_vbo.c
@@ -159,7 +159,6 @@ nv40_vbo_arrays_update(struct nv40_context *nv40, struct pipe_buffer *ib,
so_emit(nv40->nvws, vtxfmt);
so_emit(nv40->nvws, vtxbuf);
so_ref (vtxbuf, &nv40->so_vtxbuf);
- so_ref (NULL, &vtxbuf);
so_ref (NULL, &vtxfmt);
}
diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c
index 8a2d233697..c482964adc 100644
--- a/src/gallium/drivers/nv40/nv40_vertprog.c
+++ b/src/gallium/drivers/nv40/nv40_vertprog.c
@@ -678,7 +678,6 @@ check_gpu_resources:
so_data (so, vp->ir);
so_data (so, vp->or);
so_ref(so, &vp->so);
- so_ref(NULL, &so);
upload_code = TRUE;
}