diff options
author | Luca Barbieri <[email protected]> | 2010-02-23 15:34:35 +0100 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-04-12 12:13:17 +0200 |
commit | 4b3b54d7463183099b4132367c23bfa112f6a1b0 (patch) | |
tree | 2a3c5d3088b94c96b347387a104412ef82be8174 /src/gallium/drivers | |
parent | 180654d2bbb1b800b07587ad9557258ce67fe094 (diff) |
nvfx: so->sb: blend
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_context.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_state.c | 45 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_state_blend.c | 4 |
3 files changed, 25 insertions, 27 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index d4e8ecc11c3..8721eaa741a 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -95,7 +95,8 @@ struct nvfx_zsa_state { struct nvfx_blend_state { struct pipe_blend_state pipe; - struct nouveau_stateobj *so; + unsigned sb_len; + uint32_t sb[13]; }; diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index cb7dae57ddb..b91211584f7 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -15,32 +15,31 @@ nvfx_blend_state_create(struct pipe_context *pipe, const struct pipe_blend_state *cso) { struct nvfx_context *nvfx = nvfx_context(pipe); - struct nouveau_grobj *eng3d = nvfx->screen->eng3d; struct nvfx_blend_state *bso = CALLOC(1, sizeof(*bso)); - struct nouveau_stateobj *so = so_new(5, 8, 0); + struct nouveau_statebuf_builder sb = sb_init(bso->sb); if (cso->rt[0].blend_enable) { - so_method(so, eng3d, NV34TCL_BLEND_FUNC_ENABLE, 3); - so_data (so, 1); - so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) | + sb_method(sb, NV34TCL_BLEND_FUNC_ENABLE, 3); + sb_data(sb, 1); + sb_data(sb, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) | nvgl_blend_func(cso->rt[0].rgb_src_factor)); - so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 | + sb_data(sb, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 | nvgl_blend_func(cso->rt[0].rgb_dst_factor)); if(nvfx->screen->base.device->chipset < 0x40) { - so_method(so, eng3d, NV34TCL_BLEND_EQUATION, 1); - so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func)); + sb_method(sb, NV34TCL_BLEND_EQUATION, 1); + sb_data(sb, nvgl_blend_eqn(cso->rt[0].rgb_func)); } else { - so_method(so, eng3d, NV40TCL_BLEND_EQUATION, 1); - so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 | + sb_method(sb, NV40TCL_BLEND_EQUATION, 1); + sb_data(sb, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 | nvgl_blend_eqn(cso->rt[0].rgb_func)); } } else { - so_method(so, eng3d, NV34TCL_BLEND_FUNC_ENABLE, 1); - so_data (so, 0); + sb_method(sb, NV34TCL_BLEND_FUNC_ENABLE, 1); + sb_data(sb, 0); } - so_method(so, eng3d, NV34TCL_COLOR_MASK, 1); - so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) | + sb_method(sb, NV34TCL_COLOR_MASK, 1); + sb_data(sb, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) | ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) | ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) | ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0))); @@ -48,19 +47,18 @@ nvfx_blend_state_create(struct pipe_context *pipe, /* TODO: add NV40 MRT color mask */ if (cso->logicop_enable) { - so_method(so, eng3d, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2); - so_data (so, 1); - so_data (so, nvgl_logicop_func(cso->logicop_func)); + sb_method(sb, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2); + sb_data(sb, 1); + sb_data(sb, nvgl_logicop_func(cso->logicop_func)); } else { - so_method(so, eng3d, NV34TCL_COLOR_LOGIC_OP_ENABLE, 1); - so_data (so, 0); + sb_method(sb, NV34TCL_COLOR_LOGIC_OP_ENABLE, 1); + sb_data(sb, 0); } - so_method(so, eng3d, NV34TCL_DITHER_ENABLE, 1); - so_data (so, cso->dither ? 1 : 0); + sb_method(sb, NV34TCL_DITHER_ENABLE, 1); + sb_data(sb, cso->dither ? 1 : 0); - so_ref(so, &bso->so); - so_ref(NULL, &so); + bso->sb_len = sb_len(sb, bso->sb); bso->pipe = *cso; return (void *)bso; } @@ -79,7 +77,6 @@ nvfx_blend_state_delete(struct pipe_context *pipe, void *hwcso) { struct nvfx_blend_state *bso = hwcso; - so_ref(NULL, &bso->so); FREE(bso); } diff --git a/src/gallium/drivers/nvfx/nvfx_state_blend.c b/src/gallium/drivers/nvfx/nvfx_state_blend.c index a6a0f9b16f3..f54eabd6428 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_blend.c +++ b/src/gallium/drivers/nvfx/nvfx_state_blend.c @@ -3,7 +3,8 @@ static boolean nvfx_state_blend_validate(struct nvfx_context *nvfx) { - so_ref(nvfx->blend->so, &nvfx->state.hw[NVFX_STATE_BLEND]); + struct nouveau_channel* chan = nvfx->screen->base.channel; + sb_emit(chan, nvfx->blend->sb, nvfx->blend->sb_len); return TRUE; } @@ -11,7 +12,6 @@ struct nvfx_state_entry nvfx_state_blend = { .validate = nvfx_state_blend_validate, .dirty = { .pipe = NVFX_NEW_BLEND, - .hw = NVFX_STATE_BLEND } }; |