pass context pointer to _tnl_free_immediate(), removed backref pointer
[mesa.git] / src / mesa / math / m_debug_util.h
index e49f3615c726c7de9de0292aee26ce7f61c3522d..efedda973bb85f6afa198d5f66c6d6317d221544 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: m_debug_util.h,v 1.1 2001/02/03 08:41:04 gareth Exp $ */
+/* $Id: m_debug_util.h,v 1.4 2001/05/23 14:27:03 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
  * Version:  3.5
  *
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -23,7 +23,7 @@
  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
- * Author:
+ * Authors:
  *    Gareth Hughes <gareth@valinux.com>
  */
 
@@ -38,7 +38,9 @@
  * NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher)
  * (hope, you don't try to debug Mesa on a 386 ;)
  */
-#if defined(__GNUC__) && defined(__i386__) && defined(USE_X86_ASM)
+#if defined(__GNUC__) && \
+    ((defined(__i386__) && defined(USE_X86_ASM)) || \
+     (defined(__sparc__) && defined(USE_SPARC_ASM)))
 #define  RUN_DEBUG_BENCHMARK
 #endif
 
@@ -67,6 +69,8 @@ extern char *mesa_profile;
  * It is assumed that all calculations are done in the cache.
  */
 
+#if defined(__i386__)
+
 #if 1 /* PPro, PII, PIII version */
 
 /* Profiling on the P6 architecture requires a little more work, due to
@@ -183,6 +187,30 @@ extern char *mesa_profile;
 
 #endif
 
+#elif defined(__sparc__)
+
+#define  INIT_COUNTER()        \
+        do { counter_overhead = 5; } while(0)
+
+#define  BEGIN_RACE(x)                                                        \
+x = LONG_MAX;                                                                 \
+for (cycle_i = 0; cycle_i <10; cycle_i++) {                                   \
+   register long cycle_tmp1 asm("l0");                                       \
+   register long cycle_tmp2 asm("l1");                                       \
+   /* rd %tick, %l0 */                                                       \
+   __asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1));  /*  save timestamp   */
+
+#define END_RACE(x)                                                           \
+   /* rd %tick, %l1 */                                                       \
+   __asm__ __volatile__ (".word 0xa3410000" : "=r" (cycle_tmp2));            \
+   if (x > (cycle_tmp2-cycle_tmp1)) x = cycle_tmp2 - cycle_tmp1;              \
+}                                                                             \
+x -= counter_overhead;
+
+#else
+#error Your processor is not supported for RUN_XFORM_BENCHMARK
+#endif
+
 #else
 
 #define BEGIN_RACE(x)
@@ -191,7 +219,7 @@ extern char *mesa_profile;
 #endif
 
 
-/* ================================================================
+/* =============================================================
  * Helper functions
  */