mtk_drm_mmp.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (C) 2015 MediaTek Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __MTK_DRM_MMP_H__
  14. #define __MTK_DRM_MMP_H__
  15. #include "mmprofile.h"
  16. #include "mmprofile_function.h"
  17. #include "mtk_drm_ddp.h"
  18. #define MMP_CRTC_NUM 3
  19. /* if changed, need to update init_drm_mmp_event() */
  20. struct DRM_MMP_Events {
  21. mmp_event drm;
  22. mmp_event crtc[MMP_CRTC_NUM];
  23. /* define for IRQ */
  24. mmp_event IRQ;
  25. mmp_event ovl;
  26. mmp_event ovl0;
  27. mmp_event ovl1;
  28. mmp_event ovl0_2l;
  29. mmp_event ovl1_2l;
  30. mmp_event ovl2_2l;
  31. mmp_event ovl3_2l;
  32. mmp_event rdma;
  33. mmp_event rdma0;
  34. mmp_event rdma1;
  35. mmp_event rdma4;
  36. mmp_event rdma5;
  37. mmp_event wdma;
  38. mmp_event wdma0;
  39. mmp_event dsi;
  40. mmp_event dsi0;
  41. mmp_event dsi1;
  42. mmp_event dp_intf0;
  43. mmp_event ddp;
  44. mmp_event mutex[DISP_MUTEX_DDP_COUNT];
  45. mmp_event postmask;
  46. mmp_event postmask0;
  47. mmp_event abnormal_irq;
  48. mmp_event pmqos;
  49. mmp_event hrt_bw;
  50. mmp_event mutex_lock;
  51. mmp_event layering;
  52. mmp_event dma_alloc;
  53. mmp_event dma_free;
  54. mmp_event dma_get;
  55. mmp_event dma_put;
  56. mmp_event ion_import_dma;
  57. mmp_event ion_import_fd;
  58. mmp_event ion_import_free;
  59. mmp_event set_mode;
  60. };
  61. /* if changed, need to update init_crtc_mmp_event() */
  62. struct CRTC_MMP_Events {
  63. mmp_event trig_loop_done;
  64. mmp_event enable;
  65. mmp_event disable;
  66. mmp_event release_fence;
  67. mmp_event update_present_fence;
  68. mmp_event release_present_fence;
  69. mmp_event atomic_begin;
  70. mmp_event atomic_flush;
  71. mmp_event enable_vblank;
  72. mmp_event disable_vblank;
  73. mmp_event esd_check;
  74. mmp_event esd_recovery;
  75. mmp_event leave_idle;
  76. mmp_event enter_idle;
  77. mmp_event frame_cfg;
  78. mmp_event suspend;
  79. mmp_event resume;
  80. mmp_event dsi_suspend;
  81. mmp_event dsi_resume;
  82. mmp_event backlight;
  83. mmp_event backlight_grp;
  84. mmp_event ddic_send_cmd;
  85. mmp_event ddic_read_cmd;
  86. mmp_event path_switch;
  87. mmp_event user_cmd;
  88. mmp_event check_trigger;
  89. mmp_event kick_trigger;
  90. mmp_event atomic_commit;
  91. mmp_event user_cmd_cb;
  92. mmp_event bl_cb;
  93. mmp_event clk_change;
  94. mmp_event layerBmpDump;
  95. mmp_event layer_dump[6];
  96. };
  97. struct DRM_MMP_Events *get_drm_mmp_events(void);
  98. struct CRTC_MMP_Events *get_crtc_mmp_events(unsigned long id);
  99. void drm_mmp_init(void);
  100. int mtk_drm_mmp_ovl_layer(struct mtk_plane_state *state,
  101. u32 downSampleX, u32 downSampleY);
  102. /* print mmp log for DRM_MMP_Events */
  103. #ifdef CONFIG_DRM_MEDIATEK
  104. #define DRM_MMP_MARK(event, v1, v2) \
  105. mmprofile_log_ex(get_drm_mmp_events()->event, \
  106. MMPROFILE_FLAG_PULSE, v1, v2)
  107. #define DRM_MMP_EVENT_START(event, v1, v2) \
  108. mmprofile_log_ex(get_drm_mmp_events()->event, \
  109. MMPROFILE_FLAG_START, v1, v2)
  110. #define DRM_MMP_EVENT_END(event, v1, v2) \
  111. mmprofile_log_ex(get_drm_mmp_events()->event, \
  112. MMPROFILE_FLAG_END, v1, v2)
  113. /* print mmp log for CRTC_MMP_Events */
  114. #define CRTC_MMP_MARK(id, event, v1, v2) \
  115. do { \
  116. if (id >= 0 && id < MMP_CRTC_NUM) \
  117. mmprofile_log_ex(get_crtc_mmp_events(id)->event, \
  118. MMPROFILE_FLAG_PULSE, v1, v2); \
  119. } while (0)
  120. #define CRTC_MMP_EVENT_START(id, event, v1, v2) \
  121. do { \
  122. if (id >= 0 && id < MMP_CRTC_NUM) \
  123. mmprofile_log_ex(get_crtc_mmp_events(id)->event, \
  124. MMPROFILE_FLAG_START, v1, v2); \
  125. } while (0)
  126. #define CRTC_MMP_EVENT_END(id, event, v1, v2) \
  127. do { \
  128. if (id >= 0 && id < MMP_CRTC_NUM) \
  129. mmprofile_log_ex(get_crtc_mmp_events(id)->event, \
  130. MMPROFILE_FLAG_END, v1, v2); \
  131. } while (0)
  132. #else
  133. #define DRM_MMP_MARK(event, v1, v2) do { } while (0)
  134. #define DRM_MMP_EVENT_START(event, v1, v2) do { } while (0)
  135. #define DRM_MMP_EVENT_END(event, v1, v2) do { } while (0)
  136. #define CRTC_MMP_MARK(id, event, v1, v2) do { } while (0)
  137. #define CRTC_MMP_EVENT_START(id, event, v1, v2) do { } while (0)
  138. #define CRTC_MMP_EVENT_END(id, event, v1, v2) do { } while (0)
  139. #endif
  140. #endif