Mesa (main): v3dv: ignore barriers for image layout transitions from undefined layouts

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 06:27:20 UTC 2022


Module: Mesa
Branch: main
Commit: c9f68361a8ac762b54505eda541a167b014ce0a2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9f68361a8ac762b54505eda541a167b014ce0a2

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Tue Apr 26 09:28:59 2022 +0200

v3dv: ignore barriers for image layout transitions from undefined layouts

Layout transitions are not relevant to us, we only care about barriers
that involve a sync point between read/write actions on the image across
GPU jobs.

Image transitions from undefined layout can only happen before the image
is ever used by the GPU, which means they are never relevant to our
implementation.

This improves performance in vkQuake.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16235>

---

 src/broadcom/vulkan/v3dv_cmd_buffer.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c
index ea4e9a5e820..7ed795f12c0 100644
--- a/src/broadcom/vulkan/v3dv_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c
@@ -2650,6 +2650,19 @@ v3dv_CmdPipelineBarrier(VkCommandBuffer commandBuffer,
 {
    V3DV_FROM_HANDLE(v3dv_cmd_buffer, cmd_buffer, commandBuffer);
 
+   /* We can safely skip barriers for image layout transitions from UNDEFINED
+    * layout.
+    */
+   if (imageBarrierCount > 0) {
+      bool all_undefined = true;
+      for (int i = 0; all_undefined && i < imageBarrierCount; i++) {
+         if (pImageBarriers[i].oldLayout != VK_IMAGE_LAYOUT_UNDEFINED)
+            all_undefined = false;
+      }
+      if (all_undefined)
+         imageBarrierCount = 0;
+   }
+
    if (memoryBarrierCount + bufferBarrierCount + imageBarrierCount == 0)
       return;
 



More information about the mesa-commit mailing list