diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/genX_state_upload.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index a69a496f1d..715388c080 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -5405,6 +5405,48 @@ static const struct brw_tracked_state genX(blend_constant_color) = { /* ---------------------------------------------------------------------- */ +#if GEN_GEN == 9 + +/** + * Implement workarounds for preemption: + * - WaDisableMidObjectPreemptionForGSLineStripAdj + * - WaDisableMidObjectPreemptionForTrifanOrPolygon + */ +static void +gen9_emit_preempt_wa(struct brw_context *brw) +{ + /* We are changing primitive types, so if the new primitive is listed in the + * workarounds above, disable preemption, unless it was already disabled + * before. + */ + if ((brw->ctx.NewDriverState & BRW_NEW_BLORP) || + (brw->object_preemption && + (brw->primitive == _3DPRIM_LINESTRIP_ADJ || + brw->primitive == _3DPRIM_TRIFAN || + brw->primitive == _3DPRIM_POLYGON))) + brw_enable_obj_preemption(brw, false); + + /* If preemption was disabled, just enabled it, unless it's listed in the + * WAs. + */ + if (!brw->object_preemption && + !(brw->primitive == _3DPRIM_LINESTRIP_ADJ || + brw->primitive == _3DPRIM_TRIFAN || + brw->primitive == _3DPRIM_POLYGON)) + brw_enable_obj_preemption(brw, true); +} + +static const struct brw_tracked_state gen9_preempt_wa = { + .dirty = { + .mesa = 0, + .brw = BRW_NEW_PRIMITIVE | BRW_NEW_BLORP, + }, + .emit = gen9_emit_preempt_wa, +}; +#endif + +/* ---------------------------------------------------------------------- */ + void genX(init_atoms)(struct brw_context *brw) { @@ -5709,6 +5751,9 @@ genX(init_atoms)(struct brw_context *brw) &genX(cut_index), &gen8_pma_fix, +#if GEN_GEN == 9 + &gen9_preempt_wa, +#endif }; #endif |