summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-04-29 13:35:49 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-05-22 15:06:35 +0200
commit7e78f1cb387e4b6fe2c33adcc987b114516a093f (patch)
tree93ac747a8b2e3fd1e3a1a69ef8fd0173e1aac583
parentf7ef3fa77fa85b3a8a15b464efd56d0314a3231c (diff)
downloadop-kernel-dev-7e78f1cb387e4b6fe2c33adcc987b114516a093f.zip
op-kernel-dev-7e78f1cb387e4b6fe2c33adcc987b114516a093f.tar.gz
drm/i915: Add a small adjustment to the pixel counter on interlaced modes
In interlaced modes, the pixel counter counts all pixels, so one field will have htotal more pixels. In order to avoid the reported position from jumping backwards when the pixel counter is beyond the length of the shorter field, just clamp the position the length of the shorter field. This matches how the scanline counter based position works since the scanline counter doesn't count the two half lines. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: "Akash Goel <akash.goels@gmail.com>" Reviewed-by: "Sourab Gupta <sourabgupta@gmail.com>" Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 2043276..cfa4d36 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -915,6 +915,18 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
vtotal *= htotal;
/*
+ * In interlaced modes, the pixel counter counts all pixels,
+ * so one field will have htotal more pixels. In order to avoid
+ * the reported position from jumping backwards when the pixel
+ * counter is beyond the length of the shorter field, just
+ * clamp the position the length of the shorter field. This
+ * matches how the scanline counter based position works since
+ * the scanline counter doesn't count the two half lines.
+ */
+ if (position >= vtotal)
+ position = vtotal - 1;
+
+ /*
* Start of vblank interrupt is triggered at start of hsync,
* just prior to the first active line of vblank. However we
* consider lines to start at the leading edge of horizontal
OpenPOWER on IntegriCloud