Module: Mesa Branch: main Commit: 20a066e9ab862c271039612536296b3139553adb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=20a066e9ab862c271039612536296b3139553adb
Author: Alejandro PiƱeiro <[email protected]> Date: Tue Mar 14 12:34:31 2023 +0100 v3dv/debug: add debug option to disable TFU codepaths This can have two main uses: * If we suspect a problem with TFU copies, we can disable it and check if other codepaths gets a test/app working. * To test other codepaths, as in general, TFU is the preferred option for copies. Note that for now this is only for v3dv, as for v3d, mipmap generation uses TFU without an alternative codepath. With this option we also adds an assert if we try to submit a TFU job, just in case we keep adding other methods that use TFU, and forget to include the debug option there. Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Juan A. Suarez <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21952> --- src/broadcom/common/v3d_debug.c | 3 +++ src/broadcom/common/v3d_debug.h | 1 + src/broadcom/vulkan/v3dv_meta_copy.c | 15 +++++++++++++++ src/broadcom/vulkan/v3dv_queue.c | 2 ++ 4 files changed, 21 insertions(+) diff --git a/src/broadcom/common/v3d_debug.c b/src/broadcom/common/v3d_debug.c index caa2f305f1d..f9cd5aca742 100644 --- a/src/broadcom/common/v3d_debug.c +++ b/src/broadcom/common/v3d_debug.c @@ -100,6 +100,9 @@ static const struct debug_named_value debug_control[] = { "Don't try to merge subpasses in the same job even if they share framebuffer configuration (v3dv only)" }, { "opt_compile_time", V3D_DEBUG_OPT_COMPILE_TIME, "Don't try to reduce shader spilling, might improve compile times with expensive shaders." }, + /* disable_tfu is v3dv only because v3d has some uses of the TFU without alternative codepaths */ + { "disable_tfu", V3D_DEBUG_DISABLE_TFU, + "Disable TFU (v3dv only)" }, DEBUG_NAMED_VALUE_END }; diff --git a/src/broadcom/common/v3d_debug.h b/src/broadcom/common/v3d_debug.h index e5e6a6356cb..67112ebf361 100644 --- a/src/broadcom/common/v3d_debug.h +++ b/src/broadcom/common/v3d_debug.h @@ -69,6 +69,7 @@ extern uint32_t v3d_mesa_debug; #define V3D_DEBUG_CACHE (1 << 23) #define V3D_DEBUG_NO_MERGE_JOBS (1 << 24) #define V3D_DEBUG_OPT_COMPILE_TIME (1 << 25) +#define V3D_DEBUG_DISABLE_TFU (1 << 26) #define V3D_DEBUG_SHADERS (V3D_DEBUG_TGSI | V3D_DEBUG_NIR | \ V3D_DEBUG_VIR | V3D_DEBUG_QPU | \ diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index 07b8cdf596c..4d83e53795e 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -813,6 +813,11 @@ copy_image_tfu(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_image *src, const VkImageCopy2 *region) { + if (V3D_DBG(DISABLE_TFU)) { + perf_debug("Copy images: TFU disabled, fallbacks could be slower.\n"); + return false; + } + /* Destination can't be raster format */ if (dst->vk.tiling == VK_IMAGE_TILING_LINEAR) return false; @@ -1494,6 +1499,11 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_buffer *buffer, const VkBufferImageCopy2 *region) { + if (V3D_DBG(DISABLE_TFU)) { + perf_debug("Copy buffer to image: TFU disabled, fallbacks could be slower.\n"); + return false; + } + assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT); /* Destination can't be raster format */ @@ -3040,6 +3050,11 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_image *src, const VkImageBlit2 *region) { + if (V3D_DBG(DISABLE_TFU)) { + perf_debug("Blit: TFU disabled, fallbacks could be slower."); + return false; + } + assert(dst->vk.samples == VK_SAMPLE_COUNT_1_BIT); assert(src->vk.samples == VK_SAMPLE_COUNT_1_BIT); diff --git a/src/broadcom/vulkan/v3dv_queue.c b/src/broadcom/vulkan/v3dv_queue.c index 82dca35e7f8..9e1bc702fdb 100644 --- a/src/broadcom/vulkan/v3dv_queue.c +++ b/src/broadcom/vulkan/v3dv_queue.c @@ -871,6 +871,8 @@ handle_tfu_job(struct v3dv_queue *queue, struct v3dv_submit_sync_info *sync_info, bool signal_syncs) { + assert(!V3D_DBG(DISABLE_TFU)); + struct v3dv_device *device = queue->device; const bool needs_sync = sync_info->wait_count || job->serialize;
