Skip to content

intel: Assert that MOCS fields are never zero (uncached)

Kenneth Graunke requested to merge kwg/mesa:genxml-nz into main

Felix and I recently found a case where we missed setting MOCS on a new packet, which ended up causing serious performance issues that were a royal pain to track down. Jason suggested that we consider having genxml assert that we haven't left MOCS unset, which seems like a great idea.

This patch series introduces a new genxml field attribute, nonzero="true", which can be set on any numerical field to assert that the value supplied must not be zero. At the end of the series, we set this for all MOCS fields on Gfx7+.

The main work here is to update anv, iris, crocus, and i965, to comply with these new restrictions. There were quite a few "false positives", such as null surfaces or disabled buffers, where the MOCS value doesn't really matter. However, we also found a surprisingly large laundry list of real cases that needed fixing:

  • Buffer copies (iris, crocus, i965)
  • Index buffers on Gfx6-7 (crocus, i965)
  • Stream output buffers on Gfx7 (i965)
  • Constant buffers (anv on Gfx7.x, i965 on Haswell and Gfx9+, crocus on all platforms)
  • STATE_BASE_ADDRESS for Dynamic, Surface, Instruction, Indirect bases on Gfx6-7 (crocus, i965)

In the process, we also port i965's MOCS handling to use isl since that's much simpler.

Edited by Kenneth Graunke

Merge request reports