dcn10_mpc.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /* Copyright 2012-15 Advanced Micro Devices, Inc.
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a
  4. * copy of this software and associated documentation files (the "Software"),
  5. * to deal in the Software without restriction, including without limitation
  6. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7. * and/or sell copies of the Software, and to permit persons to whom the
  8. * Software is furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  16. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  17. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  18. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  19. * OTHER DEALINGS IN THE SOFTWARE.
  20. *
  21. * Authors: AMD
  22. *
  23. */
  24. #ifndef __DC_MPCC_DCN10_H__
  25. #define __DC_MPCC_DCN10_H__
  26. #include "mpc.h"
  27. #define TO_DCN10_MPC(mpc_base) \
  28. container_of(mpc_base, struct dcn10_mpc, base)
  29. #define MPC_COMMON_REG_LIST_DCN1_0(inst) \
  30. SRII(MPCC_TOP_SEL, MPCC, inst),\
  31. SRII(MPCC_BOT_SEL, MPCC, inst),\
  32. SRII(MPCC_CONTROL, MPCC, inst),\
  33. SRII(MPCC_STATUS, MPCC, inst),\
  34. SRII(MPCC_OPP_ID, MPCC, inst),\
  35. SRII(MPCC_BG_G_Y, MPCC, inst),\
  36. SRII(MPCC_BG_R_CR, MPCC, inst),\
  37. SRII(MPCC_BG_B_CB, MPCC, inst),\
  38. SRII(MPCC_BG_B_CB, MPCC, inst),\
  39. SRII(MPCC_SM_CONTROL, MPCC, inst)
  40. #define MPC_OUT_MUX_COMMON_REG_LIST_DCN1_0(inst) \
  41. SRII(MUX, MPC_OUT, inst)
  42. #define MPC_COMMON_REG_VARIABLE_LIST \
  43. uint32_t MPCC_TOP_SEL[MAX_MPCC]; \
  44. uint32_t MPCC_BOT_SEL[MAX_MPCC]; \
  45. uint32_t MPCC_CONTROL[MAX_MPCC]; \
  46. uint32_t MPCC_STATUS[MAX_MPCC]; \
  47. uint32_t MPCC_OPP_ID[MAX_MPCC]; \
  48. uint32_t MPCC_BG_G_Y[MAX_MPCC]; \
  49. uint32_t MPCC_BG_R_CR[MAX_MPCC]; \
  50. uint32_t MPCC_BG_B_CB[MAX_MPCC]; \
  51. uint32_t MPCC_SM_CONTROL[MAX_MPCC]; \
  52. uint32_t MUX[MAX_OPP];
  53. #define MPC_COMMON_MASK_SH_LIST_DCN1_0(mask_sh)\
  54. SF(MPCC0_MPCC_TOP_SEL, MPCC_TOP_SEL, mask_sh),\
  55. SF(MPCC0_MPCC_BOT_SEL, MPCC_BOT_SEL, mask_sh),\
  56. SF(MPCC0_MPCC_CONTROL, MPCC_MODE, mask_sh),\
  57. SF(MPCC0_MPCC_CONTROL, MPCC_ALPHA_BLND_MODE, mask_sh),\
  58. SF(MPCC0_MPCC_CONTROL, MPCC_ALPHA_MULTIPLIED_MODE, mask_sh),\
  59. SF(MPCC0_MPCC_CONTROL, MPCC_BLND_ACTIVE_OVERLAP_ONLY, mask_sh),\
  60. SF(MPCC0_MPCC_CONTROL, MPCC_GLOBAL_ALPHA, mask_sh),\
  61. SF(MPCC0_MPCC_CONTROL, MPCC_GLOBAL_GAIN, mask_sh),\
  62. SF(MPCC0_MPCC_STATUS, MPCC_IDLE, mask_sh),\
  63. SF(MPCC0_MPCC_STATUS, MPCC_BUSY, mask_sh),\
  64. SF(MPCC0_MPCC_OPP_ID, MPCC_OPP_ID, mask_sh),\
  65. SF(MPCC0_MPCC_BG_G_Y, MPCC_BG_G_Y, mask_sh),\
  66. SF(MPCC0_MPCC_BG_R_CR, MPCC_BG_R_CR, mask_sh),\
  67. SF(MPCC0_MPCC_BG_B_CB, MPCC_BG_B_CB, mask_sh),\
  68. SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_EN, mask_sh),\
  69. SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_MODE, mask_sh),\
  70. SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FRAME_ALT, mask_sh),\
  71. SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FIELD_ALT, mask_sh),\
  72. SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_FRAME_POL, mask_sh),\
  73. SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_TOP_POL, mask_sh),\
  74. SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh)
  75. #define MPC_REG_FIELD_LIST(type) \
  76. type MPCC_TOP_SEL;\
  77. type MPCC_BOT_SEL;\
  78. type MPCC_MODE;\
  79. type MPCC_ALPHA_BLND_MODE;\
  80. type MPCC_ALPHA_MULTIPLIED_MODE;\
  81. type MPCC_BLND_ACTIVE_OVERLAP_ONLY;\
  82. type MPCC_GLOBAL_ALPHA;\
  83. type MPCC_GLOBAL_GAIN;\
  84. type MPCC_IDLE;\
  85. type MPCC_BUSY;\
  86. type MPCC_OPP_ID;\
  87. type MPCC_BG_G_Y;\
  88. type MPCC_BG_R_CR;\
  89. type MPCC_BG_B_CB;\
  90. type MPCC_SM_EN;\
  91. type MPCC_SM_MODE;\
  92. type MPCC_SM_FRAME_ALT;\
  93. type MPCC_SM_FIELD_ALT;\
  94. type MPCC_SM_FORCE_NEXT_FRAME_POL;\
  95. type MPCC_SM_FORCE_NEXT_TOP_POL;\
  96. type MPC_OUT_MUX;
  97. struct dcn_mpc_registers {
  98. MPC_COMMON_REG_VARIABLE_LIST
  99. };
  100. struct dcn_mpc_shift {
  101. MPC_REG_FIELD_LIST(uint8_t)
  102. };
  103. struct dcn_mpc_mask {
  104. MPC_REG_FIELD_LIST(uint32_t)
  105. };
  106. struct dcn10_mpc {
  107. struct mpc base;
  108. int mpcc_in_use_mask;
  109. int num_mpcc;
  110. const struct dcn_mpc_registers *mpc_regs;
  111. const struct dcn_mpc_shift *mpc_shift;
  112. const struct dcn_mpc_mask *mpc_mask;
  113. };
  114. void dcn10_mpc_construct(struct dcn10_mpc *mpcc10,
  115. struct dc_context *ctx,
  116. const struct dcn_mpc_registers *mpc_regs,
  117. const struct dcn_mpc_shift *mpc_shift,
  118. const struct dcn_mpc_mask *mpc_mask,
  119. int num_mpcc);
  120. struct mpcc *mpc1_insert_plane(
  121. struct mpc *mpc,
  122. struct mpc_tree *tree,
  123. struct mpcc_blnd_cfg *blnd_cfg,
  124. struct mpcc_sm_cfg *sm_cfg,
  125. struct mpcc *insert_above_mpcc,
  126. int dpp_id,
  127. int mpcc_id);
  128. void mpc1_remove_mpcc(
  129. struct mpc *mpc,
  130. struct mpc_tree *tree,
  131. struct mpcc *mpcc);
  132. void mpc1_mpc_init(
  133. struct mpc *mpc);
  134. void mpc1_assert_idle_mpcc(
  135. struct mpc *mpc,
  136. int id);
  137. void mpc1_set_bg_color(
  138. struct mpc *mpc,
  139. struct tg_color *bg_color,
  140. int id);
  141. void mpc1_update_stereo_mix(
  142. struct mpc *mpc,
  143. struct mpcc_sm_cfg *sm_cfg,
  144. int mpcc_id);
  145. bool mpc1_is_mpcc_idle(
  146. struct mpc *mpc,
  147. int mpcc_id);
  148. void mpc1_assert_mpcc_idle_before_connect(
  149. struct mpc *mpc,
  150. int mpcc_id);
  151. void mpc1_init_mpcc_list_from_hw(
  152. struct mpc *mpc,
  153. struct mpc_tree *tree);
  154. struct mpcc *mpc1_get_mpcc(
  155. struct mpc *mpc,
  156. int mpcc_id);
  157. struct mpcc *mpc1_get_mpcc_for_dpp(
  158. struct mpc_tree *tree,
  159. int dpp_id);
  160. void mpc1_read_mpcc_state(
  161. struct mpc *mpc,
  162. int mpcc_inst,
  163. struct mpcc_state *s);
  164. #endif