nv40: stateobj start out with 0 refcount

This commit is contained in:
Ben Skeggs 2008-02-22 14:46:48 +11:00
parent c2e36bdd1a
commit 7b938431d0
11 changed files with 7 additions and 17 deletions

View file

@ -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);

View file

@ -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) {

View file

@ -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));
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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;
}