summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-03-07 17:14:24 +1000
committerBen Skeggs <bskeggs@redhat.com>2009-03-07 17:49:09 +1000
commitca95d71a4bc63e2ea45abf9096a3da802819ef92 (patch)
treed97d43c54f8e841c3bc01d3de1d313dc42034cfe /src
parentf2ec26cf52fcbf98139cb9e31520183189d09861 (diff)
nouveau: make stateobjs start off with refcount of 1
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h2
-rw-r--r--src/gallium/drivers/nv30/nv30_fragprog.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_fragtex.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c3
-rw-r--r--src/gallium/drivers/nv30/nv30_state_blend.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_state_scissor.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_state_stipple.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_state_viewport.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_vbo.c3
-rw-r--r--src/gallium/drivers/nv30/nv30_vertprog.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_fragprog.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_fragtex.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c3
-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_viewport.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_vbo.c3
-rw-r--r--src/gallium/drivers/nv40/nv40_vertprog.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c3
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c3
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c6
-rw-r--r--src/gallium/drivers/nv50/nv50_tex.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c2
26 files changed, 45 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 666e061ac3..97859110b5 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));
- pipe_reference_init(&so->reference, 0);
+ pipe_reference_init(&so->reference, 1);
so->push = MALLOC(sizeof(unsigned) * push);
so->reloc = MALLOC(sizeof(struct nouveau_stateobj_reloc) * reloc);
diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c
index 0da392fed3..bdfe1425d2 100644
--- a/src/gallium/drivers/nv30/nv30_fragprog.c
+++ b/src/gallium/drivers/nv30/nv30_fragprog.c
@@ -865,6 +865,7 @@ nv30_fragprog_validate(struct nv30_context *nv30)
so_method(so, nv30->screen->rankine, NV34TCL_TX_UNITS_ENABLE, 1);
so_data (so, fp->samplers);
so_ref(so, &fp->so);
+ so_ref(NULL, &so);
update_constants:
if (fp->nr_consts) {
diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c
index b1d2663af3..8b6ab992d1 100644
--- a/src/gallium/drivers/nv30/nv30_fragtex.c
+++ b/src/gallium/drivers/nv30/nv30_fragtex.c
@@ -137,6 +137,7 @@ nv30_fragtex_validate(struct nv30_context *nv30)
so_method(so, nv30->screen->rankine, NV34TCL_TX_ENABLE(unit), 1);
so_data (so, 0);
so_ref(so, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]);
+ so_ref(NULL, &so);
state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit));
}
@@ -147,6 +148,7 @@ nv30_fragtex_validate(struct nv30_context *nv30)
so = nv30_fragtex_build(nv30, unit);
so_ref(so, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]);
+ so_ref(NULL, &so);
state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit));
}
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
index 26147565a5..b91e972c12 100644
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ b/src/gallium/drivers/nv30/nv30_state.c
@@ -51,6 +51,7 @@ nv30_blend_state_create(struct pipe_context *pipe,
so_data (so, cso->dither ? 1 : 0);
so_ref(so, &bso->so);
+ so_ref(NULL, &so);
bso->pipe = *cso;
return (void *)bso;
}
@@ -404,6 +405,7 @@ nv30_rasterizer_state_create(struct pipe_context *pipe,
}
so_ref(so, &rsso->so);
+ so_ref(NULL, &so);
rsso->pipe = *cso;
return (void *)rsso;
}
@@ -477,6 +479,7 @@ nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe,
}
so_ref(so, &zsaso->so);
+ so_ref(NULL, &so);
zsaso->pipe = *cso;
return (void *)zsaso;
}
diff --git a/src/gallium/drivers/nv30/nv30_state_blend.c b/src/gallium/drivers/nv30/nv30_state_blend.c
index 44d43e132a..64cf9ae93a 100644
--- a/src/gallium/drivers/nv30/nv30_state_blend.c
+++ b/src/gallium/drivers/nv30/nv30_state_blend.c
@@ -28,6 +28,7 @@ nv30_state_blend_colour_validate(struct nv30_context *nv30)
(float_to_ubyte(bcol->color[2]) << 0)));
so_ref(so, &nv30->state.hw[NV30_STATE_BCOL]);
+ so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index ee0326011c..fdc1cade90 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -132,6 +132,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
so_data (so, 0);
so_ref(so, &nv30->state.hw[NV30_STATE_FB]);
+ so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv30/nv30_state_scissor.c b/src/gallium/drivers/nv30/nv30_state_scissor.c
index 1db9bc1795..3ac7a8471e 100644
--- a/src/gallium/drivers/nv30/nv30_state_scissor.c
+++ b/src/gallium/drivers/nv30/nv30_state_scissor.c
@@ -23,6 +23,7 @@ nv30_state_scissor_validate(struct nv30_context *nv30)
}
so_ref(so, &nv30->state.hw[NV30_STATE_SCISSOR]);
+ so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv30/nv30_state_stipple.c b/src/gallium/drivers/nv30/nv30_state_stipple.c
index 41b42813b4..d0c791ac08 100644
--- a/src/gallium/drivers/nv30/nv30_state_stipple.c
+++ b/src/gallium/drivers/nv30/nv30_state_stipple.c
@@ -27,6 +27,7 @@ nv30_state_stipple_validate(struct nv30_context *nv30)
}
so_ref(so, &nv30->state.hw[NV30_STATE_STIPPLE]);
+ so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv30/nv30_state_viewport.c b/src/gallium/drivers/nv30/nv30_state_viewport.c
index 951d40ebfd..4b8300d21c 100644
--- a/src/gallium/drivers/nv30/nv30_state_viewport.c
+++ b/src/gallium/drivers/nv30/nv30_state_viewport.c
@@ -58,6 +58,7 @@ nv30_state_viewport_validate(struct nv30_context *nv30)
so_data (so, 1);
so_ref(so, &nv30->state.hw[NV30_STATE_VIEWPORT]);
+ so_ref(NULL, &so);
return TRUE;
}
diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c
index 2d6d48ac16..990a876382 100644
--- a/src/gallium/drivers/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nv30/nv30_vbo.c
@@ -539,10 +539,13 @@ nv30_vbo_validate(struct nv30_context *nv30)
so_data (vtxbuf, 0);
so_ref(vtxbuf, &nv30->state.hw[NV30_STATE_VTXBUF]);
+ so_ref(NULL, &vtxbuf);
nv30->state.dirty |= (1ULL << NV30_STATE_VTXBUF);
so_ref(vtxfmt, &nv30->state.hw[NV30_STATE_VTXFMT]);
+ so_ref(NULL, &vtxfmt);
nv30->state.dirty |= (1ULL << NV30_STATE_VTXFMT);
so_ref(sattr, &nv30->state.hw[NV30_STATE_VTXATTR]);
+ so_ref(NULL, &sattr);
nv30->state.dirty |= (1ULL << NV30_STATE_VTXATTR);
return FALSE;
}
diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
index d262725057..eaf543b8f7 100644
--- a/src/gallium/drivers/nv30/nv30_vertprog.c
+++ b/src/gallium/drivers/nv30/nv30_vertprog.c
@@ -685,6 +685,7 @@ nv30_vertprog_validate(struct nv30_context *nv30)
so_method(so, rankine, NV34TCL_VP_START_FROM_ID, 1);
so_data (so, vp->exec->start);
so_ref(so, &vp->so);
+ so_ref(NULL, &so);
upload_code = TRUE;
}
diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c
index 1031e87e97..16e40889ec 100644
--- a/src/gallium/drivers/nv40/nv40_fragprog.c
+++ b/src/gallium/drivers/nv40/nv40_fragprog.c
@@ -944,6 +944,7 @@ nv40_fragprog_validate(struct nv40_context *nv40)
so_method(so, nv40->screen->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 0227d22620..eb3002dc05 100644
--- a/src/gallium/drivers/nv40/nv40_fragtex.c
+++ b/src/gallium/drivers/nv40/nv40_fragtex.c
@@ -151,6 +151,7 @@ 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 |= (1ULL << (NV40_STATE_FRAGTEX0 + unit));
}
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
index 2eff25aa83..c3ee4d2345 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -52,6 +52,7 @@ nv40_blend_state_create(struct pipe_context *pipe,
so_data (so, cso->dither ? 1 : 0);
so_ref(so, &bso->so);
+ so_ref(NULL, &so);
bso->pipe = *cso;
return (void *)bso;
}
@@ -414,6 +415,7 @@ nv40_rasterizer_state_create(struct pipe_context *pipe,
}
so_ref(so, &rsso->so);
+ so_ref(NULL, &so);
rsso->pipe = *cso;
return (void *)rsso;
}
@@ -487,6 +489,7 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe,
}
so_ref(so, &zsaso->so);
+ so_ref(NULL, &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 95e6d7394f..8cd05ce66e 100644
--- a/src/gallium/drivers/nv40/nv40_state_blend.c
+++ b/src/gallium/drivers/nv40/nv40_state_blend.c
@@ -28,6 +28,7 @@ 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 5ebd3a1a56..be618a306b 100644
--- a/src/gallium/drivers/nv40/nv40_state_fb.c
+++ b/src/gallium/drivers/nv40/nv40_state_fb.c
@@ -150,6 +150,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
so_data (so, (1 << 12) | h);
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 285239ef41..cf58d33906 100644
--- a/src/gallium/drivers/nv40/nv40_state_scissor.c
+++ b/src/gallium/drivers/nv40/nv40_state_scissor.c
@@ -23,6 +23,7 @@ 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_viewport.c b/src/gallium/drivers/nv40/nv40_state_viewport.c
index 869a55b405..3d14d20308 100644
--- a/src/gallium/drivers/nv40/nv40_state_viewport.c
+++ b/src/gallium/drivers/nv40/nv40_state_viewport.c
@@ -55,6 +55,7 @@ nv40_state_viewport_validate(struct nv40_context *nv40)
}
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 8f1834628f..f3518b2e4f 100644
--- a/src/gallium/drivers/nv40/nv40_vbo.c
+++ b/src/gallium/drivers/nv40/nv40_vbo.c
@@ -537,10 +537,13 @@ nv40_vbo_validate(struct nv40_context *nv40)
so_data (vtxbuf, 0);
so_ref(vtxbuf, &nv40->state.hw[NV40_STATE_VTXBUF]);
+ so_ref(NULL, &vtxbuf);
nv40->state.dirty |= (1ULL << NV40_STATE_VTXBUF);
so_ref(vtxfmt, &nv40->state.hw[NV40_STATE_VTXFMT]);
+ so_ref(NULL, &vtxfmt);
nv40->state.dirty |= (1ULL << NV40_STATE_VTXFMT);
so_ref(sattr, &nv40->state.hw[NV40_STATE_VTXATTR]);
+ so_ref(NULL, &sattr);
nv40->state.dirty |= (1ULL << NV40_STATE_VTXATTR);
return FALSE;
}
diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c
index 0862386638..7df9a4d326 100644
--- a/src/gallium/drivers/nv40/nv40_vertprog.c
+++ b/src/gallium/drivers/nv40/nv40_vertprog.c
@@ -916,6 +916,7 @@ check_gpu_resources:
so_method(so, curie, NV40TCL_CLIP_PLANE_ENABLE, 1);
so_data (so, vp->clip_ctrl);
so_ref(so, &vp->so);
+ so_ref(NULL, &so);
upload_code = TRUE;
}
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 308eb34784..2d15868ae8 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -1719,6 +1719,7 @@ nv50_vertprog_validate(struct nv50_context *nv50)
so_method(so, tesla, 0x140c, 1);
so_data (so, 0); /* program start offset */
so_ref(so, &nv50->state.vertprog);
+ so_ref(NULL, &so);
}
void
@@ -1758,6 +1759,7 @@ nv50_fragprog_validate(struct nv50_context *nv50)
so_method(so, tesla, 0x1414, 1);
so_data (so, 0); /* program start offset */
so_ref(so, &nv50->state.fragprog);
+ so_ref(NULL, &so);
}
void
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 9bf5e8c7b3..d0348ec29c 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -366,7 +366,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
so_data (so, 1);
so_emit(nvws, so);
- so_ref(so, &screen->static_init);
+ so_ref (so, &screen->static_init);
+ so_ref (NULL, &so);
nvws->push_flush(nvws, 0, NULL);
return &screen->pipe;
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 787ff958ec..ba852194cd 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -85,6 +85,7 @@ nv50_blend_state_create(struct pipe_context *pipe,
bso->pipe = *cso;
so_ref(so, &bso->so);
+ so_ref(NULL, &so);
return (void *)bso;
}
@@ -352,6 +353,7 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
rso->pipe = *cso;
so_ref(so, &rso->so);
+ so_ref(NULL, &so);
return (void *)rso;
}
@@ -438,6 +440,7 @@ nv50_depth_stencil_alpha_state_create(struct pipe_context *pipe,
zsa->pipe = *cso;
so_ref(so, &zsa->so);
+ so_ref(NULL, &so);
return (void *)zsa;
}
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 948112ffa9..b7958f19bc 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -124,6 +124,7 @@ nv50_state_validate_fb(struct nv50_context *nv50)
so_data (so, h);
so_ref(so, &nv50->state.fb);
+ so_ref(NULL, &so);
}
static void
@@ -214,6 +215,7 @@ nv50_state_validate(struct nv50_context *nv50)
so_data (so, fui(nv50->blend_colour.color[2]));
so_data (so, fui(nv50->blend_colour.color[3]));
so_ref(so, &nv50->state.blend_colour);
+ so_ref(NULL, &so);
}
if (nv50->dirty & NV50_NEW_STIPPLE) {
@@ -222,6 +224,7 @@ nv50_state_validate(struct nv50_context *nv50)
for (i = 0; i < 32; i++)
so_data(so, nv50->stipple.stipple[i]);
so_ref(so, &nv50->state.stipple);
+ so_ref(NULL, &so);
}
if (nv50->dirty & (NV50_NEW_SCISSOR | NV50_NEW_RASTERIZER)) {
@@ -243,6 +246,7 @@ nv50_state_validate(struct nv50_context *nv50)
so_data(so, (8192 << 16));
}
so_ref(so, &nv50->state.scissor);
+ so_ref(NULL, &so);
nv50->state.dirty |= NV50_NEW_SCISSOR;
}
scissor_uptodate:
@@ -283,6 +287,7 @@ scissor_uptodate:
}
so_ref(so, &nv50->state.viewport);
+ so_ref(NULL, &so);
}
viewport_uptodate:
@@ -296,6 +301,7 @@ viewport_uptodate:
for (i = 0; i < nv50->sampler_nr; i++)
so_datap (so, nv50->sampler[i], 8);
so_ref(so, &nv50->state.tsc_upload);
+ so_ref(NULL, &so);
}
if (nv50->dirty & NV50_NEW_TEXTURE)
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index 31bf59675e..223c8a3a45 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -152,5 +152,6 @@ nv50_tex_validate(struct nv50_context *nv50)
}
so_ref(so, &nv50->state.tic_upload);
+ so_ref(NULL, &so);
}
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 08d751dddb..0749c90691 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -250,5 +250,7 @@ nv50_vbo_validate(struct nv50_context *nv50)
so_ref (vtxfmt, &nv50->state.vtxfmt);
so_ref (vtxbuf, &nv50->state.vtxbuf);
+ so_ref (NULL, &vtxbuf);
+ so_ref (NULL, &vtxfmt);
}