From c6983ea035d6bef345517a13fed6abc1441407cf Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Fri, 31 May 2013 13:43:11 -0600 Subject: ilo: convert generic depth-stencil-alpha pipe state to ilo pipe state Moving the work to create time reduces the work at emit time. Saves time overall as create work is only done once. Fix compiler warning in gen7_pipeline_sol. [olv: remember pipe_alpha_state instead of pipe_depth_stencil_alpha_state in ilo_dsa_state] --- src/gallium/drivers/ilo/ilo_gpe_gen6.c | 45 +++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'src/gallium/drivers/ilo/ilo_gpe_gen6.c') diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c index 3167bd692ee..82818e78aa3 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c +++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c @@ -3573,22 +3573,23 @@ gen6_emit_BLEND_STATE(const struct ilo_dev_info *dev, return state_offset; } -static uint32_t -gen6_emit_DEPTH_STENCIL_STATE(const struct ilo_dev_info *dev, - const struct pipe_depth_stencil_alpha_state *dsa, - struct ilo_cp *cp) +void +ilo_gpe_init_dsa(const struct ilo_dev_info *dev, + const struct pipe_depth_stencil_alpha_state *state, + struct ilo_dsa_state *dsa) { - const struct pipe_depth_state *depth = &dsa->depth; - const struct pipe_stencil_state *stencil0 = &dsa->stencil[0]; - const struct pipe_stencil_state *stencil1 = &dsa->stencil[1]; - const int state_align = 64 / 4; - const int state_len = 3; - uint32_t state_offset, *dw; + const struct pipe_depth_state *depth = &state->depth; + const struct pipe_stencil_state *stencil0 = &state->stencil[0]; + const struct pipe_stencil_state *stencil1 = &state->stencil[1]; + uint32_t *dw; ILO_GPE_VALID_GEN(dev, 6, 7); - dw = ilo_cp_steal_ptr(cp, "DEPTH_STENCIL_STATE", - state_len, state_align, &state_offset); + /* copy alpha state for later use */ + dsa->alpha = state->alpha; + + STATIC_ASSERT(Elements(dsa->payload) >= 3); + dw = dsa->payload; /* * From the Sandy Bridge PRM, volume 2 part 1, page 359: @@ -3653,6 +3654,26 @@ gen6_emit_DEPTH_STENCIL_STATE(const struct ilo_dev_info *dev, dw[2] |= gen6_translate_dsa_func(depth->func) << 27; else dw[2] |= BRW_COMPAREFUNCTION_ALWAYS << 27; +} + +static uint32_t +gen6_emit_DEPTH_STENCIL_STATE(const struct ilo_dev_info *dev, + const struct ilo_dsa_state *dsa, + struct ilo_cp *cp) +{ + const int state_align = 64 / 4; + const int state_len = 3; + uint32_t state_offset, *dw; + + + ILO_GPE_VALID_GEN(dev, 6, 7); + + dw = ilo_cp_steal_ptr(cp, "DEPTH_STENCIL_STATE", + state_len, state_align, &state_offset); + + dw[0] = dsa->payload[0]; + dw[1] = dsa->payload[1]; + dw[2] = dsa->payload[2]; return state_offset; } -- cgit v1.2.3