nouveau: make stateobjs start off with refcount of 1

This commit is contained in:
Ben Skeggs 2009-03-07 17:14:24 +10:00
parent f2ec26cf52
commit ca95d71a4b
26 changed files with 45 additions and 2 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -152,5 +152,6 @@ nv50_tex_validate(struct nv50_context *nv50)
}
so_ref(so, &nv50->state.tic_upload);
so_ref(NULL, &so);
}

View file

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