Mesa (master): v3dv: serialize pipeline compilation when debugging shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 8 13:15:52 UTC 2021


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Mon Feb  8 09:52:14 2021 +0100

v3dv: serialize pipeline compilation when debugging shaders

It is possible to compile pipelines in multiple threads, but when we
are dumping debug information for shaders, we want all the outputs
serialized so we can make sense of it.

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

---

 src/broadcom/common/v3d_debug.h     |  6 ++++++
 src/broadcom/vulkan/v3dv_pipeline.c | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/src/broadcom/common/v3d_debug.h b/src/broadcom/common/v3d_debug.h
index d9593252461..efa26975870 100644
--- a/src/broadcom/common/v3d_debug.h
+++ b/src/broadcom/common/v3d_debug.h
@@ -60,6 +60,12 @@ extern uint32_t V3D_DEBUG;
 #define V3D_DEBUG_RA                (1 << 16)
 #define V3D_DEBUG_DUMP_SPIRV        (1 << 17)
 
+#define V3D_DEBUG_SHADERS           (V3D_DEBUG_TGSI | V3D_DEBUG_NIR | \
+                                     V3D_DEBUG_VIR | V3D_DEBUG_QPU | \
+                                     V3D_DEBUG_FS | V3D_DEBUG_GS | \
+                                     V3D_DEBUG_VS | V3D_DEBUG_CS | \
+                                     V3D_DEBUG_RA)
+
 #ifdef HAVE_ANDROID_PLATFORM
 #define LOG_TAG "BROADCOM-MESA"
 #if ANDROID_API_LEVEL >= 26
diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c
index 80a64e2b905..a82735ef238 100644
--- a/src/broadcom/vulkan/v3dv_pipeline.c
+++ b/src/broadcom/vulkan/v3dv_pipeline.c
@@ -2993,8 +2993,12 @@ v3dv_CreateGraphicsPipelines(VkDevice _device,
                              const VkAllocationCallbacks *pAllocator,
                              VkPipeline *pPipelines)
 {
+   V3DV_FROM_HANDLE(v3dv_device, device, _device);
    VkResult result = VK_SUCCESS;
 
+   if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
+      mtx_lock(&device->pdevice->mutex);
+
    for (uint32_t i = 0; i < count; i++) {
       VkResult local_result;
 
@@ -3010,6 +3014,9 @@ v3dv_CreateGraphicsPipelines(VkDevice _device,
       }
    }
 
+   if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
+      mtx_unlock(&device->pdevice->mutex);
+
    return result;
 }
 
@@ -3146,8 +3153,12 @@ v3dv_CreateComputePipelines(VkDevice _device,
                             const VkAllocationCallbacks *pAllocator,
                             VkPipeline *pPipelines)
 {
+   V3DV_FROM_HANDLE(v3dv_device, device, _device);
    VkResult result = VK_SUCCESS;
 
+   if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
+      mtx_lock(&device->pdevice->mutex);
+
    for (uint32_t i = 0; i < createInfoCount; i++) {
       VkResult local_result;
       local_result = compute_pipeline_create(_device,
@@ -3162,5 +3173,8 @@ v3dv_CreateComputePipelines(VkDevice _device,
       }
    }
 
+   if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
+      mtx_unlock(&device->pdevice->mutex);
+
    return result;
 }



More information about the mesa-commit mailing list