anv: Emit STATE_SYSTEM_MEM_FENCE_ADDRESS
According to HAS it is necessary to emit this instruction once per
context so MI_MEM_FENCE works properly.
Fixes: 86813c60a4
("mi-builder: add read/write memory fencing support on Gfx20+")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32680>
This commit is contained in:

committed by
Marge Bot

parent
b8f93bfd38
commit
2bd3df75e5
@@ -708,11 +708,26 @@ VkResult anv_CreateDevice(
|
||||
0 /* explicit_address */,
|
||||
&device->dummy_aux_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_workaround_bo;
|
||||
goto fail_alloc_device_bo;
|
||||
|
||||
device->isl_dev.dummy_aux_address = device->dummy_aux_bo->offset;
|
||||
}
|
||||
|
||||
/* Programming note from MI_MEM_FENCE specification:
|
||||
*
|
||||
* Software must ensure STATE_SYSTEM_MEM_FENCE_ADDRESS command is
|
||||
* programmed prior to programming this command.
|
||||
*
|
||||
* HAS 1607240579 then provides the size information: 4K
|
||||
*/
|
||||
if (device->info->verx10 >= 200) {
|
||||
result = anv_device_alloc_bo(device, "mem_fence", 4096,
|
||||
ANV_BO_ALLOC_NO_LOCAL_MEM, 0,
|
||||
&device->mem_fence_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_alloc_device_bo;
|
||||
}
|
||||
|
||||
struct anv_address wa_addr = (struct anv_address) {
|
||||
.bo = device->workaround_bo,
|
||||
};
|
||||
@@ -762,7 +777,7 @@ VkResult anv_CreateDevice(
|
||||
0 /* explicit_address */,
|
||||
&device->ray_query_bo[0]);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_dummy_aux_bo;
|
||||
goto fail_alloc_device_bo;
|
||||
|
||||
/* We need a separate ray query bo for CCS engine with Wa_14022863161. */
|
||||
if (intel_needs_workaround(device->isl_dev.info, 14022863161) &&
|
||||
@@ -1039,10 +1054,11 @@ VkResult anv_CreateDevice(
|
||||
if (device->ray_query_bo[i])
|
||||
anv_device_release_bo(device, device->ray_query_bo[i]);
|
||||
}
|
||||
fail_dummy_aux_bo:
|
||||
fail_alloc_device_bo:
|
||||
if (device->mem_fence_bo)
|
||||
anv_device_release_bo(device, device->mem_fence_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:
|
||||
if (device->info->has_aux_map) {
|
||||
@@ -1195,6 +1211,8 @@ void anv_DestroyDevice(
|
||||
anv_device_release_bo(device, device->workaround_bo);
|
||||
if (device->dummy_aux_bo)
|
||||
anv_device_release_bo(device, device->dummy_aux_bo);
|
||||
if (device->mem_fence_bo)
|
||||
anv_device_release_bo(device, device->mem_fence_bo);
|
||||
anv_device_release_bo(device, device->trivial_batch_bo);
|
||||
|
||||
if (device->info->has_aux_map) {
|
||||
|
@@ -1932,6 +1932,7 @@ struct anv_device {
|
||||
struct anv_address workaround_address;
|
||||
|
||||
struct anv_bo * dummy_aux_bo;
|
||||
struct anv_bo * mem_fence_bo;
|
||||
|
||||
/**
|
||||
* Workarounds for game bugs.
|
||||
|
@@ -182,6 +182,17 @@ genX(emit_slice_hashing_state)(struct anv_device *device,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
state_system_mem_fence_address_emit(struct anv_device *device, struct anv_batch *batch)
|
||||
{
|
||||
#if GFX_VERx10 >= 200
|
||||
struct anv_address addr = { .bo = device->mem_fence_bo };
|
||||
anv_batch_emit(batch, GENX(STATE_SYSTEM_MEM_FENCE_ADDRESS), mem_fence_addr) {
|
||||
mem_fence_addr.SystemMemoryFenceAddress = addr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
init_common_queue_state(struct anv_queue *queue, struct anv_batch *batch)
|
||||
{
|
||||
@@ -356,6 +367,8 @@ init_common_queue_state(struct anv_queue *queue, struct anv_batch *batch)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
state_system_mem_fence_address_emit(device, batch);
|
||||
}
|
||||
|
||||
#if GFX_VER >= 20
|
||||
@@ -840,6 +853,8 @@ init_copy_video_queue_state(struct anv_queue *queue)
|
||||
assert(!queue->device->info->has_aux_map);
|
||||
#endif
|
||||
|
||||
state_system_mem_fence_address_emit(device, batch);
|
||||
|
||||
if (batch->start != batch->next) {
|
||||
anv_batch_emit(batch, GENX(MI_BATCH_BUFFER_END), bbe);
|
||||
|
||||
|
Reference in New Issue
Block a user