From 28e4d2249725ddc3d4dd031820e209c3bc4183ad Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 18 Sep 2024 16:53:34 +0200 Subject: [PATCH] panvk/csf: Pass a non-zero flush-id to benefit from cache flush reduction The cache flush reduction mechanism relies on the flush ID to conditionally eliminate cache flush requests if another cache flush happened between the time the flush ID was retrieved and the time the flush operation happens. Store the current flush ID at EndCommandBuffer() time, and pass it back to the submit ioctl(). Signed-off-by: Boris Brezillon Reviewed-by: Mary Guillemard Part-of: --- src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c | 3 +++ src/panfrost/vulkan/csf/panvk_vX_queue.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c b/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c index cb9f54f1153..eb7bef2a807 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c +++ b/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c @@ -148,6 +148,7 @@ VKAPI_ATTR VkResult VKAPI_CALL panvk_per_arch(EndCommandBuffer)(VkCommandBuffer commandBuffer) { VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer); + struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device); emit_tls(cmdbuf); @@ -162,6 +163,8 @@ panvk_per_arch(EndCommandBuffer)(VkCommandBuffer commandBuffer) } } + cmdbuf->flush_id = panthor_kmod_get_flush_id(dev->kmod.dev); + return vk_command_buffer_end(&cmdbuf->vk); } diff --git a/src/panfrost/vulkan/csf/panvk_vX_queue.c b/src/panfrost/vulkan/csf/panvk_vX_queue.c index 9db31531c9a..74836b0fbc6 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_queue.c +++ b/src/panfrost/vulkan/csf/panvk_vX_queue.c @@ -251,7 +251,7 @@ init_subqueue(struct panvk_queue *queue, enum panvk_subqueue_id subqueue) .queue_index = subqueue, .stream_size = cs_root_chunk_size(&b), .stream_addr = cs_root_chunk_gpu_addr(&b), - .latest_flush = 0, + .latest_flush = panthor_kmod_get_flush_id(dev->kmod.dev), .syncs = DRM_PANTHOR_OBJ_ARRAY(1, &syncop), }; struct drm_panthor_group_submit gsubmit = { @@ -568,7 +568,7 @@ panvk_queue_submit(struct vk_queue *vk_queue, struct vk_queue_submit *submit) .queue_index = j, .stream_size = cs_root_chunk_size(&cmdbuf->state.cs[j].builder), .stream_addr = cs_root_chunk_gpu_addr(&cmdbuf->state.cs[j].builder), - .latest_flush = 0, + .latest_flush = cmdbuf->flush_id, }; } }