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