Commit 1caea6e945e0867d391369097937620c945dcec1
Committed by
Daniel Vetter
1 parent
efc2cfff28
Exists in
master
and in
13 other branches
drm/i915: Make sure vsyncshift is positive
If vsyncshift comes out as negative, add one htotal to it to get the corresponding positive value. This is rather theoretical as it would require a mode where the hsync+back porch is very long and the active+front porch very short. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff
drivers/gpu/drm/i915/intel_display.c
... | ... | @@ -5369,7 +5369,8 @@ |
5369 | 5369 | enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder; |
5370 | 5370 | struct drm_display_mode *adjusted_mode = |
5371 | 5371 | &intel_crtc->config.adjusted_mode; |
5372 | - uint32_t vsyncshift = 0, crtc_vtotal, crtc_vblank_end; | |
5372 | + uint32_t crtc_vtotal, crtc_vblank_end; | |
5373 | + int vsyncshift = 0; | |
5373 | 5374 | |
5374 | 5375 | /* We need to be careful not to changed the adjusted mode, for otherwise |
5375 | 5376 | * the hw state checker will get angry at the mismatch. */ |
... | ... | @@ -5386,6 +5387,8 @@ |
5386 | 5387 | else |
5387 | 5388 | vsyncshift = adjusted_mode->crtc_hsync_start - |
5388 | 5389 | adjusted_mode->crtc_htotal / 2; |
5390 | + if (vsyncshift < 0) | |
5391 | + vsyncshift += adjusted_mode->crtc_htotal; | |
5389 | 5392 | } |
5390 | 5393 | |
5391 | 5394 | if (INTEL_INFO(dev)->gen > 3) |