hw_sequencer.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /*
  2. * Copyright 2015 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. #ifndef __DC_HW_SEQUENCER_H__
  26. #define __DC_HW_SEQUENCER_H__
  27. #include "dc_types.h"
  28. #include "clock_source.h"
  29. #include "inc/hw/timing_generator.h"
  30. #include "inc/hw/opp.h"
  31. #include "inc/hw/link_encoder.h"
  32. #include "core_status.h"
  33. #define EDP_BACKLIGHT_RAMP_DISABLE_LEVEL 0xFFFFFFFF
  34. enum pipe_gating_control {
  35. PIPE_GATING_CONTROL_DISABLE = 0,
  36. PIPE_GATING_CONTROL_ENABLE,
  37. PIPE_GATING_CONTROL_INIT
  38. };
  39. struct dce_hwseq_wa {
  40. bool blnd_crtc_trigger;
  41. bool DEGVIDCN10_253;
  42. bool false_optc_underflow;
  43. bool DEGVIDCN10_254;
  44. };
  45. struct hwseq_wa_state {
  46. bool DEGVIDCN10_253_applied;
  47. };
  48. struct dce_hwseq {
  49. struct dc_context *ctx;
  50. const struct dce_hwseq_registers *regs;
  51. const struct dce_hwseq_shift *shifts;
  52. const struct dce_hwseq_mask *masks;
  53. struct dce_hwseq_wa wa;
  54. struct hwseq_wa_state wa_state;
  55. };
  56. struct pipe_ctx;
  57. struct dc_state;
  58. struct dchub_init_data;
  59. struct dc_static_screen_events;
  60. struct resource_pool;
  61. struct resource_context;
  62. struct stream_resource;
  63. struct hw_sequencer_funcs {
  64. void (*init_hw)(struct dc *dc);
  65. enum dc_status (*apply_ctx_to_hw)(
  66. struct dc *dc, struct dc_state *context);
  67. void (*reset_hw_ctx_wrap)(
  68. struct dc *dc, struct dc_state *context);
  69. void (*apply_ctx_for_surface)(
  70. struct dc *dc,
  71. const struct dc_stream_state *stream,
  72. int num_planes,
  73. struct dc_state *context);
  74. void (*program_gamut_remap)(
  75. struct pipe_ctx *pipe_ctx);
  76. void (*program_csc_matrix)(
  77. struct pipe_ctx *pipe_ctx,
  78. enum dc_color_space colorspace,
  79. uint16_t *matrix);
  80. void (*program_output_csc)(struct dc *dc,
  81. struct pipe_ctx *pipe_ctx,
  82. enum dc_color_space colorspace,
  83. uint16_t *matrix,
  84. int opp_id);
  85. void (*update_plane_addr)(
  86. const struct dc *dc,
  87. struct pipe_ctx *pipe_ctx);
  88. void (*plane_atomic_disconnect)(
  89. struct dc *dc,
  90. struct pipe_ctx *pipe_ctx);
  91. void (*update_dchub)(
  92. struct dce_hwseq *hws,
  93. struct dchub_init_data *dh_data);
  94. void (*update_mpcc)(
  95. struct dc *dc,
  96. struct pipe_ctx *pipe_ctx);
  97. void (*update_pending_status)(
  98. struct pipe_ctx *pipe_ctx);
  99. bool (*set_input_transfer_func)(
  100. struct pipe_ctx *pipe_ctx,
  101. const struct dc_plane_state *plane_state);
  102. bool (*set_output_transfer_func)(
  103. struct pipe_ctx *pipe_ctx,
  104. const struct dc_stream_state *stream);
  105. void (*power_down)(struct dc *dc);
  106. void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context);
  107. void (*enable_timing_synchronization)(
  108. struct dc *dc,
  109. int group_index,
  110. int group_size,
  111. struct pipe_ctx *grouped_pipes[]);
  112. void (*enable_per_frame_crtc_position_reset)(
  113. struct dc *dc,
  114. int group_size,
  115. struct pipe_ctx *grouped_pipes[]);
  116. void (*enable_display_pipe_clock_gating)(
  117. struct dc_context *ctx,
  118. bool clock_gating);
  119. bool (*enable_display_power_gating)(
  120. struct dc *dc,
  121. uint8_t controller_id,
  122. struct dc_bios *dcb,
  123. enum pipe_gating_control power_gating);
  124. void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx);
  125. void (*update_info_frame)(struct pipe_ctx *pipe_ctx);
  126. void (*enable_stream)(struct pipe_ctx *pipe_ctx);
  127. void (*disable_stream)(struct pipe_ctx *pipe_ctx,
  128. int option);
  129. void (*unblank_stream)(struct pipe_ctx *pipe_ctx,
  130. struct dc_link_settings *link_settings);
  131. void (*blank_stream)(struct pipe_ctx *pipe_ctx);
  132. void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx);
  133. void (*disable_audio_stream)(struct pipe_ctx *pipe_ctx, int option);
  134. void (*pipe_control_lock)(
  135. struct dc *dc,
  136. struct pipe_ctx *pipe,
  137. bool lock);
  138. void (*blank_pixel_data)(
  139. struct dc *dc,
  140. struct pipe_ctx *pipe_ctx,
  141. bool blank);
  142. void (*set_bandwidth)(
  143. struct dc *dc,
  144. struct dc_state *context,
  145. bool safe_to_lower);
  146. void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
  147. int vmin, int vmax);
  148. void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
  149. struct crtc_position *position);
  150. void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
  151. int num_pipes, const struct dc_static_screen_events *events);
  152. enum dc_status (*enable_stream_timing)(
  153. struct pipe_ctx *pipe_ctx,
  154. struct dc_state *context,
  155. struct dc *dc);
  156. void (*setup_stereo)(
  157. struct pipe_ctx *pipe_ctx,
  158. struct dc *dc);
  159. void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
  160. void (*log_hw_state)(struct dc *dc,
  161. struct dc_log_buffer_ctx *log_ctx);
  162. void (*get_hw_state)(struct dc *dc, char *pBuf, unsigned int bufSize, unsigned int mask);
  163. void (*wait_for_mpcc_disconnect)(struct dc *dc,
  164. struct resource_pool *res_pool,
  165. struct pipe_ctx *pipe_ctx);
  166. void (*ready_shared_resources)(struct dc *dc, struct dc_state *context);
  167. void (*optimize_shared_resources)(struct dc *dc);
  168. void (*pplib_apply_display_requirements)(
  169. struct dc *dc,
  170. struct dc_state *context);
  171. void (*edp_power_control)(
  172. struct dc_link *link,
  173. bool enable);
  174. void (*edp_backlight_control)(
  175. struct dc_link *link,
  176. bool enable);
  177. void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up);
  178. void (*set_cursor_position)(struct pipe_ctx *pipe);
  179. void (*set_cursor_attribute)(struct pipe_ctx *pipe);
  180. void (*set_cursor_sdr_white_level)(struct pipe_ctx *pipe);
  181. };
  182. void color_space_to_black_color(
  183. const struct dc *dc,
  184. enum dc_color_space colorspace,
  185. struct tg_color *black_color);
  186. bool hwss_wait_for_blank_complete(
  187. struct timing_generator *tg);
  188. const uint16_t *find_color_matrix(
  189. enum dc_color_space color_space,
  190. uint32_t *array_size);
  191. #endif /* __DC_HW_SEQUENCER_H__ */