diff options
author | Ben Skeggs <[email protected]> | 2009-03-07 17:14:24 +1000 |
---|---|---|
committer | Ben Skeggs <[email protected]> | 2009-03-07 17:49:09 +1000 |
commit | ca95d71a4bc63e2ea45abf9096a3da802819ef92 (patch) | |
tree | d97d43c54f8e841c3bc01d3de1d313dc42034cfe /src | |
parent | f2ec26cf52fcbf98139cb9e31520183189d09861 (diff) |
nouveau: make stateobjs start off with refcount of 1
Diffstat (limited to 'src')
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 666e061ac38..97859110b5f 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 0da392fed33..bdfe1425d24 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 b1d2663af38..8b6ab992d16 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 26147565a53..b91e972c123 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 44d43e132a5..64cf9ae93a0 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 ee0326011ca..fdc1cade905 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 1db9bc17955..3ac7a8471ea 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 41b42813b49..d0c791ac082 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 951d40ebfdd..4b8300d21c4 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 2d6d48ac161..990a8763824 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 d2627250570..eaf543b8f79 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 1031e87e970..16e40889ec3 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 0227d22620d..eb3002dc053 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 2eff25aa836..c3ee4d23453 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 95e6d7394f4..8cd05ce66ef 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 5ebd3a1a56b..be618a306bf 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 285239ef419..cf58d33906a 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 869a55b4053..3d14d203081 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 8f1834628f7..f3518b2e4fe 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 0862386638c..7df9a4d3264 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 308eb34784c..2d15868ae84 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 9bf5e8c7b3f..d0348ec29c3 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 787ff958ec7..ba852194cdd 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 948112ffa9f..b7958f19bc8 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 31bf59675ec..223c8a3a456 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 08d751dddbd..0749c906914 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); } |