debug.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * File: drivers/video/omap_new/debug.c
  3. *
  4. * Debug support for the omapfb driver
  5. *
  6. * Copyright (C) 2004 Nokia Corporation
  7. * Author: Imre Deak <imre.deak@nokia.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program.
  21. */
  22. #ifndef __MTKFB_DEBUG_H
  23. #define __MTKFB_DEBUG_H
  24. void DBG_Init(void);
  25. void DBG_Deinit(void);
  26. void DBG_OnTriggerLcd(void);
  27. void DBG_OnTeDelayDone(void);
  28. void DBG_OnLcdDone(void);
  29. #include "mmprofile.h"
  30. extern struct MTKFB_MMP_Events_t {
  31. MMP_Event MTKFB;
  32. MMP_Event CreateSyncTimeline;
  33. MMP_Event PanDisplay;
  34. MMP_Event SetOverlayLayer;
  35. MMP_Event SetOverlayLayers;
  36. MMP_Event SetMultipleLayers;
  37. MMP_Event CreateSyncFence;
  38. MMP_Event IncSyncTimeline;
  39. MMP_Event SignalSyncFence;
  40. MMP_Event TrigOverlayOut;
  41. MMP_Event UpdateScreenImpl;
  42. MMP_Event VSync;
  43. MMP_Event UpdateConfig;
  44. MMP_Event ConfigOVL;
  45. MMP_Event ConfigAAL;
  46. MMP_Event ConfigMemOut;
  47. MMP_Event ScreenUpdate;
  48. MMP_Event CaptureFramebuffer;
  49. MMP_Event RegUpdate;
  50. MMP_Event EarlySuspend;
  51. MMP_Event DispDone;
  52. MMP_Event DSICmd;
  53. MMP_Event DSIIRQ;
  54. MMP_Event EsdCheck;
  55. MMP_Event WaitVSync;
  56. MMP_Event LayerDump;
  57. MMP_Event Layer[4];
  58. MMP_Event OvlDump;
  59. MMP_Event FBDump;
  60. MMP_Event DSIRead;
  61. MMP_Event GetLayerInfo;
  62. MMP_Event LayerInfo[4];
  63. MMP_Event IOCtrl;
  64. MMP_Event Debug;
  65. } MTKFB_MMP_Events;
  66. #ifdef MTKFB_DBG
  67. #include "disp_drv_log.h"
  68. #define DBG_BUF_SIZE 2048
  69. #define MAX_DBG_INDENT_LEVEL 5
  70. #define DBG_INDENT_SIZE 3
  71. #define MAX_DBG_MESSAGES 0
  72. static int dbg_indent;
  73. static int dbg_cnt;
  74. static char dbg_buf[DBG_BUF_SIZE];
  75. static spinlock_t dbg_spinlock = SPIN_LOCK_UNLOCKED;
  76. static inline void dbg_print(int level, const char *fmt, ...)
  77. {
  78. if (level <= MTKFB_DBG) {
  79. if (!MAX_DBG_MESSAGES || dbg_cnt < MAX_DBG_MESSAGES) {
  80. va_list args;
  81. int ind = dbg_indent;
  82. unsigned long flags;
  83. spin_lock_irqsave(&dbg_spinlock, flags);
  84. dbg_cnt++;
  85. if (ind > MAX_DBG_INDENT_LEVEL)
  86. ind = MAX_DBG_INDENT_LEVEL;
  87. pr_info("DISP/DBG " "%*s", ind * DBG_INDENT_SIZE, "");
  88. va_start(args, fmt);
  89. vsnprintf(dbg_buf, sizeof(dbg_buf), fmt, args);
  90. pr_info("DISP/DBG " dbg_buf);
  91. va_end(args);
  92. spin_unlock_irqrestore(&dbg_spinlock, flags);
  93. }
  94. }
  95. }
  96. #define DBGPRINT dbg_print
  97. #define DBGENTER(level) do { \
  98. dbg_print(level, "%s: Enter\n", __func__); \
  99. dbg_indent++; \
  100. } while (0)
  101. #define DBGLEAVE(level) do { \
  102. dbg_indent--; \
  103. dbg_print(level, "%s: Leave\n", __func__); \
  104. } while (0)
  105. /* Debug Macros */
  106. #define MTKFB_DBG_EVT_NONE 0x00000000
  107. #define MTKFB_DBG_EVT_FUNC 0x00000001 /* Function Entry */
  108. #define MTKFB_DBG_EVT_ARGU 0x00000002 /* Function Arguments */
  109. #define MTKFB_DBG_EVT_INFO 0x00000003 /* Information */
  110. #define MTKFB_DBG_EVT_MASK (MTKFB_DBG_EVT_NONE)
  111. #define MSG(evt, fmt, args...) \
  112. do { \
  113. if ((MTKFB_DBG_EVT_##evt) & MTKFB_DBG_EVT_MASK) \
  114. pr_info("DISP/DBG " fmt, ##args); \
  115. } while (0)
  116. #define MSG_FUNC_ENTER(f) MSG(FUNC, "<FB_ENTER>: %s\n", __func__)
  117. #define MSG_FUNC_LEAVE(f) MSG(FUNC, "<FB_LEAVE>: %s\n", __func__)
  118. #else /* MTKFB_DBG */
  119. #define DBGPRINT(level, format, ...)
  120. #define DBGENTER(level)
  121. #define DBGLEAVE(level)
  122. /* Debug Macros */
  123. #define MSG(evt, fmt, args...)
  124. #define MSG_FUNC_ENTER()
  125. #define MSG_FUNC_LEAVE()
  126. void _debug_pattern(unsigned long mva, unsigned long va, unsigned int w, unsigned int h,
  127. unsigned int linepitch, unsigned int color, unsigned int layerid,
  128. unsigned int bufidx);
  129. void _debug_fps_meter(unsigned long mva, unsigned long va, unsigned int w, unsigned int h,
  130. unsigned int linepitch, unsigned int color, unsigned int layerid,
  131. unsigned int bufidx);
  132. bool get_ovl1_to_mem_on(void);
  133. #endif /* MTKFB_DBG */
  134. #endif /* __MTKFB_DEBUG_H */