hw_sequencer.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. };
  44. struct hwseq_wa_state {
  45. bool DEGVIDCN10_253_applied;
  46. };
  47. struct dce_hwseq {
  48. struct dc_context *ctx;
  49. const struct dce_hwseq_registers *regs;
  50. const struct dce_hwseq_shift *shifts;
  51. const struct dce_hwseq_mask *masks;
  52. struct dce_hwseq_wa wa;
  53. struct hwseq_wa_state wa_state;
  54. };
  55. struct pipe_ctx;
  56. struct dc_state;
  57. struct dchub_init_data;
  58. struct dc_static_screen_events;
  59. struct resource_pool;
  60. struct resource_context;
  61. struct stream_resource;
  62. struct hw_sequencer_funcs {
  63. void (*init_hw)(struct dc *dc);
  64. enum dc_status (*apply_ctx_to_hw)(
  65. struct dc *dc, struct dc_state *context);
  66. void (*reset_hw_ctx_wrap)(
  67. struct dc *dc, struct dc_state *context);
  68. void (*apply_ctx_for_surface)(
  69. struct dc *dc,
  70. const struct dc_stream_state *stream,
  71. int num_planes,
  72. struct dc_state *context);
  73. void (*program_gamut_remap)(
  74. struct pipe_ctx *pipe_ctx);
  75. void (*program_csc_matrix)(
  76. struct pipe_ctx *pipe_ctx,
  77. enum dc_color_space colorspace,
  78. uint16_t *matrix);
  79. void (*program_output_csc)(struct dc *dc,
  80. struct pipe_ctx *pipe_ctx,
  81. enum dc_color_space colorspace,
  82. uint16_t *matrix,
  83. int opp_id);
  84. void (*update_plane_addr)(
  85. const struct dc *dc,
  86. struct pipe_ctx *pipe_ctx);
  87. void (*update_dchub)(
  88. struct dce_hwseq *hws,
  89. struct dchub_init_data *dh_data);
  90. void (*update_pending_status)(
  91. struct pipe_ctx *pipe_ctx);
  92. bool (*set_input_transfer_func)(
  93. struct pipe_ctx *pipe_ctx,
  94. const struct dc_plane_state *plane_state);
  95. bool (*set_output_transfer_func)(
  96. struct pipe_ctx *pipe_ctx,
  97. const struct dc_stream_state *stream);
  98. void (*power_down)(struct dc *dc);
  99. void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context);
  100. void (*enable_timing_synchronization)(
  101. struct dc *dc,
  102. int group_index,
  103. int group_size,
  104. struct pipe_ctx *grouped_pipes[]);
  105. void (*enable_per_frame_crtc_position_reset)(
  106. struct dc *dc,
  107. int group_size,
  108. struct pipe_ctx *grouped_pipes[]);
  109. void (*enable_display_pipe_clock_gating)(
  110. struct dc_context *ctx,
  111. bool clock_gating);
  112. bool (*enable_display_power_gating)(
  113. struct dc *dc,
  114. uint8_t controller_id,
  115. struct dc_bios *dcb,
  116. enum pipe_gating_control power_gating);
  117. void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx);
  118. void (*update_info_frame)(struct pipe_ctx *pipe_ctx);
  119. void (*enable_stream)(struct pipe_ctx *pipe_ctx);
  120. void (*disable_stream)(struct pipe_ctx *pipe_ctx,
  121. int option);
  122. void (*unblank_stream)(struct pipe_ctx *pipe_ctx,
  123. struct dc_link_settings *link_settings);
  124. void (*blank_stream)(struct pipe_ctx *pipe_ctx);
  125. void (*pipe_control_lock)(
  126. struct dc *dc,
  127. struct pipe_ctx *pipe,
  128. bool lock);
  129. void (*blank_pixel_data)(
  130. struct dc *dc,
  131. struct stream_resource *stream_res,
  132. struct dc_stream_state *stream,
  133. bool blank);
  134. void (*set_bandwidth)(
  135. struct dc *dc,
  136. struct dc_state *context,
  137. bool decrease_allowed);
  138. void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
  139. int vmin, int vmax);
  140. void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
  141. struct crtc_position *position);
  142. void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
  143. int num_pipes, const struct dc_static_screen_events *events);
  144. enum dc_status (*enable_stream_timing)(
  145. struct pipe_ctx *pipe_ctx,
  146. struct dc_state *context,
  147. struct dc *dc);
  148. void (*setup_stereo)(
  149. struct pipe_ctx *pipe_ctx,
  150. struct dc *dc);
  151. void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
  152. void (*log_hw_state)(struct dc *dc);
  153. void (*wait_for_mpcc_disconnect)(struct dc *dc,
  154. struct resource_pool *res_pool,
  155. struct pipe_ctx *pipe_ctx);
  156. void (*ready_shared_resources)(struct dc *dc, struct dc_state *context);
  157. void (*optimize_shared_resources)(struct dc *dc);
  158. void (*pplib_apply_display_requirements)(
  159. struct dc *dc,
  160. struct dc_state *context);
  161. void (*edp_power_control)(
  162. struct dc_link *link,
  163. bool enable);
  164. void (*edp_backlight_control)(
  165. struct dc_link *link,
  166. bool enable);
  167. void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up);
  168. void (*set_cursor_position)(struct pipe_ctx *pipe);
  169. void (*set_cursor_attribute)(struct pipe_ctx *pipe);
  170. };
  171. void color_space_to_black_color(
  172. const struct dc *dc,
  173. enum dc_color_space colorspace,
  174. struct tg_color *black_color);
  175. bool hwss_wait_for_blank_complete(
  176. struct timing_generator *tg);
  177. const uint16_t *find_color_matrix(
  178. enum dc_color_space color_space,
  179. uint32_t *array_size);
  180. #endif /* __DC_HW_SEQUENCER_H__ */