diff options
Diffstat (limited to 'src/gallium/drivers/ilo')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_gpe.h | 23 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_gpe_gen6.c | 88 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_gpe_gen6.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_gpe_gen7.c | 83 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_gpe_gen7.h | 2 |
7 files changed, 141 insertions, 62 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c index 72e87d4efa7..7721b04bd32 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c @@ -676,7 +676,7 @@ gen6_pipeline_wm(struct ilo_3d_pipeline *p, gen6_wa_pipe_control_wm_max_threads_stall(p); p->gen6_3DSTATE_WM(p->dev, fs, num_samplers, - &ilo->rasterizer->state, dual_blend, cc_may_kill, p->cp); + ilo->rasterizer, dual_blend, cc_may_kill, p->cp); } } diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c index ed88f465d86..20f06d6ebd5 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c @@ -471,8 +471,7 @@ gen7_pipeline_wm(struct ilo_3d_pipeline *p, if (p->dev->gen == ILO_GEN(7) && session->hw_ctx_changed) gen7_wa_pipe_control_wm_max_threads_stall(p); - p->gen7_3DSTATE_WM(p->dev, - fs, &ilo->rasterizer->state, cc_may_kill, p->cp); + p->gen7_3DSTATE_WM(p->dev, fs, ilo->rasterizer, cc_may_kill, p->cp); } /* 3DSTATE_BINDING_TABLE_POINTERS_PS */ diff --git a/src/gallium/drivers/ilo/ilo_gpe.h b/src/gallium/drivers/ilo/ilo_gpe.h index e9141f7c3af..f999aaf90ab 100644 --- a/src/gallium/drivers/ilo/ilo_gpe.h +++ b/src/gallium/drivers/ilo/ilo_gpe.h @@ -125,11 +125,19 @@ struct ilo_rasterizer_sf { uint32_t dw_msaa; }; +struct ilo_rasterizer_wm { + /* 3DSTATE_WM */ + uint32_t payload[2]; + uint32_t dw_msaa_rast; + uint32_t dw_msaa_disp; +}; + struct ilo_rasterizer_state { struct pipe_rasterizer_state state; struct ilo_rasterizer_clip clip; struct ilo_rasterizer_sf sf; + struct ilo_rasterizer_wm wm; }; struct ilo_dsa_state { @@ -291,6 +299,16 @@ ilo_gpe_init_rasterizer_sf(const struct ilo_dev_info *dev, const struct pipe_rasterizer_state *state, struct ilo_rasterizer_sf *sf); +void +ilo_gpe_init_rasterizer_wm_gen6(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_wm *wm); + +void +ilo_gpe_init_rasterizer_wm_gen7(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_wm *wm); + static inline void ilo_gpe_init_rasterizer(const struct ilo_dev_info *dev, const struct pipe_rasterizer_state *state, @@ -298,6 +316,11 @@ ilo_gpe_init_rasterizer(const struct ilo_dev_info *dev, { ilo_gpe_init_rasterizer_clip(dev, state, &rasterizer->clip); ilo_gpe_init_rasterizer_sf(dev, state, &rasterizer->sf); + + if (dev->gen >= ILO_GEN(7)) + ilo_gpe_init_rasterizer_wm_gen7(dev, state, &rasterizer->wm); + else + ilo_gpe_init_rasterizer_wm_gen6(dev, state, &rasterizer->wm); } void diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c index f4918dccf4b..ad0884ec752 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c +++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c @@ -2030,11 +2030,59 @@ gen6_emit_3DSTATE_SF(const struct ilo_dev_info *dev, ilo_cp_end(cp); } +void +ilo_gpe_init_rasterizer_wm_gen6(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_wm *wm) +{ + uint32_t dw5, dw6; + + ILO_GPE_VALID_GEN(dev, 6, 6); + + /* only the FF unit states are set, as in GEN7 */ + + dw5 = GEN6_WM_LINE_AA_WIDTH_2_0; + + /* same value as in 3DSTATE_SF */ + if (state->line_smooth) + dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0; + + if (state->poly_stipple_enable) + dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE; + if (state->line_stipple_enable) + dw5 |= GEN6_WM_LINE_STIPPLE_ENABLE; + + dw6 = GEN6_WM_POSITION_ZW_PIXEL | + GEN6_WM_MSRAST_OFF_PIXEL | + GEN6_WM_MSDISPMODE_PERSAMPLE; + + if (state->bottom_edge_rule) + dw6 |= GEN6_WM_POINT_RASTRULE_UPPER_RIGHT; + + /* + * assertion that makes sure + * + * dw6 |= wm->dw_msaa_rast | wm->dw_msaa_disp; + * + * is valid + */ + STATIC_ASSERT(GEN6_WM_MSRAST_OFF_PIXEL == 0 && + GEN6_WM_MSDISPMODE_PERSAMPLE == 0); + + wm->dw_msaa_rast = + (state->multisample) ? GEN6_WM_MSRAST_ON_PATTERN : 0; + wm->dw_msaa_disp = GEN6_WM_MSDISPMODE_PERPIXEL; + + STATIC_ASSERT(Elements(wm->payload) >= 2); + wm->payload[0] = dw5; + wm->payload[1] = dw6; +} + static void gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev, const struct ilo_shader *fs, int num_samplers, - const struct pipe_rasterizer_state *rasterizer, + const struct ilo_rasterizer_state *rasterizer, bool dual_blend, bool cc_may_kill, struct ilo_cp *cp) { @@ -2090,8 +2138,10 @@ gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev, dw4 |= GEN6_WM_HIERARCHICAL_DEPTH_RESOLVE; } - dw5 = (max_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT | - GEN6_WM_LINE_AA_WIDTH_2_0; + dw5 = rasterizer->wm.payload[0]; + dw6 = rasterizer->wm.payload[1]; + + dw5 |= (max_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT; /* * From the Sandy Bridge PRM, volume 2 part 1, page 275: @@ -2145,15 +2195,6 @@ gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev, if (true) dw5 |= GEN6_WM_DISPATCH_ENABLE; - /* same value as in 3DSTATE_SF */ - if (rasterizer->line_smooth) - dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0; - - if (rasterizer->poly_stipple_enable) - dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE; - if (rasterizer->line_stipple_enable) - dw5 |= GEN6_WM_LINE_STIPPLE_ENABLE; - if (dual_blend) dw5 |= GEN6_WM_DUAL_SOURCE_BLEND_ENABLE; @@ -2162,25 +2203,14 @@ gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev, else dw5 |= GEN6_WM_8_DISPATCH_ENABLE; - dw6 = fs->in.count << GEN6_WM_NUM_SF_OUTPUTS_SHIFT | - GEN6_WM_POSOFFSET_NONE | - GEN6_WM_POSITION_ZW_PIXEL | - fs->in.barycentric_interpolation_mode << - GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT; - - if (rasterizer->bottom_edge_rule) - dw6 |= GEN6_WM_POINT_RASTRULE_UPPER_RIGHT; + dw6 |= fs->in.count << GEN6_WM_NUM_SF_OUTPUTS_SHIFT | + GEN6_WM_POSOFFSET_NONE | + fs->in.barycentric_interpolation_mode << + GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT; if (num_samples > 1) { - if (rasterizer->multisample) - dw6 |= GEN6_WM_MSRAST_ON_PATTERN; - else - dw6 |= GEN6_WM_MSRAST_OFF_PIXEL; - dw6 |= GEN6_WM_MSDISPMODE_PERPIXEL; - } - else { - dw6 |= GEN6_WM_MSRAST_OFF_PIXEL | - GEN6_WM_MSDISPMODE_PERSAMPLE; + dw6 |= rasterizer->wm.dw_msaa_rast | + rasterizer->wm.dw_msaa_disp; } ilo_cp_begin(cp, cmd_len); diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.h b/src/gallium/drivers/ilo/ilo_gpe_gen6.h index bf4ed750341..a8a986a9440 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen6.h +++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.h @@ -265,7 +265,7 @@ typedef void (*ilo_gpe_gen6_3DSTATE_WM)(const struct ilo_dev_info *dev, const struct ilo_shader *fs, int num_samplers, - const struct pipe_rasterizer_state *rasterizer, + const struct ilo_rasterizer_state *rasterizer, bool dual_blend, bool cc_may_kill, struct ilo_cp *cp); diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen7.c b/src/gallium/drivers/ilo/ilo_gpe_gen7.c index f374473b291..79e01d7968f 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen7.c +++ b/src/gallium/drivers/ilo/ilo_gpe_gen7.c @@ -194,10 +194,57 @@ gen7_emit_3DSTATE_SF(const struct ilo_dev_info *dev, ilo_cp_end(cp); } +void +ilo_gpe_init_rasterizer_wm_gen7(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_wm *wm) +{ + uint32_t dw1, dw2; + + ILO_GPE_VALID_GEN(dev, 7, 7); + + dw1 = GEN7_WM_POSITION_ZW_PIXEL | + GEN7_WM_LINE_AA_WIDTH_2_0 | + GEN7_WM_MSRAST_OFF_PIXEL; + + /* same value as in 3DSTATE_SF */ + if (state->line_smooth) + dw1 |= GEN7_WM_LINE_END_CAP_AA_WIDTH_1_0; + + if (state->poly_stipple_enable) + dw1 |= GEN7_WM_POLYGON_STIPPLE_ENABLE; + if (state->line_stipple_enable) + dw1 |= GEN7_WM_LINE_STIPPLE_ENABLE; + + if (state->bottom_edge_rule) + dw1 |= GEN7_WM_POINT_RASTRULE_UPPER_RIGHT; + + dw2 = GEN7_WM_MSDISPMODE_PERSAMPLE; + + /* + * assertion that makes sure + * + * dw1 |= wm->dw_msaa_rast; + * dw2 |= wm->dw_msaa_disp; + * + * is valid + */ + STATIC_ASSERT(GEN7_WM_MSRAST_OFF_PIXEL == 0 && + GEN7_WM_MSDISPMODE_PERSAMPLE == 0); + + wm->dw_msaa_rast = + (state->multisample) ? GEN7_WM_MSRAST_ON_PATTERN : 0; + wm->dw_msaa_disp = GEN7_WM_MSDISPMODE_PERPIXEL; + + STATIC_ASSERT(Elements(wm->payload) >= 2); + wm->payload[0] = dw1; + wm->payload[1] = dw2; +} + static void gen7_emit_3DSTATE_WM(const struct ilo_dev_info *dev, const struct ilo_shader *fs, - const struct pipe_rasterizer_state *rasterizer, + const struct ilo_rasterizer_state *rasterizer, bool cc_may_kill, struct ilo_cp *cp) { @@ -208,8 +255,11 @@ gen7_emit_3DSTATE_WM(const struct ilo_dev_info *dev, ILO_GPE_VALID_GEN(dev, 7, 7); - dw1 = GEN7_WM_STATISTICS_ENABLE | - GEN7_WM_LINE_AA_WIDTH_2_0; + /* see ilo_gpe_init_rasterizer_wm() */ + dw1 = rasterizer->wm.payload[0]; + dw2 = rasterizer->wm.payload[1]; + + dw1 |= GEN7_WM_STATISTICS_ENABLE; if (false) { dw1 |= GEN7_WM_DEPTH_CLEAR; @@ -269,32 +319,9 @@ gen7_emit_3DSTATE_WM(const struct ilo_dev_info *dev, GEN7_WM_KILL_ENABLE; } - dw1 |= GEN7_WM_POSITION_ZW_PIXEL; - - /* same value as in 3DSTATE_SF */ - if (rasterizer->line_smooth) - dw1 |= GEN7_WM_LINE_END_CAP_AA_WIDTH_1_0; - - if (rasterizer->poly_stipple_enable) - dw1 |= GEN7_WM_POLYGON_STIPPLE_ENABLE; - if (rasterizer->line_stipple_enable) - dw1 |= GEN7_WM_LINE_STIPPLE_ENABLE; - - if (rasterizer->bottom_edge_rule) - dw1 |= GEN7_WM_POINT_RASTRULE_UPPER_RIGHT; - if (num_samples > 1) { - if (rasterizer->multisample) - dw1 |= GEN7_WM_MSRAST_ON_PATTERN; - else - dw1 |= GEN7_WM_MSRAST_OFF_PIXEL; - - dw2 = GEN7_WM_MSDISPMODE_PERPIXEL; - } - else { - dw1 |= GEN7_WM_MSRAST_OFF_PIXEL; - - dw2 = GEN7_WM_MSDISPMODE_PERSAMPLE; + dw1 |= rasterizer->wm.dw_msaa_rast; + dw2 |= rasterizer->wm.dw_msaa_disp; } ilo_cp_begin(cp, cmd_len); diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen7.h b/src/gallium/drivers/ilo/ilo_gpe_gen7.h index f8e8745fcb4..ac0fb0ee29f 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen7.h +++ b/src/gallium/drivers/ilo/ilo_gpe_gen7.h @@ -173,7 +173,7 @@ typedef void typedef void (*ilo_gpe_gen7_3DSTATE_WM)(const struct ilo_dev_info *dev, const struct ilo_shader *fs, - const struct pipe_rasterizer_state *rasterizer, + const struct ilo_rasterizer_state *rasterizer, bool cc_may_kill, struct ilo_cp *cp); |