Mesa (master): gallium/hud: Use do_once for one-time init

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


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Mon Nov 23 14:29:36 2020 -0800

gallium/hud: Use do_once for 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/hud/hud_context.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index bb614f76a95..bea30064221 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -41,6 +41,7 @@
 #include "hud/hud_private.h"
 
 #include "cso_cache/cso_context.h"
+#include "util/debug.h"
 #include "util/u_draw_quad.h"
 #include "util/format/u_format.h"
 #include "util/u_inlines.h"
@@ -1811,8 +1812,10 @@ hud_create(struct cso_context *cso, struct hud_context *share)
 
    memset(&action, 0, sizeof(action));
 #endif
-   huds_visible = debug_get_bool_option("GALLIUM_HUD_VISIBLE", TRUE);
-   hud_scale = debug_get_num_option("GALLIUM_HUD_SCALE", 1);
+   do_once {
+      huds_visible = debug_get_bool_option("GALLIUM_HUD_VISIBLE", TRUE);
+      hud_scale = debug_get_num_option("GALLIUM_HUD_SCALE", 1);
+   }
 
    if (!env || !*env)
       return NULL;



More information about the mesa-commit mailing list