anv: Move to a function code to clflush batch buffers

This also need to be executed in Xe kmd, so moving it to a function.
No changes in behavior intended here.

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/22171>
This commit is contained in:
José Roberto de Souza 2023-03-29 09:08:33 -07:00 committed by Marge Bot
parent 88d074cb8f
commit 91ee00a741
3 changed files with 23 additions and 10 deletions

View file

@ -1398,3 +1398,21 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
return result; return result;
} }
void
anv_cmd_buffer_clflush(struct anv_cmd_buffer **cmd_buffers,
uint32_t num_cmd_buffers)
{
#ifdef SUPPORT_INTEL_INTEGRATED_GPUS
struct anv_batch_bo **bbo;
__builtin_ia32_mfence();
for (uint32_t i = 0; i < num_cmd_buffers; i++) {
u_vector_foreach(bbo, &cmd_buffers[i]->seen_bbos) {
for (uint32_t l = 0; l < (*bbo)->length; l += CACHELINE_SIZE)
__builtin_ia32_clflush((*bbo)->bo->map + l);
}
}
#endif
}

View file

@ -2878,6 +2878,9 @@ anv_cmd_buffer_exec_batch_debug(struct anv_queue *queue,
struct anv_cmd_buffer **cmd_buffers, struct anv_cmd_buffer **cmd_buffers,
struct anv_query_pool *perf_query_pool, struct anv_query_pool *perf_query_pool,
uint32_t perf_query_pass); uint32_t perf_query_pass);
void
anv_cmd_buffer_clflush(struct anv_cmd_buffer **cmd_buffers,
uint32_t num_cmd_buffers);
/** /**
* A allocation tied to a command buffer. * A allocation tied to a command buffer.

View file

@ -403,16 +403,8 @@ setup_execbuf_for_cmd_buffers(struct anv_execbuf *execbuf,
} }
#ifdef SUPPORT_INTEL_INTEGRATED_GPUS #ifdef SUPPORT_INTEL_INTEGRATED_GPUS
if (device->physical->memory.need_clflush) { if (device->physical->memory.need_clflush)
__builtin_ia32_mfence(); anv_cmd_buffer_clflush(cmd_buffers, num_cmd_buffers);
struct anv_batch_bo **bbo;
for (uint32_t i = 0; i < num_cmd_buffers; i++) {
u_vector_foreach(bbo, &cmd_buffers[i]->seen_bbos) {
for (uint32_t l = 0; l < (*bbo)->length; l += CACHELINE_SIZE)
__builtin_ia32_clflush((*bbo)->bo->map + l);
}
}
}
#endif #endif
execbuf->execbuf = (struct drm_i915_gem_execbuffer2) { execbuf->execbuf = (struct drm_i915_gem_execbuffer2) {