Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | /* * Copyright 2016 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD * */ /* * Copyright 2016 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD * */ #ifndef MOD_FREESYNC_H_ #define MOD_FREESYNC_H_ #include "mod_shared.h" // Access structures struct mod_freesync { int dummy; }; // TODO: References to this should be removed struct mod_freesync_caps { bool supported; unsigned int min_refresh_in_micro_hz; unsigned int max_refresh_in_micro_hz; }; enum mod_vrr_state { VRR_STATE_UNSUPPORTED = 0, VRR_STATE_DISABLED, VRR_STATE_INACTIVE, VRR_STATE_ACTIVE_VARIABLE, VRR_STATE_ACTIVE_FIXED }; struct mod_freesync_config { enum mod_vrr_state state; bool vsif_supported; bool ramping; bool btr; unsigned int min_refresh_in_uhz; unsigned int max_refresh_in_uhz; unsigned int fixed_refresh_in_uhz; }; struct mod_vrr_params_btr { bool btr_enabled; bool btr_active; uint32_t mid_point_in_us; uint32_t inserted_duration_in_us; uint32_t frames_to_insert; uint32_t frame_counter; uint32_t margin_in_us; }; struct mod_vrr_params_fixed_refresh { bool fixed_active; bool ramping_active; bool ramping_done; uint32_t target_refresh_in_uhz; uint32_t frame_counter; }; struct mod_vrr_params_flip_interval { bool flip_interval_workaround_active; bool program_flip_interval_workaround; bool do_flip_interval_workaround_cleanup; uint32_t flip_interval_detect_counter; uint32_t vsyncs_between_flip; uint32_t vsync_to_flip_in_us; uint32_t v_update_timestamp_in_us; }; struct mod_vrr_params { bool supported; bool send_info_frame; enum mod_vrr_state state; uint32_t min_refresh_in_uhz; uint32_t max_duration_in_us; uint32_t max_refresh_in_uhz; uint32_t min_duration_in_us; uint32_t fixed_refresh_in_uhz; struct dc_crtc_timing_adjust adjust; struct mod_vrr_params_fixed_refresh fixed; struct mod_vrr_params_btr btr; struct mod_vrr_params_flip_interval flip_interval; }; struct mod_freesync *mod_freesync_create(struct dc *dc); void mod_freesync_destroy(struct mod_freesync *mod_freesync); bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync, const struct dc_stream_state *stream, unsigned int *vmin, unsigned int *vmax); bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync, struct dc_stream_state *stream, unsigned int *nom_v_pos, unsigned int *v_pos); void mod_freesync_get_settings(struct mod_freesync *mod_freesync, const struct mod_vrr_params *vrr, unsigned int *v_total_min, unsigned int *v_total_max, unsigned int *event_triggers, unsigned int *window_min, unsigned int *window_max, unsigned int *lfc_mid_point_in_us, unsigned int *inserted_frames, unsigned int *inserted_duration_in_us); void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync, const struct dc_stream_state *stream, const struct mod_vrr_params *vrr, enum vrr_packet_type packet_type, enum color_transfer_func app_tf, struct dc_info_packet *infopacket, bool pack_sdp_v1_3); void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, const struct dc_stream_state *stream, struct mod_freesync_config *in_config, struct mod_vrr_params *in_out_vrr); void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync, const struct dc_plane_state *plane, const struct dc_stream_state *stream, unsigned int curr_time_stamp_in_us, struct mod_vrr_params *in_out_vrr); void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync, const struct dc_stream_state *stream, struct mod_vrr_params *in_out_vrr); unsigned long long mod_freesync_calc_nominal_field_rate( const struct dc_stream_state *stream); unsigned long long mod_freesync_calc_field_rate_from_timing( unsigned int vtotal, unsigned int htotal, unsigned int pix_clk); bool mod_freesync_is_valid_range(uint32_t min_refresh_cap_in_uhz, uint32_t max_refresh_cap_in_uhz, uint32_t nominal_field_rate_in_uhz); unsigned int mod_freesync_calc_v_total_from_refresh( const struct dc_stream_state *stream, unsigned int refresh_in_uhz); // Returns true when FreeSync is supported and enabled (even if it is inactive) bool mod_freesync_get_freesync_enabled(struct mod_vrr_params *pVrr); #endif |