Skip to content

Commit dd4b2ff

Browse files
vsyrjalalutzbichler
authored andcommitted
drm/i915/vrr: Fix vmin/vmax/flipline on TGL when using vblank delay
Turns out that TGL needs its vmin/vmax/flipline adjusted based on the vblank delay, otherwise the hardware pushes the vtotals further out. Make it so. Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Ankit Nautiyal <[email protected]>
1 parent 90aa288 commit dd4b2ff

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

drivers/gpu/drm/i915/display/intel_vrr.c

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,30 +117,41 @@ static int intel_vrr_vblank_exit_length(const struct intel_crtc_state *crtc_stat
117117
if (DISPLAY_VER(display) >= 13)
118118
return crtc_state->vrr.guardband;
119119
else
120-
/* The hw imposes the extra scanline before frame start */
120+
/* hardware imposes one extra scanline somewhere */
121121
return crtc_state->vrr.pipeline_full + crtc_state->framestart_delay + 1;
122122
}
123123

124124
int intel_vrr_vmin_vtotal(const struct intel_crtc_state *crtc_state)
125125
{
126+
struct intel_display *display = to_intel_display(crtc_state);
127+
126128
/* Min vblank actually determined by flipline */
127-
return intel_vrr_vmin_flipline(crtc_state);
129+
if (DISPLAY_VER(display) >= 13)
130+
return intel_vrr_vmin_flipline(crtc_state);
131+
else
132+
return intel_vrr_vmin_flipline(crtc_state) +
133+
intel_vrr_vblank_delay(crtc_state);
128134
}
129135

130136
int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state)
131137
{
132-
return crtc_state->vrr.vmax;
138+
struct intel_display *display = to_intel_display(crtc_state);
139+
140+
if (DISPLAY_VER(display) >= 13)
141+
return crtc_state->vrr.vmax;
142+
else
143+
return crtc_state->vrr.vmax +
144+
intel_vrr_vblank_delay(crtc_state);
133145
}
134146

135147
int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state)
136148
{
137-
/* Min vblank actually determined by flipline */
138-
return intel_vrr_vmin_flipline(crtc_state) - intel_vrr_vblank_exit_length(crtc_state);
149+
return intel_vrr_vmin_vtotal(crtc_state) - intel_vrr_vblank_exit_length(crtc_state);
139150
}
140151

141152
int intel_vrr_vmax_vblank_start(const struct intel_crtc_state *crtc_state)
142153
{
143-
return crtc_state->vrr.vmax - intel_vrr_vblank_exit_length(crtc_state);
154+
return intel_vrr_vmax_vtotal(crtc_state) - intel_vrr_vblank_exit_length(crtc_state);
144155
}
145156

146157
static bool
@@ -289,9 +300,18 @@ void intel_vrr_compute_config_late(struct intel_crtc_state *crtc_state)
289300
crtc_state->vrr.guardband =
290301
crtc_state->vrr.vmin - adjusted_mode->crtc_vblank_start;
291302
} else {
303+
/* hardware imposes one extra scanline somewhere */
292304
crtc_state->vrr.pipeline_full =
293305
min(255, crtc_state->vrr.vmin - adjusted_mode->crtc_vblank_start -
294306
crtc_state->framestart_delay - 1);
307+
308+
/*
309+
* vmin/vmax/flipline also need to be adjusted by
310+
* the vblank delay to maintain correct vtotals.
311+
*/
312+
crtc_state->vrr.vmin -= intel_vrr_vblank_delay(crtc_state);
313+
crtc_state->vrr.vmax -= intel_vrr_vblank_delay(crtc_state);
314+
crtc_state->vrr.flipline -= intel_vrr_vblank_delay(crtc_state);
295315
}
296316
}
297317

0 commit comments

Comments
 (0)