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@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8913>
This commit is contained in:
Iago Toral Quiroga 2021-02-08 09:52:14 +01:00 committed by Marge Bot
parent 44dcc4c24d
commit e6f8202749
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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;
}