Mesa (master): mesa: _mesa_get_x86_features() only needs to do its thing once

Brian Paul brianp at kemper.freedesktop.org
Wed Mar 4 23:44:47 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Mar  4 16:39:11 2009 -0700

mesa: _mesa_get_x86_features() only needs to do its thing once

---

 src/mesa/x86/common_x86.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
index 18b1c22..5efdb4f 100644
--- a/src/mesa/x86/common_x86.c
+++ b/src/mesa/x86/common_x86.c
@@ -199,10 +199,18 @@ void _mesa_check_os_sse_support( void )
 
 /**
  * Initialize the _mesa_x86_cpu_features bitfield.
+ * This is a no-op if called more than once.
  */
 void
 _mesa_get_x86_features(void)
 {
+   static int called = 0;
+
+   if (called)
+      return;
+
+   called = 1;
+
 #ifdef USE_X86_ASM
    _mesa_x86_cpu_features = 0x0;
 




More information about the mesa-commit mailing list