anv: Use intel_device_info memory alignment

It was also necessary to initialize mem_alignment in the tests
otherwise vma allocation would fail with stubs.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21972>
This commit is contained in:
José Roberto de Souza 2023-03-14 12:37:57 -07:00 committed by Marge Bot
parent 2ab3d5f436
commit bfc1782ad6
8 changed files with 13 additions and 8 deletions

View file

@ -1405,17 +1405,11 @@ anv_bo_vma_alloc_or_close(struct anv_device *device,
{
assert(explicit_address == intel_48b_address(explicit_address));
uint32_t align = 4096;
uint32_t align = device->physical->info.mem_alignment;
/* Gen12 CCS surface addresses need to be 64K aligned. */
if (device->info->ver >= 12 && (alloc_flags & ANV_BO_ALLOC_IMPLICIT_CCS))
align = 64 * 1024;
/* For XeHP, lmem and smem cannot share a single PDE, which means they
* can't live in the same 2MiB aligned region.
*/
if (device->info->verx10 >= 125)
align = 2 * 1024 * 1024;
align = MAX2(64 * 1024, align);
if (alloc_flags & ANV_BO_ALLOC_FIXED_ADDRESS) {
bo->has_fixed_address = true;

View file

@ -36,6 +36,7 @@ int main(void)
const uint32_t block_size = 16 * 1024;
const uint32_t initial_size = block_size / 2;
test_device_info_init(&physical_device.info);
anv_device_set_physical(&device, &physical_device);
device.kmd_backend = anv_kmd_backend_get(INTEL_KMD_TYPE_STUB);
pthread_mutex_init(&device.mutex, NULL);

View file

@ -104,6 +104,7 @@ static void run_test()
struct anv_device device = {};
struct anv_block_pool pool;
test_device_info_init(&physical_device.info);
anv_device_set_physical(&device, &physical_device);
device.kmd_backend = anv_kmd_backend_get(INTEL_KMD_TYPE_STUB);
pthread_mutex_init(&device.mutex, NULL);

View file

@ -39,6 +39,7 @@ int main(void)
struct anv_device device = {};
struct anv_state_pool state_pool;
test_device_info_init(&physical_device.info);
anv_device_set_physical(&device, &physical_device);
device.kmd_backend = anv_kmd_backend_get(INTEL_KMD_TYPE_STUB);
pthread_mutex_init(&device.mutex, NULL);

View file

@ -38,6 +38,7 @@ int main(void)
struct anv_device device = {};
struct anv_state_pool state_pool;
test_device_info_init(&physical_device.info);
anv_device_set_physical(&device, &physical_device);
device.kmd_backend = anv_kmd_backend_get(INTEL_KMD_TYPE_STUB);
pthread_mutex_init(&device.mutex, NULL);

View file

@ -59,6 +59,7 @@ static void run_test()
struct anv_device device = {};
struct anv_state_pool state_pool;
test_device_info_init(&physical_device.info);
anv_device_set_physical(&device, &physical_device);
device.kmd_backend = anv_kmd_backend_get(INTEL_KMD_TYPE_STUB);
pthread_mutex_init(&device.mutex, NULL);

View file

@ -30,6 +30,7 @@ int main(void)
struct anv_device device = {};
struct anv_state_pool state_pool;
test_device_info_init(&physical_device.info);
anv_device_set_physical(&device, &physical_device);
device.kmd_backend = anv_kmd_backend_get(INTEL_KMD_TYPE_STUB);
pthread_mutex_init(&device.mutex, NULL);

View file

@ -32,3 +32,8 @@
abort(); \
} \
} while (false)
static inline void test_device_info_init(struct intel_device_info *info)
{
info->mem_alignment = 4096;
}