mod_freesync.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * Copyright 2016 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. /*
  26. * Copyright 2016 Advanced Micro Devices, Inc.
  27. *
  28. * Permission is hereby granted, free of charge, to any person obtaining a
  29. * copy of this software and associated documentation files (the "Software"),
  30. * to deal in the Software without restriction, including without limitation
  31. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  32. * and/or sell copies of the Software, and to permit persons to whom the
  33. * Software is furnished to do so, subject to the following conditions:
  34. *
  35. * The above copyright notice and this permission notice shall be included in
  36. * all copies or substantial portions of the Software.
  37. *
  38. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  41. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  42. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  43. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  44. * OTHER DEALINGS IN THE SOFTWARE.
  45. *
  46. * Authors: AMD
  47. *
  48. */
  49. #ifndef MOD_FREESYNC_H_
  50. #define MOD_FREESYNC_H_
  51. #include "dm_services.h"
  52. struct mod_freesync *mod_freesync_create(struct dc *dc);
  53. void mod_freesync_destroy(struct mod_freesync *mod_freesync);
  54. struct mod_freesync {
  55. int dummy;
  56. };
  57. enum mod_freesync_state {
  58. FREESYNC_STATE_NONE,
  59. FREESYNC_STATE_FULLSCREEN,
  60. FREESYNC_STATE_STATIC_SCREEN,
  61. FREESYNC_STATE_VIDEO
  62. };
  63. enum mod_freesync_user_enable_mask {
  64. FREESYNC_USER_ENABLE_STATIC = 0x1,
  65. FREESYNC_USER_ENABLE_VIDEO = 0x2,
  66. FREESYNC_USER_ENABLE_GAMING = 0x4
  67. };
  68. struct mod_freesync_user_enable {
  69. bool enable_for_static;
  70. bool enable_for_video;
  71. bool enable_for_gaming;
  72. };
  73. struct mod_freesync_caps {
  74. bool supported;
  75. unsigned int min_refresh_in_micro_hz;
  76. unsigned int max_refresh_in_micro_hz;
  77. bool btr_supported;
  78. };
  79. struct mod_freesync_params {
  80. enum mod_freesync_state state;
  81. bool enable;
  82. unsigned int update_duration_in_ns;
  83. bool windowed_fullscreen;
  84. };
  85. /*
  86. * Add stream to be tracked by module
  87. */
  88. bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
  89. struct dc_stream_state *stream, struct mod_freesync_caps *caps);
  90. /*
  91. * Remove stream to be tracked by module
  92. */
  93. bool mod_freesync_remove_stream(struct mod_freesync *mod_freesync,
  94. struct dc_stream_state *stream);
  95. /*
  96. * Update the freesync state flags for each display and program
  97. * freesync accordingly
  98. */
  99. void mod_freesync_update_state(struct mod_freesync *mod_freesync,
  100. struct dc_stream_state **streams, int num_streams,
  101. struct mod_freesync_params *freesync_params);
  102. bool mod_freesync_get_state(struct mod_freesync *mod_freesync,
  103. struct dc_stream_state *stream,
  104. struct mod_freesync_params *freesync_params);
  105. bool mod_freesync_set_user_enable(struct mod_freesync *mod_freesync,
  106. struct dc_stream_state **streams, int num_streams,
  107. struct mod_freesync_user_enable *user_enable);
  108. bool mod_freesync_get_user_enable(struct mod_freesync *mod_freesync,
  109. struct dc_stream_state *stream,
  110. struct mod_freesync_user_enable *user_enable);
  111. bool mod_freesync_get_static_ramp_active(struct mod_freesync *mod_freesync,
  112. struct dc_stream_state *stream,
  113. bool *is_ramp_active);
  114. bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync,
  115. struct dc_stream_state *streams,
  116. unsigned int min_refresh,
  117. unsigned int max_refresh,
  118. struct mod_freesync_caps *caps);
  119. bool mod_freesync_get_min_max(struct mod_freesync *mod_freesync,
  120. struct dc_stream_state *stream,
  121. unsigned int *min_refresh,
  122. unsigned int *max_refresh);
  123. bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync,
  124. struct dc_stream_state *stream,
  125. unsigned int *vmin,
  126. unsigned int *vmax);
  127. bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync,
  128. struct dc_stream_state *stream,
  129. unsigned int *nom_v_pos,
  130. unsigned int *v_pos);
  131. void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
  132. struct dc_stream_state **streams, int num_streams);
  133. void mod_freesync_notify_mode_change(struct mod_freesync *mod_freesync,
  134. struct dc_stream_state **streams, int num_streams);
  135. void mod_freesync_pre_update_plane_addresses(struct mod_freesync *mod_freesync,
  136. struct dc_stream_state **streams, int num_streams,
  137. unsigned int curr_time_stamp);
  138. void mod_freesync_get_settings(struct mod_freesync *mod_freesync,
  139. struct dc_stream_state **streams, int num_streams,
  140. unsigned int *v_total_min, unsigned int *v_total_max,
  141. unsigned int *event_triggers,
  142. unsigned int *window_min, unsigned int *window_max,
  143. unsigned int *lfc_mid_point_in_us,
  144. unsigned int *inserted_frames,
  145. unsigned int *inserted_duration_in_us);
  146. #endif