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

Author: Konstantin Seurer <[email protected]>
Date:   Wed Jan 11 09:39:00 2023 +0100

vulkan/rmv: Only trace on the n-th frame

This makes it stop dumping on every n-th frame. It also uses a simple
increment, since the function is locked.

Fixes: defed48 ("vulkan: Add common RMV tracing infrastructure")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20635>

---

 src/vulkan/util/rmv/vk_rmv_common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/vulkan/util/rmv/vk_rmv_common.c 
b/src/vulkan/util/rmv/vk_rmv_common.c
index 045f4127003..2dc6ba5a736 100644
--- a/src/vulkan/util/rmv/vk_rmv_common.c
+++ b/src/vulkan/util/rmv/vk_rmv_common.c
@@ -92,9 +92,9 @@ vk_rmv_handle_present_locked(struct vk_device *device)
    }
 #endif
 
-   int32_t new_frame_index = p_atomic_add_return(&trace_data->cur_frame_idx, 
1);
-   frame_trigger =
-      (new_frame_index % trace_data->trace_frame_idx == 0) && 
trace_data->trace_frame_idx != -1;
+   frame_trigger = trace_data->cur_frame_idx == trace_data->trace_frame_idx;
+   if (trace_data->cur_frame_idx <= trace_data->trace_frame_idx)
+      trace_data->cur_frame_idx++;
 
    if (file_trigger || frame_trigger)
       vk_dump_rmv_capture(trace_data);

Reply via email to