Skip to content

fdno/resource: Rewrite layout selection for allocation

The previous code had a number of errors, the most glaring of which was forcing linear when it was one of the possible layouts requested.

When modifiers are being used, a list of acceptable modifiers is supplied; it's up to the driver to then make a decision as to which it thinks is most optimal.

Normally we would select between linear/tiled/UBWC in ascending order of preference according to what's possible, however we can't use a tiled layout with explicit modifiers as there is no modifier token defined for it.

Rewrite the layout-selection mechanism to always try to do the most optimal thing. If the use flags force us to, or we have a shared resource without explicit modifiers, we use linear. Failing that, we use UBWC wherever possible; if this is not possible, we use tiled for internal resources only or linear for shared resources.

Also do not rely on MOD_INVALID as a valid entry in the modifiers list to propagate use of implicit modifiers. Instead, use a zero-count of modifiers to indicate that.

Edited by Heinrich Fink

Merge request reports