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