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

Author: Chia-I Wu <[email protected]>
Date:   Thu Aug 25 15:49:37 2022 -0700

venus: use MESA_TRACE_*

Acked-by: Rob Clark <[email protected]>
Reviewed-by: Antonio Caggiano <[email protected]>
Reviewed-by: Yiwei Zhang <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18260>

---

 src/virtio/vulkan/vn_common.h | 50 +++++--------------------------------------
 1 file changed, 5 insertions(+), 45 deletions(-)

diff --git a/src/virtio/vulkan/vn_common.h b/src/virtio/vulkan/vn_common.h
index 12994ec6840..69a49f1ca7a 100644
--- a/src/virtio/vulkan/vn_common.h
+++ b/src/virtio/vulkan/vn_common.h
@@ -30,6 +30,7 @@
 #include "util/list.h"
 #include "util/macros.h"
 #include "util/os_time.h"
+#include "util/perf/cpu_trace.h"
 #include "util/simple_mtx.h"
 #include "util/u_math.h"
 #include "util/xmlconfig.h"
@@ -53,51 +54,10 @@
 #define vn_result(instance, result)                                          \
    ((result) >= VK_SUCCESS ? (result) : vn_error((instance), (result)))
 
-#ifdef ANDROID
-
-#include <cutils/trace.h>
-
-#define VN_TRACE_BEGIN(name) atrace_begin(ATRACE_TAG_GRAPHICS, name)
-#define VN_TRACE_END() atrace_end(ATRACE_TAG_GRAPHICS)
-
-#else
-
-/* XXX we would like to use perfetto, but it lacks a C header */
-#define VN_TRACE_BEGIN(name)
-#define VN_TRACE_END()
-
-#endif /* ANDROID */
-
-#if __has_attribute(cleanup) && __has_attribute(unused)
-
-#define VN_TRACE_SCOPE_VAR_CONCAT(name, suffix) name##suffix
-#define VN_TRACE_SCOPE_VAR(suffix)                                           \
-   VN_TRACE_SCOPE_VAR_CONCAT(_vn_trace_scope_, suffix)
-#define VN_TRACE_SCOPE(name)                                                 \
-   int VN_TRACE_SCOPE_VAR(__LINE__)                                          \
-      __attribute__((cleanup(vn_trace_scope_end), unused)) =                 \
-         vn_trace_scope_begin(name)
-
-static inline int
-vn_trace_scope_begin(const char *name)
-{
-   VN_TRACE_BEGIN(name);
-   return 0;
-}
-
-static inline void
-vn_trace_scope_end(int *scope)
-{
-   VN_TRACE_END();
-}
-
-#else
-
-#define VN_TRACE_SCOPE(name)
-
-#endif /* __has_attribute(cleanup) && __has_attribute(unused) */
-
-#define VN_TRACE_FUNC() VN_TRACE_SCOPE(__func__)
+#define VN_TRACE_BEGIN(name) MESA_TRACE_BEGIN(name)
+#define VN_TRACE_END() MESA_TRACE_END()
+#define VN_TRACE_SCOPE(name) MESA_TRACE_SCOPE(name)
+#define VN_TRACE_FUNC() MESA_TRACE_SCOPE(__func__)
 
 struct vn_instance;
 struct vn_physical_device;

Reply via email to