00001 /************************************************************************** 00002 * 00003 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. 00004 * All Rights Reserved. 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a 00007 * copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sub license, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice (including the 00015 * next paragraph) shall be included in all copies or substantial portions 00016 * of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00019 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 00021 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 00022 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00023 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00024 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00025 * 00026 **************************************************************************/ 00027 00028 /* Authors: Keith Whitwell <keith@tungstengraphics.com> 00029 */ 00030 00031 #ifndef I915_DEBUG_H 00032 #define I915_DEBUG_H 00033 00034 #include <stdarg.h> 00035 00036 struct i915_context; 00037 00038 struct debug_stream 00039 { 00040 unsigned offset; /* current gtt offset */ 00041 char *ptr; /* pointer to gtt offset zero */ 00042 char *end; /* pointer to gtt offset zero */ 00043 unsigned print_addresses; 00044 struct pipe_winsys *winsys; 00045 }; 00046 00047 00048 /* Internal functions 00049 */ 00050 void i915_disassemble_program(struct debug_stream *stream, 00051 const unsigned *program, unsigned sz); 00052 00053 void i915_print_ureg(const char *msg, unsigned ureg); 00054 00055 00056 #define DEBUG_BATCH 0x1 00057 #define DEBUG_BLIT 0x2 00058 #define DEBUG_BUFFER 0x4 00059 #define DEBUG_CONSTANTS 0x8 00060 #define DEBUG_CONTEXT 0x10 00061 #define DEBUG_DRAW 0x20 00062 #define DEBUG_DYNAMIC 0x40 00063 #define DEBUG_FLUSH 0x80 00064 #define DEBUG_MAP 0x100 00065 #define DEBUG_PROGRAM 0x200 00066 #define DEBUG_REGIONS 0x400 00067 #define DEBUG_SAMPLER 0x800 00068 #define DEBUG_STATIC 0x1000 00069 #define DEBUG_SURFACE 0x2000 00070 #define DEBUG_WINSYS 0x4000 00071 00072 #include "pipe/p_compiler.h" 00073 00074 #if defined(DEBUG) && defined(FILE_DEBUG_FLAG) 00075 00076 #include "pipe/p_winsys.h" 00077 00078 static INLINE void 00079 I915_DBG( 00080 struct i915_context *i915, 00081 const char *fmt, 00082 ... ) 00083 { 00084 if ((i915)->debug & FILE_DEBUG_FLAG) { 00085 va_list args; 00086 00087 va_start( args, fmt ); 00088 debug_vprintf( fmt, args ); 00089 va_end( args ); 00090 } 00091 } 00092 00093 #else 00094 00095 static INLINE void 00096 I915_DBG( 00097 struct i915_context *i915, 00098 const char *fmt, 00099 ... ) 00100 { 00101 (void) i915; 00102 (void) fmt; 00103 } 00104 00105 #endif 00106 00107 00108 void i915_dump_batchbuffer( struct i915_context *i915 ); 00109 00110 00111 00112 void i915_debug_init( struct i915_context *i915 ); 00113 00114 00115 #endif