glamor_debug.h 2.46 KB
Newer Older
1 2 3 4 5 6 7
#ifndef __GLAMOR_DEBUG_H__
#define __GLAMOR_DEBUG_H__


#define GLAMOR_DELAYED_STRING_MAX 64

#define GLAMOR_DEBUG_NONE                     0
8
#define GLAMOR_DEBUG_UNIMPL                   0
9
#define GLAMOR_DEBUG_FALLBACK                 1
10 11 12 13
#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD         2
#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD   3

extern void
Zhigang Gong's avatar
Zhigang Gong committed
14 15
AbortServer(void)
    _X_NORETURN;
16 17 18 19 20 21 22

#define GLAMOR_PANIC(_format_, ...)			\
  do {							\
    LogMessageVerb(X_NONE, 0, "Glamor Fatal Error"	\
		   " at %32s line %d: " _format_ "\n",	\
		   __FUNCTION__, __LINE__,		\
		   ##__VA_ARGS__ );			\
Zhigang Gong's avatar
Zhigang Gong committed
23
    exit(1);                                            \
24
  } while(0)
Zhigang Gong's avatar
Zhigang Gong committed
25

26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83


#define __debug_output_message(_format_, _prefix_, ...) \
  LogMessageVerb(X_NONE, 0,				\
		 "%32s:\t" _format_ ,		\
		 /*_prefix_,*/				\
		 __FUNCTION__,				\
		 ##__VA_ARGS__)

#define glamor_debug_output(_level_, _format_,...)	\
  do {							\
    if (glamor_debug_level >= _level_)			\
      __debug_output_message(_format_,			\
			     "Glamor debug",		\
			     ##__VA_ARGS__);		\
  } while(0)


#define glamor_fallback(_format_,...)			\
  do {							\
    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK)	\
      __debug_output_message(_format_,			\
			     "Glamor fallback",		\
			     ##__VA_ARGS__);} while(0)



#define glamor_delayed_fallback(_screen_, _format_,...)			\
  do {									\
    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK)  {			\
      glamor_screen_private *_glamor_priv_;				\
      _glamor_priv_ = glamor_get_screen_private(_screen_);		\
      _glamor_priv_->delayed_fallback_pending = 1;			\
      snprintf(_glamor_priv_->delayed_fallback_string,			\
	       GLAMOR_DELAYED_STRING_MAX,				\
	       "glamor delayed fallback: \t%s " _format_ ,		\
               __FUNCTION__, ##__VA_ARGS__); } } while(0)


#define glamor_clear_delayed_fallbacks(_screen_)			\
  do {									\
    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) {			\
      glamor_screen_private *_glamor_priv_;				\
	_glamor_priv_ = glamor_get_screen_private(_screen_);		\
      _glamor_priv_->delayed_fallback_pending = 0;  } } while(0)

#define glamor_report_delayed_fallbacks(_screen_)			\
  do {									\
    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) {			\
      glamor_screen_private *_glamor_priv_;				\
      _glamor_priv_ = glamor_get_screen_private(_screen_);		\
      LogMessageVerb(X_INFO, 0, "%s",					\
		     _glamor_priv_->delayed_fallback_string);		\
      _glamor_priv_->delayed_fallback_pending = 0;  } } while(0)


#endif