mod_freesync.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. bool no_static_for_external_dp;
  79. };
  80. struct mod_freesync_params {
  81. enum mod_freesync_state state;
  82. bool enable;
  83. unsigned int update_duration_in_ns;
  84. bool windowed_fullscreen;
  85. };
  86. /*
  87. * Add stream to be tracked by module
  88. */
  89. bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
  90. const struct dc_stream *stream, struct mod_freesync_caps *caps);
  91. /*
  92. * Remove stream to be tracked by module
  93. */
  94. bool mod_freesync_remove_stream(struct mod_freesync *mod_freesync,
  95. const struct dc_stream *stream);
  96. /*
  97. * Update the freesync state flags for each display and program
  98. * freesync accordingly
  99. */
  100. void mod_freesync_update_state(struct mod_freesync *mod_freesync,
  101. const struct dc_stream **streams, int num_streams,
  102. struct mod_freesync_params *freesync_params);
  103. bool mod_freesync_get_state(struct mod_freesync *mod_freesync,
  104. const struct dc_stream *stream,
  105. struct mod_freesync_params *freesync_params);
  106. bool mod_freesync_set_user_enable(struct mod_freesync *mod_freesync,
  107. const struct dc_stream **streams, int num_streams,
  108. struct mod_freesync_user_enable *user_enable);
  109. bool mod_freesync_get_user_enable(struct mod_freesync *mod_freesync,
  110. const struct dc_stream *stream,
  111. struct mod_freesync_user_enable *user_enable);
  112. bool mod_freesync_get_static_ramp_active(struct mod_freesync *mod_freesync,
  113. const struct dc_stream *stream,
  114. bool *is_ramp_active);
  115. bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync,
  116. const struct dc_stream *streams,
  117. unsigned int min_refresh,
  118. unsigned int max_refresh,
  119. struct mod_freesync_caps *caps);
  120. bool mod_freesync_get_min_max(struct mod_freesync *mod_freesync,
  121. const struct dc_stream *stream,
  122. unsigned int *min_refresh,
  123. unsigned int *max_refresh);
  124. bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync,
  125. const struct dc_stream *stream,
  126. unsigned int *vmin,
  127. unsigned int *vmax);
  128. bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync,
  129. const struct dc_stream *stream,
  130. unsigned int *nom_v_pos,
  131. unsigned int *v_pos);
  132. void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
  133. const struct dc_stream **streams, int num_streams);
  134. void mod_freesync_notify_mode_change(struct mod_freesync *mod_freesync,
  135. const struct dc_stream **streams, int num_streams);
  136. void mod_freesync_pre_update_plane_addresses(struct mod_freesync *mod_freesync,
  137. const struct dc_stream **streams, int num_streams,
  138. unsigned int curr_time_stamp);
  139. #endif