anv: Lower bufferImageGranularity to 1 from 64
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 17 Feb 2022 10:08:33 +0000 (02:08 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 18 Feb 2022 09:52:00 +0000 (09:52 +0000)
commit4ed9fd62c9135cae21907cac7227725668dfd745
treec3b46be7c8396b0120a24c1687f832669690316d
parentbfdb1064c58402fe11e07317936abbd133f5a78d
anv: Lower bufferImageGranularity to 1 from 64

The Vulkan 1.3 spec says:

   "The implementation-dependent limit bufferImageGranularity specifies
    a page-like granularity at which linear and non-linear resources
    must be placed in adjacent memory locations to avoid aliasing.  Two
    resources which do not satisfy this granularity requirement are said
    to alias. bufferImageGranularity is specified in bytes, and must be
    a power of two.  Implementations which do not impose a granularity
    restriction may report a bufferImageGranularity value of one.

    Note: Despite its name, bufferImageGranularity is really a
    granularity between "linear" and "non-linear" resources."

We set this limit to 64 bytes (a cacheline) at the dawn of time, without
any real rationale attached.  There shouldn't be any restrictions here.
Our tile sizes are typically 4K, and tiled resource addresses are
aligned to the tile size, and the extent is also a multiple of the tile
sized.  So if a linear resource occurs before a tiled one, there will
naturally be some space due to the alignment of the tiled resource's
starting address.  If a linear resource occurs after a tiled one, the
tiled resource's ending address is already 4K aligned, which is already
guaranteeing that they won't share a cacheline.

So I think it should be fine to reduce this to 1.  The other Vulkan
driver for our hardware seems to advertise 1 here as well.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15066>
src/intel/vulkan/anv_device.c