135c4bbdfSmrg/* 235c4bbdfSmrg * Copyright © 2009 Intel Corporation 335c4bbdfSmrg * Copyright © 1998 Keith Packard 435c4bbdfSmrg * 535c4bbdfSmrg * Permission is hereby granted, free of charge, to any person obtaining a 635c4bbdfSmrg * copy of this software and associated documentation files (the "Software"), 735c4bbdfSmrg * to deal in the Software without restriction, including without limitation 835c4bbdfSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 935c4bbdfSmrg * and/or sell copies of the Software, and to permit persons to whom the 1035c4bbdfSmrg * Software is furnished to do so, subject to the following conditions: 1135c4bbdfSmrg * 1235c4bbdfSmrg * The above copyright notice and this permission notice (including the next 1335c4bbdfSmrg * paragraph) shall be included in all copies or substantial portions of the 1435c4bbdfSmrg * Software. 1535c4bbdfSmrg * 1635c4bbdfSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1735c4bbdfSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1835c4bbdfSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1935c4bbdfSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2035c4bbdfSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2135c4bbdfSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 2235c4bbdfSmrg * IN THE SOFTWARE. 2335c4bbdfSmrg * 2435c4bbdfSmrg * Authors: 2535c4bbdfSmrg * Zhigang Gong <zhigang.gong@gmail.com> 2635c4bbdfSmrg * 2735c4bbdfSmrg */ 2835c4bbdfSmrg 2935c4bbdfSmrg#ifndef __GLAMOR_DEBUG_H__ 3035c4bbdfSmrg#define __GLAMOR_DEBUG_H__ 3135c4bbdfSmrg 3235c4bbdfSmrg#define GLAMOR_DEBUG_NONE 0 3335c4bbdfSmrg#define GLAMOR_DEBUG_UNIMPL 0 3435c4bbdfSmrg#define GLAMOR_DEBUG_FALLBACK 1 3535c4bbdfSmrg#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 2 3635c4bbdfSmrg#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 3 3735c4bbdfSmrg 3835c4bbdfSmrgextern void 3935c4bbdfSmrgAbortServer(void) 4035c4bbdfSmrg _X_NORETURN; 4135c4bbdfSmrg 4235c4bbdfSmrg#define GLAMOR_PANIC(_format_, ...) \ 4335c4bbdfSmrg do { \ 4435c4bbdfSmrg LogMessageVerb(X_NONE, 0, "Glamor Fatal Error" \ 4535c4bbdfSmrg " at %32s line %d: " _format_ "\n", \ 4635c4bbdfSmrg __FUNCTION__, __LINE__, \ 4735c4bbdfSmrg ##__VA_ARGS__ ); \ 4835c4bbdfSmrg exit(1); \ 4935c4bbdfSmrg } while(0) 5035c4bbdfSmrg 5135c4bbdfSmrg#define __debug_output_message(_format_, _prefix_, ...) \ 5235c4bbdfSmrg LogMessageVerb(X_NONE, 0, \ 5335c4bbdfSmrg "%32s:\t" _format_ , \ 5435c4bbdfSmrg /*_prefix_,*/ \ 5535c4bbdfSmrg __FUNCTION__, \ 5635c4bbdfSmrg ##__VA_ARGS__) 5735c4bbdfSmrg 5835c4bbdfSmrg#define glamor_debug_output(_level_, _format_,...) \ 5935c4bbdfSmrg do { \ 6035c4bbdfSmrg if (glamor_debug_level >= _level_) \ 6135c4bbdfSmrg __debug_output_message(_format_, \ 6235c4bbdfSmrg "Glamor debug", \ 6335c4bbdfSmrg ##__VA_ARGS__); \ 6435c4bbdfSmrg } while(0) 6535c4bbdfSmrg 6635c4bbdfSmrg#define glamor_fallback(_format_,...) \ 6735c4bbdfSmrg do { \ 6835c4bbdfSmrg if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) \ 6935c4bbdfSmrg __debug_output_message(_format_, \ 7035c4bbdfSmrg "Glamor fallback", \ 7135c4bbdfSmrg ##__VA_ARGS__);} while(0) 7235c4bbdfSmrg 7335c4bbdfSmrg#define DEBUGF(str, ...) do {} while(0) 7435c4bbdfSmrg//#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) 7535c4bbdfSmrg#define DEBUGRegionPrint(x) do {} while (0) 7635c4bbdfSmrg//#define DEBUGRegionPrint RegionPrint 7735c4bbdfSmrg 7835c4bbdfSmrg#endif 79