1 /**********************************************************
2 * Copyright 2008-2009 VMware, Inc. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 **********************************************************/
25
26 #ifndef SVGA_DEBUG_H
27 #define SVGA_DEBUG_H
28
29 #include "pipe/p_compiler.h"
30 #include "util/u_debug.h"
31
32 #define DEBUG_DMA 0x1
33 #define DEBUG_TGSI 0x4
34 #define DEBUG_PIPE 0x8
35 #define DEBUG_STATE 0x10
36 #define DEBUG_SCREEN 0x20
37 #define DEBUG_TEX 0x40
38 #define DEBUG_SWTNL 0x80
39 #define DEBUG_CONSTS 0x100
40 #define DEBUG_VIEWPORT 0x200
41 #define DEBUG_VIEWS 0x400
42 #define DEBUG_PERF 0x800 /* print something when we hit any slow path operation */
43 #define DEBUG_FLUSH 0x1000 /* flush after every draw */
44 #define DEBUG_SYNC 0x2000 /* sync after every flush */
45 #define DEBUG_QUERY 0x4000
46 #define DEBUG_CACHE 0x8000
47
48 #ifdef DEBUG
49 extern int SVGA_DEBUG;
50 #define DBSTR(x) x
51 #else
52 #define SVGA_DEBUG 0
53 #define DBSTR(x) ""
54 #endif
55
56 static INLINE void
SVGA_DBG(unsigned flag,const char * fmt,...)57 SVGA_DBG( unsigned flag, const char *fmt, ... )
58 {
59 #ifdef DEBUG
60 if (SVGA_DEBUG & flag)
61 {
62 va_list args;
63
64 va_start( args, fmt );
65 debug_vprintf( fmt, args );
66 va_end( args );
67 }
68 #else
69 (void)flag;
70 (void)fmt;
71 #endif
72 }
73
74
75 #endif
76