1/*
2 * Copyright © 2009 Intel Corporation
3 * Copyright © 1998 Keith Packard
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 *
24 * Authors:
25 *    Zhigang Gong <zhigang.gong@gmail.com>
26 *
27 */
28
29#ifndef __GLAMOR_DEBUG_H__
30#define __GLAMOR_DEBUG_H__
31
32#define GLAMOR_DEBUG_NONE                     0
33#define GLAMOR_DEBUG_UNIMPL                   0
34#define GLAMOR_DEBUG_FALLBACK                 1
35#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD         2
36#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD   3
37
38extern void
39AbortServer(void)
40    _X_NORETURN;
41
42#define GLAMOR_PANIC(_format_, ...)			\
43  do {							\
44    LogMessageVerb(X_NONE, 0, "Glamor Fatal Error"	\
45		   " at %32s line %d: " _format_ "\n",	\
46		   __FUNCTION__, __LINE__,		\
47		   ##__VA_ARGS__ );			\
48    exit(1);                                            \
49  } while(0)
50
51#define __debug_output_message(_format_, _prefix_, ...) \
52  LogMessageVerb(X_NONE, 0,				\
53		 "%32s:\t" _format_ ,		\
54		 /*_prefix_,*/				\
55		 __FUNCTION__,				\
56		 ##__VA_ARGS__)
57
58#define glamor_debug_output(_level_, _format_,...)	\
59  do {							\
60    if (glamor_debug_level >= _level_)			\
61      __debug_output_message(_format_,			\
62			     "Glamor debug",		\
63			     ##__VA_ARGS__);		\
64  } while(0)
65
66#define glamor_fallback(_format_,...)			\
67  do {							\
68    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK)	\
69      __debug_output_message(_format_,			\
70			     "Glamor fallback",		\
71			     ##__VA_ARGS__);} while(0)
72
73#define DEBUGF(str, ...)  do {} while(0)
74//#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__)
75#define DEBUGRegionPrint(x) do {} while (0)
76//#define DEBUGRegionPrint RegionPrint
77
78#endif
79