anv: limit clflush usage

Discrete platforms don't have LLC, but on those, we mmap our buffers
with WC. So we shouldn't need to clflush there.

Anv already had a boolean field on the physical device to know whether
we need to use clflush(), based off the memory heaps available. So use
that instead.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15780>
This commit is contained in:
Lionel Landwerlin 2022-04-06 22:56:00 +03:00 committed by Marge Bot
parent 44e93b4c6f
commit 0be9cac742
4 changed files with 6 additions and 6 deletions

View File

@ -1911,7 +1911,7 @@ setup_execbuf_for_cmd_buffers(struct anv_execbuf *execbuf,
anv_cmd_buffer_process_relocs(cmd_buffers[0], &cmd_buffers[0]->surface_relocs);
}
if (!device->info.has_llc) {
if (device->physical->memory.need_clflush) {
__builtin_ia32_mfence();
for (uint32_t i = 0; i < num_cmd_buffers; i++) {
u_vector_foreach(bbo, &cmd_buffers[i]->seen_bbos) {
@ -1998,7 +1998,7 @@ setup_utrace_execbuf(struct anv_execbuf *execbuf, struct anv_queue *queue,
flush->batch_bo->exec_obj_index = last_idx;
}
if (!device->info.has_llc)
if (device->physical->memory.need_clflush)
intel_flush_range(flush->batch_bo->map, flush->batch_bo->size);
execbuf->execbuf = (struct drm_i915_gem_execbuffer2) {
@ -2435,7 +2435,7 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
return result;
memcpy(batch_bo->map, batch->start, batch_size);
if (!device->info.has_llc)
if (device->physical->memory.need_clflush)
intel_flush_range(batch_bo->map, batch_size);
struct anv_execbuf execbuf;

View File

@ -2932,7 +2932,7 @@ anv_device_init_trivial_batch(struct anv_device *device)
anv_batch_emit(&batch, GFX7_MI_BATCH_BUFFER_END, bbe);
anv_batch_emit(&batch, GFX7_MI_NOOP, noop);
if (!device->info.has_llc)
if (device->physical->memory.need_clflush)
intel_clflush_range(batch.start, batch.next - batch.start);
return VK_SUCCESS;

View File

@ -1593,7 +1593,7 @@ write_reloc(const struct anv_device *device, void *p, uint64_t v, bool flush)
*(uint32_t *)p = v;
}
if (flush && !device->info.has_llc)
if (flush && device->physical->memory.need_clflush)
intel_flush_range(p, reloc_size);
}

View File

@ -97,7 +97,7 @@ VkResult anv_QueuePresentKHR(
if (device->debug_frame_desc) {
device->debug_frame_desc->frame_id++;
if (!device->info.has_llc) {
if (device->physical->memory.need_clflush) {
intel_clflush_range(device->debug_frame_desc,
sizeof(*device->debug_frame_desc));
}