From f7e3aecb87efba378e2cda0574582ee3fb5fc948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Wed, 16 Aug 2023 09:27:44 -0700 Subject: [PATCH] anv: Implement Wa_14019708328 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As each anv_device has its own address space it was necessary create one dummy_aux_bo per anv_device. Also this workaround requires us to disable the buffer_length_in_aux_addr optimization, that is done in the physical device creating because isl_dev of physical device is copied to isl_dev in anv_device. Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/vulkan/anv_device.c | 20 +++++++++++++++++-- .../vulkan/anv_nir_apply_pipeline_layout.c | 1 + src/intel/vulkan/anv_private.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 6898d3f68fa..7baf73abede 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2538,7 +2538,7 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, driQueryOptioni(&instance->dri_options, "shader_spilling_rate"); isl_device_init(&device->isl_dev, &device->info); - device->isl_dev.buffer_length_in_aux_addr = true; + device->isl_dev.buffer_length_in_aux_addr = !intel_needs_workaround(device->isl_dev.info, 14019708328); result = anv_physical_device_init_uuids(device); if (result != VK_SUCCESS) @@ -3712,6 +3712,17 @@ VkResult anv_CreateDevice( if (result != VK_SUCCESS) goto fail_surface_aux_map_pool; + if (intel_needs_workaround(device->info, 14019708328)) { + result = anv_device_alloc_bo(device, "dummy_aux", 4096, + 0 /* alloc_flags */, + 0 /* explicit_address */, + &device->dummy_aux_bo); + if (result != VK_SUCCESS) + goto fail_workaround_bo; + + device->isl_dev.dummy_aux_address = device->dummy_aux_bo->offset; + } + device->workaround_address = (struct anv_address) { .bo = device->workaround_bo, .offset = align(intel_debug_write_identifiers(device->workaround_bo->map, @@ -3741,7 +3752,7 @@ VkResult anv_CreateDevice( 0 /* explicit_address */, &device->ray_query_bo); if (result != VK_SUCCESS) - goto fail_workaround_bo; + goto fail_dummy_aux_bo; } result = anv_device_init_trivial_batch(device); @@ -4005,6 +4016,9 @@ VkResult anv_CreateDevice( fail_ray_query_bo: if (device->ray_query_bo) anv_device_release_bo(device, device->ray_query_bo); + fail_dummy_aux_bo: + if (device->dummy_aux_bo) + anv_device_release_bo(device, device->dummy_aux_bo); fail_workaround_bo: anv_device_release_bo(device, device->workaround_bo); fail_surface_aux_map_pool: @@ -4161,6 +4175,8 @@ void anv_DestroyDevice( anv_device_release_bo(device, device->ray_query_bo); } anv_device_release_bo(device, device->workaround_bo); + if (device->dummy_aux_bo) + anv_device_release_bo(device, device->dummy_aux_bo); anv_device_release_bo(device, device->trivial_batch_bo); if (device->info->has_aux_map) { diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c index c9e6e577edf..e6e12a7da23 100644 --- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c @@ -499,6 +499,7 @@ build_load_render_surface_state_address(nir_builder *b, { if (state->pdevice->isl_dev.buffer_length_in_aux_addr) return build_optimized_load_render_surface_state_address(b, desc_addr, state); + /* Wa_14019708328 */ return build_non_optimized_load_render_surface_state_address(b, desc_addr, state); } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index c85320ce009..945f5ea3bd9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1835,6 +1835,8 @@ struct anv_device { struct anv_bo * workaround_bo; struct anv_address workaround_address; + struct anv_bo * dummy_aux_bo; + /** * Workarounds for game bugs. */