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 #define DEBUG_STREAMOUT    0x10000
48 #define DEBUG_SAMPLERS     0x20000
49 #define DEBUG_RETRY        0x100000
50 
51 #ifdef DEBUG
52 extern int SVGA_DEBUG;
53 #define DBSTR(x) x
54 #else
55 #define SVGA_DEBUG 0
56 #define DBSTR(x) ""
57 #endif
58 
59 static inline void
SVGA_DBG(unsigned flag,const char * fmt,...)60 SVGA_DBG( unsigned flag, const char *fmt, ... )
61 {
62 #ifdef DEBUG
63     if (SVGA_DEBUG & flag)
64     {
65         va_list args;
66 
67         va_start( args, fmt );
68         debug_vprintf( fmt, args );
69         va_end( args );
70     }
71 #else
72     (void)flag;
73     (void)fmt;
74 #endif
75 }
76 
77 
78 #endif
79