anv: store the workaround address

This will allow to select a different address later, leaving the
beginning of the buffer to some other use.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3203>
This commit is contained in:
Lionel Landwerlin
2020-02-21 17:36:36 +02:00
committed by Marge Bot
parent 0ff5b9e692
commit 33b452aae7
5 changed files with 17 additions and 13 deletions

View File

@@ -2932,6 +2932,10 @@ VkResult anv_CreateDevice(
if (result != VK_SUCCESS)
goto fail_surface_aux_map_pool;
device->workaround_address = (struct anv_address) {
.bo = device->workaround_bo,
};
result = anv_device_init_trivial_batch(device);
if (result != VK_SUCCESS)
goto fail_workaround_bo;

View File

@@ -1297,6 +1297,11 @@ anv_device_upload_nir(struct anv_device *device,
const struct nir_shader *nir,
unsigned char sha1_key[20]);
struct anv_address {
struct anv_bo *bo;
uint32_t offset;
};
struct anv_device {
struct vk_device vk;
@@ -1340,6 +1345,8 @@ struct anv_device {
* For that, we use the high bytes (>= 1024) of the workaround BO.
*/
struct anv_bo * workaround_bo;
struct anv_address workaround_address;
struct anv_bo * trivial_batch_bo;
struct anv_bo * hiz_clear_bo;
struct anv_state null_surface_state;
@@ -1602,11 +1609,6 @@ struct anv_batch_bo {
struct anv_reloc_list relocs;
};
struct anv_address {
struct anv_bo *bo;
uint32_t offset;
};
struct anv_batch {
const VkAllocationCallbacks * alloc;

View File

@@ -184,7 +184,8 @@ blorp_get_workaround_address(struct blorp_batch *batch)
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
return (struct blorp_address) {
.buffer = cmd_buffer->device->workaround_bo,
.buffer = cmd_buffer->device->workaround_address.bo,
.offset = cmd_buffer->device->workaround_address.offset,
};
}

View File

@@ -2251,8 +2251,7 @@ genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer)
*/
if (GEN_GEN == 9 && pipe.VFCacheInvalidationEnable) {
pipe.PostSyncOperation = WriteImmediateData;
pipe.Address =
(struct anv_address) { cmd_buffer->device->workaround_bo, 0 };
pipe.Address = cmd_buffer->device->workaround_address;
}
}
@@ -3404,8 +3403,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {
pc.DepthStallEnable = true;
pc.PostSyncOperation = WriteImmediateData;
pc.Address =
(struct anv_address) { cmd_buffer->device->workaround_bo, 0 };
pc.Address = cmd_buffer->device->workaround_address;
}
}
#endif
@@ -4950,8 +4948,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
*/
anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {
pc.PostSyncOperation = WriteImmediateData;
pc.Address =
(struct anv_address) { cmd_buffer->device->workaround_bo, 0 };
pc.Address = cmd_buffer->device->workaround_address;
}
}
cmd_buffer->state.hiz_enabled = isl_aux_usage_has_hiz(info.hiz_usage);

View File

@@ -290,7 +290,7 @@ genX(emit_urb_setup)(struct anv_device *device, struct anv_batch *batch,
anv_batch_emit(batch, GEN7_PIPE_CONTROL, pc) {
pc.DepthStallEnable = true;
pc.PostSyncOperation = WriteImmediateData;
pc.Address = (struct anv_address) { device->workaround_bo, 0 };
pc.Address = device->workaround_address;
}
#endif