Mesa (master): gallium/trace: Fix helgrind complaint about one-time init

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 24 21:24:54 UTC 2020


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Tue Nov 17 14:39:32 2020 -0800

gallium/trace: Fix helgrind complaint about one-time init

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>

---

 src/gallium/auxiliary/driver_trace/tr_screen.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c
index 56a70de894a..90ee53617a1 100644
--- a/src/gallium/auxiliary/driver_trace/tr_screen.c
+++ b/src/gallium/auxiliary/driver_trace/tr_screen.c
@@ -670,15 +670,11 @@ trace_screen_destroy(struct pipe_screen *_screen)
 bool
 trace_enabled(void)
 {
-   static bool firstrun = true;
-
-   if (!firstrun)
-      return trace;
-   firstrun = false;
-
-   if(trace_dump_trace_begin()) {
-      trace_dumping_start();
-      trace = true;
+   do_once {
+      if(trace_dump_trace_begin()) {
+         trace_dumping_start();
+         trace = true;
+      }
    }
 
    return trace;



More information about the mesa-commit mailing list