diff options
author | Rafael Antognolli <rafael.antognolli@intel.com> | 2018-03-14 15:57:54 -0700 |
---|---|---|
committer | Rafael Antognolli <rafael.antognolli@intel.com> | 2018-03-15 08:20:03 -0700 |
commit | 37b7ab5ce0b2d9c099f0dd57a5dec997c0ac0160 (patch) | |
tree | 0855d9734f8f0873c8ce0b88e8cfc8d6919388de | |
parent | 097c6391445e6afeed393719e49823b3625be2b8 (diff) |
i965/gen9: Enable object level preemption.cnl/preemption_blorp
Gen9 hardware requires some workarounds to disable preemption depending
on the type of primitive being emitted.
We implement this by tracking the type of primitive being emitted, and
whenever it changes, we check if we need to enable/disable object
preemption.
Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
-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 |