hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
....@@ -327,7 +327,9 @@
327327 * - Delta for CEIL: delta_from_mid_point_in_us_1
328328 * - Delta for FLOOR: delta_from_mid_point_in_us_2
329329 */
330
- if ((last_render_time_in_us / mid_point_frames_ceil) < in_out_vrr->min_duration_in_us) {
330
+ if (mid_point_frames_ceil &&
331
+ (last_render_time_in_us / mid_point_frames_ceil) <
332
+ in_out_vrr->min_duration_in_us) {
331333 /* Check for out of range.
332334 * If using CEIL produces a value that is out of range,
333335 * then we are forced to use FLOOR.
....@@ -374,8 +376,9 @@
374376 /* Either we've calculated the number of frames to insert,
375377 * or we need to insert min duration frames
376378 */
377
- if (last_render_time_in_us / frames_to_insert <
378
- in_out_vrr->min_duration_in_us){
379
+ if (frames_to_insert &&
380
+ (last_render_time_in_us / frames_to_insert) <
381
+ in_out_vrr->min_duration_in_us){
379382 frames_to_insert -= (frames_to_insert > 1) ?
380383 1 : 0;
381384 }