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