Skip to content

panfrost: Preperation for sysval upload rewrite

Icecream95 requested to merge icecream95/mesa:sysval-prep into main

A few patches from !10197 (closed) to try and shrink it slightly.

This MR is mainly about making sure all of the sysvals are in a single "range" (though the concept of ranges hasn't been introduced yet).

This simplifies sysval upload, as it means that all of the pushed sysvals can be uploaded in a single loop, without having to search through the ranges or jump randomly about the list of sysvals.

For Midgard this mostly just involves making sure all sysvals can be pushed, as otherwise a single sysval could both be in a UBO and pushed, which complicates upload. Do this by allowing unaligned loads to be pushed, because using the same solution as Bifrost would require using the Midgard IR too much…

For Bifrost we make all sysval loads count as loads of four words, to make sure there is a single contiguous range of words to upload with no gaps in it. However, if there is a load at an offset within a quadword, then that will be counted twice. In this example, the range 8-16 gets counted twice:

load_sysval(b, dest, SYSVAL_FOO, 2, 0) counts as [0, 16) because of forcing `range` to 4
load_sysval(b, dest, SYSVAL_FOO, 2, 8) counts as [8, 16? 24?)

To avoid this, we make all sysval loads quadword aligned, so the second load would be effectively load_sysval(b, dest, SYSVAL_FOO, 4, 0).zw.

Merge request reports