Message ID | 20190418035122.15791-3-mario.kleiner.de@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/4] drm/amd/display: Add some debug output for VRR BTR. | expand |
On 4/17/19 11:51 PM, Mario Kleiner wrote: > The comparison of inserted_frame_duration_in_us against a > duration calculated from max_refresh_in_uhz is both wrong > in its math and not needed, as the min_duration_in_us value > is already cached in in_out_vrr for reuse. No need to > recalculate it wrongly at each invocation. > > Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Looks reasonable to me. > --- > drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c > index 71274683da04..e56543c36eba 100644 > --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c > +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c > @@ -437,10 +437,8 @@ static void apply_below_the_range(struct core_freesync *core_freesync, > inserted_frame_duration_in_us = last_render_time_in_us / > frames_to_insert; > > - if (inserted_frame_duration_in_us < > - (1000000 / in_out_vrr->max_refresh_in_uhz)) > - inserted_frame_duration_in_us = > - (1000000 / in_out_vrr->max_refresh_in_uhz); > + if (inserted_frame_duration_in_us < in_out_vrr->min_duration_in_us) > + inserted_frame_duration_in_us = in_out_vrr->min_duration_in_us; > > /* Cache the calculated variables */ > in_out_vrr->btr.inserted_duration_in_us = >
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c index 71274683da04..e56543c36eba 100644 --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c @@ -437,10 +437,8 @@ static void apply_below_the_range(struct core_freesync *core_freesync, inserted_frame_duration_in_us = last_render_time_in_us / frames_to_insert; - if (inserted_frame_duration_in_us < - (1000000 / in_out_vrr->max_refresh_in_uhz)) - inserted_frame_duration_in_us = - (1000000 / in_out_vrr->max_refresh_in_uhz); + if (inserted_frame_duration_in_us < in_out_vrr->min_duration_in_us) + inserted_frame_duration_in_us = in_out_vrr->min_duration_in_us; /* Cache the calculated variables */ in_out_vrr->btr.inserted_duration_in_us =
The comparison of inserted_frame_duration_in_us against a duration calculated from max_refresh_in_uhz is both wrong in its math and not needed, as the min_duration_in_us value is already cached in in_out_vrr for reuse. No need to recalculate it wrongly at each invocation. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> --- drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)