Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Remove unused freesync functions

mod_freesync_get_vmin_vmax() and mod_freesync_get_v_position() were
added in 2017 by
commit 72ada5f76939 ("drm/amd/display: FreeSync Auto Sweep Support")

mod_freesync_is_valid_range() was added in 2018 by
commit e80e94460841 ("drm/amd/display: add method to check for supported
range")

mod_freesync_get_settings() was added in 2018 by
commit a3e1737ed61c ("drm/amd/display: Implement stats logging")

and
mod_freesync_calc_field_rate_from_timing() was added in 2020 by
commit 49c70ece54b0 ("drm/amd/display: Change input parameter for
set_drr")

None of these have been used.

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dr. David Alan Gilbert and committed by
Alex Deucher
2d5e8a89 3bd202b3

-163
-137
drivers/gpu/drm/amd/display/modules/freesync/freesync.c
··· 552 552 return false; 553 553 } 554 554 555 - bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync, 556 - const struct dc_stream_state *stream, 557 - unsigned int *vmin, 558 - unsigned int *vmax) 559 - { 560 - *vmin = stream->adjust.v_total_min; 561 - *vmax = stream->adjust.v_total_max; 562 - 563 - return true; 564 - } 565 - 566 - bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync, 567 - struct dc_stream_state *stream, 568 - unsigned int *nom_v_pos, 569 - unsigned int *v_pos) 570 - { 571 - struct core_freesync *core_freesync = NULL; 572 - struct crtc_position position; 573 - 574 - if (mod_freesync == NULL) 575 - return false; 576 - 577 - core_freesync = MOD_FREESYNC_TO_CORE(mod_freesync); 578 - 579 - if (dc_stream_get_crtc_position(core_freesync->dc, &stream, 1, 580 - &position.vertical_count, 581 - &position.nominal_vcount)) { 582 - 583 - *nom_v_pos = position.nominal_vcount; 584 - *v_pos = position.vertical_count; 585 - 586 - return true; 587 - } 588 - 589 - return false; 590 - } 591 - 592 555 static void build_vrr_infopacket_data_v1(const struct mod_vrr_params *vrr, 593 556 struct dc_info_packet *infopacket, 594 557 bool freesync_on_desktop) ··· 1254 1291 } 1255 1292 } 1256 1293 1257 - void mod_freesync_get_settings(struct mod_freesync *mod_freesync, 1258 - const struct mod_vrr_params *vrr, 1259 - unsigned int *v_total_min, unsigned int *v_total_max, 1260 - unsigned int *event_triggers, 1261 - unsigned int *window_min, unsigned int *window_max, 1262 - unsigned int *lfc_mid_point_in_us, 1263 - unsigned int *inserted_frames, 1264 - unsigned int *inserted_duration_in_us) 1265 - { 1266 - if (mod_freesync == NULL) 1267 - return; 1268 - 1269 - if (vrr->supported) { 1270 - *v_total_min = vrr->adjust.v_total_min; 1271 - *v_total_max = vrr->adjust.v_total_max; 1272 - *event_triggers = 0; 1273 - *lfc_mid_point_in_us = vrr->btr.mid_point_in_us; 1274 - *inserted_frames = vrr->btr.frames_to_insert; 1275 - *inserted_duration_in_us = vrr->btr.inserted_duration_in_us; 1276 - } 1277 - } 1278 - 1279 1294 unsigned long long mod_freesync_calc_nominal_field_rate( 1280 1295 const struct dc_stream_state *stream) 1281 1296 { ··· 1269 1328 return nominal_field_rate_in_uhz; 1270 1329 } 1271 1330 1272 - unsigned long long mod_freesync_calc_field_rate_from_timing( 1273 - unsigned int vtotal, unsigned int htotal, unsigned int pix_clk) 1274 - { 1275 - unsigned long long field_rate_in_uhz = 0; 1276 - unsigned int total = htotal * vtotal; 1277 - 1278 - /* Calculate nominal field rate for stream, rounded up to nearest integer */ 1279 - field_rate_in_uhz = pix_clk; 1280 - field_rate_in_uhz *= 1000000ULL; 1281 - 1282 - field_rate_in_uhz = div_u64(field_rate_in_uhz, total); 1283 - 1284 - return field_rate_in_uhz; 1285 - } 1286 - 1287 1331 bool mod_freesync_get_freesync_enabled(struct mod_vrr_params *pVrr) 1288 1332 { 1289 1333 return (pVrr->state != VRR_STATE_UNSUPPORTED) && (pVrr->state != VRR_STATE_DISABLED); 1290 - } 1291 - 1292 - bool mod_freesync_is_valid_range(uint32_t min_refresh_cap_in_uhz, 1293 - uint32_t max_refresh_cap_in_uhz, 1294 - uint32_t nominal_field_rate_in_uhz) 1295 - { 1296 - 1297 - /* Typically nominal refresh calculated can have some fractional part. 1298 - * Allow for some rounding error of actual video timing by taking floor 1299 - * of caps and request. Round the nominal refresh rate. 1300 - * 1301 - * Dividing will convert everything to units in Hz although input 1302 - * variable name is in uHz! 1303 - * 1304 - * Also note, this takes care of rounding error on the nominal refresh 1305 - * so by rounding error we only expect it to be off by a small amount, 1306 - * such as < 0.1 Hz. i.e. 143.9xxx or 144.1xxx. 1307 - * 1308 - * Example 1. Caps Min = 40 Hz, Max = 144 Hz 1309 - * Request Min = 40 Hz, Max = 144 Hz 1310 - * Nominal = 143.5x Hz rounded to 144 Hz 1311 - * This function should allow this as valid request 1312 - * 1313 - * Example 2. Caps Min = 40 Hz, Max = 144 Hz 1314 - * Request Min = 40 Hz, Max = 144 Hz 1315 - * Nominal = 144.4x Hz rounded to 144 Hz 1316 - * This function should allow this as valid request 1317 - * 1318 - * Example 3. Caps Min = 40 Hz, Max = 144 Hz 1319 - * Request Min = 40 Hz, Max = 144 Hz 1320 - * Nominal = 120.xx Hz rounded to 120 Hz 1321 - * This function should return NOT valid since the requested 1322 - * max is greater than current timing's nominal 1323 - * 1324 - * Example 4. Caps Min = 40 Hz, Max = 120 Hz 1325 - * Request Min = 40 Hz, Max = 120 Hz 1326 - * Nominal = 144.xx Hz rounded to 144 Hz 1327 - * This function should return NOT valid since the nominal 1328 - * is greater than the capability's max refresh 1329 - */ 1330 - nominal_field_rate_in_uhz = 1331 - div_u64(nominal_field_rate_in_uhz + 500000, 1000000); 1332 - min_refresh_cap_in_uhz /= 1000000; 1333 - max_refresh_cap_in_uhz /= 1000000; 1334 - 1335 - /* Check nominal is within range */ 1336 - if (nominal_field_rate_in_uhz > max_refresh_cap_in_uhz || 1337 - nominal_field_rate_in_uhz < min_refresh_cap_in_uhz) 1338 - return false; 1339 - 1340 - /* If nominal is less than max, limit the max allowed refresh rate */ 1341 - if (nominal_field_rate_in_uhz < max_refresh_cap_in_uhz) 1342 - max_refresh_cap_in_uhz = nominal_field_rate_in_uhz; 1343 - 1344 - /* Check min is within range */ 1345 - if (min_refresh_cap_in_uhz > max_refresh_cap_in_uhz) 1346 - return false; 1347 - 1348 - /* For variable range, check for at least 10 Hz range */ 1349 - if (nominal_field_rate_in_uhz - min_refresh_cap_in_uhz < 10) 1350 - return false; 1351 - 1352 - return true; 1353 1334 }
-26
drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h
··· 110 110 struct mod_freesync *mod_freesync_create(struct dc *dc); 111 111 void mod_freesync_destroy(struct mod_freesync *mod_freesync); 112 112 113 - bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync, 114 - const struct dc_stream_state *stream, 115 - unsigned int *vmin, 116 - unsigned int *vmax); 117 - 118 - bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync, 119 - struct dc_stream_state *stream, 120 - unsigned int *nom_v_pos, 121 - unsigned int *v_pos); 122 - 123 - void mod_freesync_get_settings(struct mod_freesync *mod_freesync, 124 - const struct mod_vrr_params *vrr, 125 - unsigned int *v_total_min, unsigned int *v_total_max, 126 - unsigned int *event_triggers, 127 - unsigned int *window_min, unsigned int *window_max, 128 - unsigned int *lfc_mid_point_in_us, 129 - unsigned int *inserted_frames, 130 - unsigned int *inserted_duration_in_us); 131 - 132 113 void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync, 133 114 const struct dc_stream_state *stream, 134 115 const struct mod_vrr_params *vrr, ··· 135 154 136 155 unsigned long long mod_freesync_calc_nominal_field_rate( 137 156 const struct dc_stream_state *stream); 138 - 139 - unsigned long long mod_freesync_calc_field_rate_from_timing( 140 - unsigned int vtotal, unsigned int htotal, unsigned int pix_clk); 141 - 142 - bool mod_freesync_is_valid_range(uint32_t min_refresh_cap_in_uhz, 143 - uint32_t max_refresh_cap_in_uhz, 144 - uint32_t nominal_field_rate_in_uhz); 145 157 146 158 unsigned int mod_freesync_calc_v_total_from_refresh( 147 159 const struct dc_stream_state *stream,