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);
}
}
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 */
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 {
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,
{
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
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)
{
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:
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;
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);
(*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);
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)
{
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;
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);
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);