1848b8605Smrg/**********************************************************
2848b8605Smrg * Copyright 2008-2009 VMware, Inc.  All rights reserved.
3848b8605Smrg *
4848b8605Smrg * Permission is hereby granted, free of charge, to any person
5848b8605Smrg * obtaining a copy of this software and associated documentation
6848b8605Smrg * files (the "Software"), to deal in the Software without
7848b8605Smrg * restriction, including without limitation the rights to use, copy,
8848b8605Smrg * modify, merge, publish, distribute, sublicense, and/or sell copies
9848b8605Smrg * of the Software, and to permit persons to whom the Software is
10848b8605Smrg * furnished to do so, subject to the following conditions:
11848b8605Smrg *
12848b8605Smrg * The above copyright notice and this permission notice shall be
13848b8605Smrg * included in all copies or substantial portions of the Software.
14848b8605Smrg *
15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18848b8605Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19848b8605Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20848b8605Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21848b8605Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22848b8605Smrg * SOFTWARE.
23848b8605Smrg *
24848b8605Smrg **********************************************************/
25848b8605Smrg
26848b8605Smrg#ifndef SVGA_DEBUG_H
27848b8605Smrg#define SVGA_DEBUG_H
28848b8605Smrg
29848b8605Smrg#include "pipe/p_compiler.h"
30848b8605Smrg#include "util/u_debug.h"
31848b8605Smrg
32b8e80941Smrg#define DEBUG_DMA          0x1
33b8e80941Smrg#define DEBUG_TGSI         0x4
34b8e80941Smrg#define DEBUG_PIPE         0x8
35b8e80941Smrg#define DEBUG_STATE        0x10
36b8e80941Smrg#define DEBUG_SCREEN       0x20
37b8e80941Smrg#define DEBUG_TEX          0x40
38b8e80941Smrg#define DEBUG_SWTNL        0x80
39b8e80941Smrg#define DEBUG_CONSTS       0x100
40b8e80941Smrg#define DEBUG_VIEWPORT     0x200
41b8e80941Smrg#define DEBUG_VIEWS        0x400
42b8e80941Smrg#define DEBUG_PERF         0x800    /* print something when we hit any slow path operation */
43b8e80941Smrg#define DEBUG_FLUSH        0x1000   /* flush after every draw */
44b8e80941Smrg#define DEBUG_SYNC         0x2000   /* sync after every flush */
45b8e80941Smrg#define DEBUG_QUERY        0x4000
46b8e80941Smrg#define DEBUG_CACHE        0x8000
47b8e80941Smrg#define DEBUG_STREAMOUT    0x10000
48b8e80941Smrg#define DEBUG_SAMPLERS     0x20000
49848b8605Smrg
50848b8605Smrg#ifdef DEBUG
51848b8605Smrgextern int SVGA_DEBUG;
52848b8605Smrg#define DBSTR(x) x
53848b8605Smrg#else
54848b8605Smrg#define SVGA_DEBUG 0
55848b8605Smrg#define DBSTR(x) ""
56848b8605Smrg#endif
57848b8605Smrg
58b8e80941Smrgstatic inline void
59848b8605SmrgSVGA_DBG( unsigned flag, const char *fmt, ... )
60848b8605Smrg{
61848b8605Smrg#ifdef DEBUG
62848b8605Smrg    if (SVGA_DEBUG & flag)
63848b8605Smrg    {
64848b8605Smrg        va_list args;
65848b8605Smrg
66848b8605Smrg        va_start( args, fmt );
67848b8605Smrg        debug_vprintf( fmt, args );
68848b8605Smrg        va_end( args );
69848b8605Smrg    }
70848b8605Smrg#else
71848b8605Smrg    (void)flag;
72848b8605Smrg    (void)fmt;
73848b8605Smrg#endif
74848b8605Smrg}
75848b8605Smrg
76848b8605Smrg
77848b8605Smrg#endif
78