Skip to contentSkip to conversation

interlaced support v2

PATCH In review Daniel Vetter 6 participants 25 messages Jan 28, 2012 – Feb 10, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover interlaced support v2

Hi all,

These are the patches I'd like to queue to -next for interlaced support. Needs the patch "fixup interlaced bits clearing in PIPECONF on PCH_SPLIT" and also the drm core fix "drm/modes: do not enforce an odd vtotal for interlaced modes" if you want to use interlaced modelines with an even vtotal.

The entire series is available in my interlaced branch at

http://cgit.freedesktop.org/~danvet/drm/log/?h=interlaced

Review, comments and testing highly welcome.

Yours, Daniel

Daniel Vetter (6):
drm/i915: clean up interlaced pipeconf bit definitions drm/i915: fixup interlaced vertical timings confusion, part 1 drm/i915: fixup interlaced vertical timings confusion, part 2 drm/i915: fixup interlaced support on ilk+ drm/i915: don't allow interlaced pipeconf on gen2 drm/i915: correctly program the VSYNCSHIFT register

Peter Ross (2):
drm/i915: allow interlaced mode output on the SDVO connector drm/i915: allow interlaced mode output on the HDMI connector

 drivers/gpu/drm/i915/i915_reg.h      |   25 +++++++++++++++++++--
 drivers/gpu/drm/i915/intel_crt.c     |    5 +++-
 drivers/gpu/drm/i915/intel_display.c |   39 ++++++++++++++++++---------------
 drivers/gpu/drm/i915/intel_dvo.c     |    1 -
 drivers/gpu/drm/i915/intel_hdmi.c    |    2 +-
 drivers/gpu/drm/i915/intel_overlay.c |    2 +-
 drivers/gpu/drm/i915/intel_panel.c   |    2 +-
 drivers/gpu/drm/i915/intel_sdvo.c    |    3 +-
 drivers/gpu/drm/i915/intel_tv.c      |    2 +-
 9 files changed, 52 insertions(+), 29 deletions(-)
Signature · 1 line
1.7.7.5
#1 lore raw

PATCH 1/8 drm/i915: clean up interlaced pipeconf bit definitions

- Clarify which bits are for which chips.
- Note that gen2 can't do interlaced directly (only via dvo tv chips).
- Move the mask to the top to make it clearer how wide this field is.
- Add defintions for all possible values.

This patch doesn't change any code.

v2: Paulo Zanoni pointed out that the pixel doubling modes do no longer exist on ivb.

---
 drivers/gpu/drm/i915/i915_reg.h |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +14 -3
index c3afb78..58f0cec 100644
@@ -2319,10 +2319,21 @@
 #define   PIPECONF_PALETTE	0
 #define   PIPECONF_GAMMA		(1<<24)
 #define   PIPECONF_FORCE_BORDER	(1<<25)
-#define   PIPECONF_PROGRESSIVE	(0 << 21)
-#define   PIPECONF_INTERLACE_W_FIELD_INDICATION	(6 << 21)
-#define   PIPECONF_INTERLACE_FIELD_0_ONLY		(7 << 21)
 #define   PIPECONF_INTERLACE_MASK	(7 << 21)
+/* Note that pre-gen3 does not support interlaced display directly. Panel
+ * fitting must be disabled on pre-ilk for interlaced. */
+#define   PIPECONF_PROGRESSIVE			(0 << 21)
+#define   PIPECONF_INTERLACE_W_SYNC_SHIFT_PANEL	(4 << 21) /* gen4 only */
+#define   PIPECONF_INTERLACE_W_SYNC_SHIFT	(5 << 21) /* gen4 only */
+#define   PIPECONF_INTERLACE_W_FIELD_INDICATION	(6 << 21)
+#define   PIPECONF_INTERLACE_FIELD_0_ONLY	(7 << 21) /* gen3 only */
+/* Ironlake and later have a complete new set of values for interlaced. PFIT
+ * means panel fitter required, PF means progressive fetch, DBL means power
+ * saving pixel doubling. */
+#define   PIPECONF_PFIT_PF_INTERLACED_ILK	(1 << 21)
+#define   PIPECONF_INTERLACED_ILK		(3 << 21)
+#define   PIPECONF_INTERLACED_DBL_ILK		(4 << 21) /* ilk/snb only */
+#define   PIPECONF_PFIT_PF_INTERLACED_DBL_ILK	(5 << 21) /* ilk/snb only */
 #define   PIPECONF_CXSR_DOWNCLOCK	(1<<16)
 #define   PIPECONF_BPP_MASK	(0x000000e0)
 #define   PIPECONF_BPP_8	(0<<5)
Signature · 1 line
1.7.7.5
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] drm/i915: clean up interlaced pipeconf bit definitions

drivers/gpu/drm/i915/i915_reg.h line 2329

Quoted 7 lines · Daniel Vetter
(quoted diff) +2 -0
+#define   PIPECONF_PROGRESSIVE                 (0 << 21)
+#define   PIPECONF_INTERLACE_W_SYNC_SHIFT_PANEL        (4 << 21) /* gen4

only */

drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   PIPECONF_INTERLACE_W_SYNC_SHIFT      (5 << 21) /* gen4 only */
+#define   PIPECONF_INTERLACE_W_FIELD_INDICATION        (6 << 21)
+#define   PIPECONF_INTERLACE_FIELD_0_ONLY      (7 << 21) /* gen3 only */

<bikeshedding>
As you are touching this code, perhaps you could align the tabification/spacing as well?
</bikeshedding>

Other than that,

Signature · 2 lines
Eugeni Dodonov
 <http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH 1/8] drm/i915: clean up interlaced pipeconf bit definitions

Quoted 14 lines · Eugeni Dodonov

drivers/gpu/drm/i915/i915_reg.h line 2329

Quoted 7 lines · Daniel Vetter
(quoted diff) +2 -0
+#define   PIPECONF_PROGRESSIVE                 (0 << 21)
+#define   PIPECONF_INTERLACE_W_SYNC_SHIFT_PANEL        (4 << 21) /* gen4

only */

drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   PIPECONF_INTERLACE_W_SYNC_SHIFT      (5 << 21) /* gen4 only */
+#define   PIPECONF_INTERLACE_W_FIELD_INDICATION        (6 << 21)
+#define   PIPECONF_INTERLACE_FIELD_0_ONLY      (7 << 21) /* gen3 only */

<bikeshedding>
As you are touching this code, perhaps you could align the tabification/spacing as well?
</bikeshedding>

I've aligned them, unfortunately the additional +/- in the diff creates havoc if the tab is only one space wide in the real file ;-) -Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#4 lore raw

PATCH 2/8 drm/i915: fixup interlaced vertical timings confusion, part 1

In reply to Daniel Vetter

We have a pretty decent confusion about vertical timings of interlaced modes. Peter Ross has written a patch that makes interlace modes work on a lot more platforms/output combinations by doubling the vertical timings.

The issue with that patch is that core drm _does_ support specifying whether we want these vertical timings in fields or frames, we just haven't managed to consistently use this facility. The relavant function is drm_mode_set_crtcinfo, which fills in the crtc timing information.

The first thing to note is that the drm core keeps interlaced modes in frames, but displays modelines in fields. So when the crtc modeset helper copies over the mode into adjusted_mode it will already contain vertical timings in half-frames. The result is that the fixup code in intel_crtc_mode_fixup doesn't actually do anything (in most cases at least).

Now gen3+ natively supports interlaced modes and wants the vertical timings in frames. Which is what sdvo already fixes up, at least under some conditions.

There are a few other place that demand vertical timings in fields but never actually deal with interlaced modes, so use frame timings for consistency, too. These are:
- lvds panel,
- dvo encoders - dvo is the only way gen2 could support interlaced mode, but currently we don't support any encoders that do.
- tv out - despite that the tv dac sends out an interlaced signal it expects a progressive mode pipe configuration.
All these encoders enforce progressive modes by resetting interlace_allowed.

Hence we always want crtc vertical timings in frames. Enforce this in our crtc mode_fixup function and rip out any redudant timing computations from the encoders' mode_fixup function.

v2-4: Adjust the vertical timings a bit.

v5: Split out the 'subtract-one for interlaced' fixes.

v6: Clarify issues around tv-out and gen2.

---
 drivers/gpu/drm/i915/intel_display.c |    7 ++-----
 drivers/gpu/drm/i915/intel_dvo.c     |    1 -
 drivers/gpu/drm/i915/intel_overlay.c |    2 +-
 drivers/gpu/drm/i915/intel_panel.c   |    2 +-
 drivers/gpu/drm/i915/intel_sdvo.c    |    1 -
 drivers/gpu/drm/i915/intel_tv.c      |    2 +-
 6 files changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -5
index de26748..3af13ac 100644
@@ -3425,11 +3425,8 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
 			return false;
 	}
 
-	/* XXX some encoders set the crtcinfo, others don't.
-	 * Obviously we need some form of conflict resolution here...
-	 */
-	if (adjusted_mode->crtc_htotal == 0)
-		drm_mode_set_crtcinfo(adjusted_mode, 0);
+	/* All interlaced capable intel hw wants timings in frames. */
+	drm_mode_set_crtcinfo(adjusted_mode, 0);
 
 	return true;
 }
drivers/gpu/drm/i915/intel_dvo.c +0 -1
index 6eda1b5..020a7d7 100644
@@ -157,7 +157,6 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder,
 		C(vsync_end);
 		C(vtotal);
 		C(clock);
-		drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
 #undef C
 	}
 
drivers/gpu/drm/i915/intel_overlay.c +1 -1
index cdf17d4..aac74ec 100644
@@ -263,7 +263,7 @@ i830_activate_pipe_a(struct drm_device *dev)
 	DRM_DEBUG_DRIVER("Enabling pipe A in order to enable overlay\n");
 
 	mode = drm_mode_duplicate(dev, &vesa_640x480);
-	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+	drm_mode_set_crtcinfo(mode, 0);
 	if (!drm_crtc_helper_set_mode(&crtc->base, mode,
 				       crtc->base.x, crtc->base.y,
 				       crtc->base.fb))
drivers/gpu/drm/i915/intel_panel.c +1 -1
index c935cda..230a141 100644
@@ -48,7 +48,7 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
 
 	adjusted_mode->clock = fixed_mode->clock;
 
-	drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
+	drm_mode_set_crtcinfo(adjusted_mode, 0);
 }
 
 /* adjusted_mode has been preset to be the panel's fixed mode */
drivers/gpu/drm/i915/intel_sdvo.c +0 -1
index e334ec3..5b480bb 100644
@@ -944,7 +944,6 @@ intel_sdvo_set_input_timings_for_mode(struct intel_sdvo *intel_sdvo,
 
 	intel_sdvo_get_mode_from_dtd(adjusted_mode, &intel_sdvo->input_dtd);
 
-	drm_mode_set_crtcinfo(adjusted_mode, 0);
 	return true;
 }
 
drivers/gpu/drm/i915/intel_tv.c +1 -1
index 1571be3..05f765e 100644
@@ -1240,7 +1240,7 @@ intel_tv_detect(struct drm_connector *connector, bool force)
 	int type;
 
 	mode = reported_modes[0];
-	drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V);
+	drm_mode_set_crtcinfo(&mode, 0);
 
 	if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) {
 		type = intel_tv_detect_type(intel_tv, connector);
Signature · 1 line
1.7.7.5
Reviewed-by on v1 2/8
#5 lore raw

Re: [PATCH 2/8] drm/i915: fixup interlaced vertical timings confusion, part 1

Quoted 37 lines · Daniel Vetter

We have a pretty decent confusion about vertical timings of interlaced modes. Peter Ross has written a patch that makes interlace modes work on a lot more platforms/output combinations by doubling the vertical timings.

The issue with that patch is that core drm _does_ support specifying whether we want these vertical timings in fields or frames, we just haven't managed to consistently use this facility. The relavant function is drm_mode_set_crtcinfo, which fills in the crtc timing information.

The first thing to note is that the drm core keeps interlaced modes in frames, but displays modelines in fields. So when the crtc modeset helper copies over the mode into adjusted_mode it will already contain vertical timings in half-frames. The result is that the fixup code in intel_crtc_mode_fixup doesn't actually do anything (in most cases at least).

Now gen3+ natively supports interlaced modes and wants the vertical timings in frames. Which is what sdvo already fixes up, at least under some conditions.

There are a few other place that demand vertical timings in fields but never actually deal with interlaced modes, so use frame timings for consistency, too. These are:
- lvds panel,
- dvo encoders - dvo is the only way gen2 could support interlaced mode, but currently we don't support any encoders that do.
- tv out - despite that the tv dac sends out an interlaced signal it expects a progressive mode pipe configuration.
All these encoders enforce progressive modes by resetting interlace_allowed.

Hence we always want crtc vertical timings in frames. Enforce this in our crtc mode_fixup function and rip out any redudant timing computations from the encoders' mode_fixup function.

Quoted 8 lines

v2-4: Adjust the vertical timings a bit.

v5: Split out the 'subtract-one for interlaced' fixes.

v6: Clarify issues around tv-out and gen2.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

PATCH 3/8 drm/i915: fixup interlaced vertical timings confusion, part 2

In reply to Daniel Vetter

According to bspec, we need to subtract an additional line from vtotal for interlaced modes and vblank_end needs to equal vtotal. All other timing fields do not need this special treatment, so kill it.

Bspec says that this is irrespective of whether the interlaced mode has an odd or even vtotal, both modes are supported.

---
 drivers/gpu/drm/i915/intel_display.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -8
index 3af13ac..d108146 100644
@@ -5366,12 +5366,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
 		pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
 		/* the chip adds 2 halflines automatically */
-		adjusted_mode->crtc_vdisplay -= 1;
 		adjusted_mode->crtc_vtotal -= 1;
-		adjusted_mode->crtc_vblank_start -= 1;
 		adjusted_mode->crtc_vblank_end -= 1;
-		adjusted_mode->crtc_vsync_end -= 1;
-		adjusted_mode->crtc_vsync_start -= 1;
 	} else
 		pipeconf |= PIPECONF_PROGRESSIVE;
 
@@ -5959,12 +5955,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
 		pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
 		/* the chip adds 2 halflines automatically */
-		adjusted_mode->crtc_vdisplay -= 1;
 		adjusted_mode->crtc_vtotal -= 1;
-		adjusted_mode->crtc_vblank_start -= 1;
 		adjusted_mode->crtc_vblank_end -= 1;
-		adjusted_mode->crtc_vsync_end -= 1;
-		adjusted_mode->crtc_vsync_start -= 1;
 	} else
 		pipeconf |= PIPECONF_PROGRESSIVE;
 
Signature · 1 line
1.7.7.5
Reviewed-by on v1 3/8
#7 lore raw

Re: [PATCH 3/8] drm/i915: fixup interlaced vertical timings confusion, part 2

Quoted 9 lines · Daniel Vetter

According to bspec, we need to subtract an additional line from vtotal for interlaced modes and vblank_end needs to equal vtotal. All other timing fields do not need this special treatment, so kill it.

Bspec says that this is irrespective of whether the interlaced mode has an odd or even vtotal, both modes are supported.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

PATCH 4/8 drm/i915: fixup interlaced support on ilk+

In reply to Daniel Vetter

According to Paulo Zanoni, this is what windows does.

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index d108146..e7c9154 100644
@@ -5953,7 +5953,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 
 	pipeconf &= ~PIPECONF_INTERLACE_MASK;
 	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
-		pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
+		pipeconf |= PIPECONF_INTERLACED_ILK;
 		/* the chip adds 2 halflines automatically */
 		adjusted_mode->crtc_vtotal -= 1;
 		adjusted_mode->crtc_vblank_end -= 1;
Signature · 1 line
1.7.7.5
#9 lore raw

PATCH 5/8 drm/i915: don't allow interlaced pipeconf on gen2

In reply to Daniel Vetter

gen2 doesn't support it, so be a bit more paranoid and add a check to ensure that we never ever set an unsupported interlaced bit.

Ensure that userspace can't set an interlaced mode by resetting interlace_allowed for the crt on gen2. dvo and lvds are the only other encoders that gen2 supports and these already disallow interlaced modes.

---
 drivers/gpu/drm/i915/intel_crt.c     |    5 ++++-
 drivers/gpu/drm/i915/intel_display.c |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +4 -1
index dd729d4..4d3d736 100644
@@ -594,7 +594,10 @@ void intel_crt_init(struct drm_device *dev)
 				1 << INTEL_ANALOG_CLONE_BIT |
 				1 << INTEL_SDVO_LVDS_CLONE_BIT);
 	crt->base.crtc_mask = (1 << 0) | (1 << 1);
-	connector->interlace_allowed = 1;
+	if (IS_GEN2(dev))
+		connector->interlace_allowed = 0;
+	else
+		connector->interlace_allowed = 1;
 	connector->doublescan_allowed = 0;
 
 	drm_encoder_helper_add(&crt->base.base, &intel_crt_helper_funcs);
drivers/gpu/drm/i915/intel_display.c +2 -1
index e7c9154..dc80842 100644
@@ -5363,7 +5363,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	}
 
 	pipeconf &= ~PIPECONF_INTERLACE_MASK;
-	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
+	if (!IS_GEN2(dev) &&
+	    adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
 		pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
 		/* the chip adds 2 halflines automatically */
 		adjusted_mode->crtc_vtotal -= 1;
Signature · 1 line
1.7.7.5
Reviewed-by on v1 5/8
#10 lore raw

Re: [PATCH 5/8] drm/i915: don't allow interlaced pipeconf on gen2

Quoted 10 lines · Daniel Vetter

gen2 doesn't support it, so be a bit more paranoid and add a check to ensure that we never ever set an unsupported interlaced bit.

Ensure that userspace can't set an interlaced mode by resetting interlace_allowed for the crt on gen2. dvo and lvds are the only other encoders that gen2 supports and these already disallow interlaced modes.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

PATCH 6/8 drm/i915: correctly program the VSYNCSHIFT register

In reply to Daniel Vetter

The hw seems to use this to correctly insert the required delay before/after an even/odd interlaced field. This might also explain why we need to substract 1 half-line from vtotal - if the hw just adds the delay programmend in VSYNCSHIFT the total frame time would be about that too long.

These registers seems to only exist on gen4 and later. For paranoia also program it to 0 for progressive modes, but according to documentation the hw should just ignore it in this case.

---
 drivers/gpu/drm/i915/i915_reg.h      |    8 ++++++++
 drivers/gpu/drm/i915/intel_display.c |   19 ++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -0
index 58f0cec..bcd5cce 100644
@@ -1316,6 +1316,7 @@
 #define _VSYNC_A		0x60014
 #define _PIPEASRC	0x6001c
 #define _BCLRPAT_A	0x60020
+#define _VSYNCSHIFT_A	0x60028
 
 /* Pipe B timing regs */
 #define _HTOTAL_B	0x61000
@@ -1326,6 +1327,8 @@
 #define _VSYNC_B		0x61014
 #define _PIPEBSRC	0x6101c
 #define _BCLRPAT_B	0x61020
+#define _VSYNCSHIFT_B	0x61028
+
 
 #define HTOTAL(pipe) _PIPE(pipe, _HTOTAL_A, _HTOTAL_B)
 #define HBLANK(pipe) _PIPE(pipe, _HBLANK_A, _HBLANK_B)
@@ -1334,6 +1337,7 @@
 #define VBLANK(pipe) _PIPE(pipe, _VBLANK_A, _VBLANK_B)
 #define VSYNC(pipe) _PIPE(pipe, _VSYNC_A, _VSYNC_B)
 #define BCLRPAT(pipe) _PIPE(pipe, _BCLRPAT_A, _BCLRPAT_B)
+#define VSYNCSHIFT(pipe) _PIPE(pipe, _VSYNCSHIFT_A, _VSYNCSHIFT_B)
 
 /* VGA port control */
 #define ADPA			0x61100
@@ -3216,6 +3220,7 @@
 #define _TRANS_VSYNC_A           0xe0014
 #define  TRANS_VSYNC_END_SHIFT  16
 #define  TRANS_VSYNC_START_SHIFT 0
+#define _TRANS_VSYNCSHIFT_A	0xe0028
 
 #define _TRANSA_DATA_M1          0xe0030
 #define _TRANSA_DATA_N1          0xe0034
@@ -3246,6 +3251,7 @@
 #define _TRANS_VTOTAL_B          0xe100c
 #define _TRANS_VBLANK_B          0xe1010
 #define _TRANS_VSYNC_B           0xe1014
+#define _TRANS_VSYNCSHIFT_B	 0xe1028
 
 #define TRANS_HTOTAL(pipe) _PIPE(pipe, _TRANS_HTOTAL_A, _TRANS_HTOTAL_B)
 #define TRANS_HBLANK(pipe) _PIPE(pipe, _TRANS_HBLANK_A, _TRANS_HBLANK_B)
@@ -3253,6 +3259,8 @@
 #define TRANS_VTOTAL(pipe) _PIPE(pipe, _TRANS_VTOTAL_A, _TRANS_VTOTAL_B)
 #define TRANS_VBLANK(pipe) _PIPE(pipe, _TRANS_VBLANK_A, _TRANS_VBLANK_B)
 #define TRANS_VSYNC(pipe) _PIPE(pipe, _TRANS_VSYNC_A, _TRANS_VSYNC_B)
+#define TRANS_VSYNCSHIFT(pipe) _PIPE(pipe, _TRANS_VSYNCSHIFT_A, \
+				     _TRANS_VSYNCSHIFT_B)
 
 #define _TRANSB_DATA_M1          0xe1030
 #define _TRANSB_DATA_N1          0xe1034
drivers/gpu/drm/i915/intel_display.c +16 -3
index dc80842..e842961 100644
@@ -2961,6 +2961,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	I915_WRITE(TRANS_VTOTAL(pipe), I915_READ(VTOTAL(pipe)));
 	I915_WRITE(TRANS_VBLANK(pipe), I915_READ(VBLANK(pipe)));
 	I915_WRITE(TRANS_VSYNC(pipe),  I915_READ(VSYNC(pipe)));
+	I915_WRITE(TRANS_VSYNCSHIFT(pipe),  I915_READ(VSYNCSHIFT(pipe)));
 
 	intel_fdi_normal_train(crtc);
 
@@ -5081,7 +5082,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	int plane = intel_crtc->plane;
 	int refclk, num_connectors = 0;
 	intel_clock_t clock, reduced_clock;
-	u32 dpll, dspcntr, pipeconf;
+	u32 dpll, dspcntr, pipeconf, vsyncshift;
 	bool ok, has_reduced_clock = false, is_sdvo = false, is_dvo = false;
 	bool is_crt = false, is_lvds = false, is_tv = false, is_dp = false;
 	struct drm_mode_config *mode_config = &dev->mode_config;
@@ -5369,8 +5370,15 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 		/* the chip adds 2 halflines automatically */
 		adjusted_mode->crtc_vtotal -= 1;
 		adjusted_mode->crtc_vblank_end -= 1;
-	} else
+		vsyncshift = adjusted_mode->crtc_hsync_start
+			     - adjusted_mode->crtc_htotal/2;
+	} else {
 		pipeconf |= PIPECONF_PROGRESSIVE;
+		vsyncshift = 0;
+	}
+
+	if (!IS_GEN3(dev))
+		I915_WRITE(VSYNCSHIFT(pipe), vsyncshift);
 
 	I915_WRITE(HTOTAL(pipe),
 		   (adjusted_mode->crtc_hdisplay - 1) |
@@ -5958,8 +5966,13 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 		/* the chip adds 2 halflines automatically */
 		adjusted_mode->crtc_vtotal -= 1;
 		adjusted_mode->crtc_vblank_end -= 1;
-	} else
+		I915_WRITE(VSYNCSHIFT(pipe),
+			   adjusted_mode->crtc_hsync_start
+			   - adjusted_mode->crtc_htotal/2);
+	} else {
 		pipeconf |= PIPECONF_PROGRESSIVE;
+		I915_WRITE(VSYNCSHIFT(pipe), 0);
+	}
 
 	I915_WRITE(HTOTAL(pipe),
 		   (adjusted_mode->crtc_hdisplay - 1) |
Signature · 1 line
1.7.7.5
#12 lore raw

PATCH 7/8 drm/i915: allow interlaced mode output on the SDVO connector

In reply to Daniel Vetter

From: Peter Ross <[email protected]>

---
 drivers/gpu/drm/i915/intel_sdvo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +1 -1
index 5b480bb..80fb5da 100644
@@ -1984,7 +1984,7 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
 	drm_connector_helper_add(&connector->base.base,
 				 &intel_sdvo_connector_helper_funcs);
 
-	connector->base.base.interlace_allowed = 0;
+	connector->base.base.interlace_allowed = 1;
 	connector->base.base.doublescan_allowed = 0;
 	connector->base.base.display_info.subpixel_order = SubPixelHorizontalRGB;
 
Signature · 1 line
1.7.7.5
Reviewed-by on v1 7/8
#13 lore raw

Re: [PATCH 7/8] drm/i915: allow interlaced mode output on the SDVO connector

Quoted 5 lines · Daniel Vetter

From: Peter Ross <[email protected]>

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

PATCH 8/8 drm/i915: allow interlaced mode output on the HDMI connector

In reply to Daniel Vetter

From: Peter Ross <[email protected]>

---
 drivers/gpu/drm/i915/intel_hdmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
index 64541f7..086288e 100644
@@ -514,7 +514,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
 	intel_encoder->type = INTEL_OUTPUT_HDMI;
 
 	connector->polled = DRM_CONNECTOR_POLL_HPD;
-	connector->interlace_allowed = 0;
+	connector->interlace_allowed = 1;
 	connector->doublescan_allowed = 0;
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
 
Signature · 1 line
1.7.7.5
Reviewed-by on v1 8/8
#15 lore raw

Re: [PATCH 8/8] drm/i915: allow interlaced mode output on the HDMI connector

Quoted 5 lines · Daniel Vetter

From: Peter Ross <[email protected]>

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by Tested-by on the v1 series
#16 lore raw
In reply to Daniel Vetter

Hi

2012/1/28 Daniel Vetter <[email protected]>:

Quoted 3 lines

Hi all,

http://cgit.freedesktop.org/~danvet/drm/log/?h=interlaced

So far, tested on ILK and SNB.

Your series contains 8 patches, but your branch contains 10.
- Patch "drm/i915: fixup interlaced bits clearing in PIPECONF on PCH_SPLIT" also has my R-B and T-B
- Patch "drm/modes: do not enforce an odd vtotal for interlaced modes" was only tested on Intel and with modes with odd vtotal. I didn't check if it breaks the other drivers, so I'm not sure I should give a R-B.

Signature · 1 line
Paulo Zanoni
Tested-by Christopher Egert on the v1 series
#17 lore raw
In reply to Daniel Vetter
Quoted 7 lines · Daniel Vetter

Hi all,

These are the patches I'd like to queue to -next for interlaced support. Needs the patch "fixup interlaced bits clearing in PIPECONF on PCH_SPLIT" and also the drm core fix "drm/modes: do not enforce an odd vtotal for interlaced modes" if you want to use interlaced modelines with an even vtotal.

Quoted 7 lines

The entire series is available in my interlaced branch at

http://cgit.freedesktop.org/~danvet/drm/log/?h=interlaced

Review, comments and testing highly welcome.

From irc:

On an i915gm eeepc over the VGA connector: 1080i@50Hz on a TV and 1600x1200@100Hz on a CRT. For him interlaced over VGA is broken on at least the 3.1 kernel his ubuntu install shipped with. -Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
Tested-by on the v1 series
#18 lore raw
In reply to Daniel Vetter
Quoted 7 lines · Daniel Vetter

Hi all,

These are the patches I'd like to queue to -next for interlaced support. Needs the patch "fixup interlaced bits clearing in PIPECONF on PCH_SPLIT" and also the drm core fix "drm/modes: do not enforce an odd vtotal for interlaced modes" if you want to use interlaced modelines with an even vtotal.

Quoted 5 lines

The entire series is available in my interlaced branch at

http://cgit.freedesktop.org/~danvet/drm/log/?h=interlaced

Review, comments and testing highly welcome.

i3 2130 connected to a Philips 32pf9731d over HDMI:
- 1920x1080i@30Hz
- 1280x720p@60Hz
- 1024x768p@60Hz

thanks again,
alfonso

#19 lore raw
Quoted 5 lines · Alfonso Fiore

i3 2130 connected to a Philips 32pf9731d over HDMI:
- 1920x1080i@30Hz
- 1280x720p@60Hz
- 1024x768p@60Hz

Hi guys,

after grub, the TV switches to 1920x1080i. Even if I add vga=0x037b to grub menu entry, I get 1280x720p while loading services (I don't use "quiet splash") but then it goes back to 1920x1080i. Since everything else is 1280x720p (LightDM login and the desktop) I'd prefer to not keep switching resolution during boot.

Is there a way?

Thank you,
alfonso

#20 lore raw
In reply to Alfonso Fiore

Hello Daniel

I also want to confirm that interlacing is working over HDMI with 1920x1080i@50hz for Sandy Bridge 2600k. Thanks a lot.

The fixes are not part of the intel gfx driver, correct ?
When will it be pushed and to which kernel release will it presumably be addressed to.

Angela

Quoted 35 lines

-----Original Message-----
From: [email protected] [mailto:intel-gfx- [email protected]] On Behalf Of Alfonso Fiore
Sent: 28 January 2012 19:30
To: Daniel Vetter
Cc: Intel Graphics Development
Subject: Re: [Intel-gfx] [PATCH 0/8] interlaced support v2

Quoted 7 lines · Daniel Vetter

Hi all,

These are the patches I'd like to queue to -next for interlaced support. Needs the patch "fixup interlaced bits clearing in PIPECONF on PCH_SPLIT" and also the drm core fix "drm/modes: do not enforce an odd vtotal for interlaced modes" if you want to use interlaced modelines with an even vtotal.

Quoted 5 lines

The entire series is available in my interlaced branch at

http://cgit.freedesktop.org/~danvet/drm/log/?h=interlaced

Review, comments and testing highly welcome.

i3 2130 connected to a Philips 32pf9731d over HDMI:
- 1920x1080i@30Hz
- 1280x720p@60Hz
- 1024x768p@60Hz

thanks again,
alfonso
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#22 lore raw
Quoted 6 lines · Angela Schmid

Hello Daniel

I also want to confirm that interlacing is working over HDMI with 1920x1080i@50hz for Sandy Bridge 2600k. Thanks a lot.

The fixes are not part of the intel gfx driver, correct ?
When will it be pushed and to which kernel release will it presumably be addressed to.

Correct, this is all kernel work and doesn't required any changes to the X server or driver. Because it's a new feature, it'll go through next and should land in linux kernel v3.4, which releases in about half a year or so.

Thanks a lot for testing.

Yours, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#23 lore raw

PATCH 1/1 drm/i915: fixup overlay checks for interlaced modes

In reply to Daniel Vetter

The drm core _really_ likes to frob around with the crtc timings and put halfed vertical timings (in fields) in there. Which confuses the overlay code, resulting in it's refusal to display anything at the lower half of an interlaced pipe.

---
 drivers/gpu/drm/i915/intel_overlay.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_overlay.c +4 -4
index cdf17d4..2cb67bf 100644
@@ -935,10 +935,10 @@ static int check_overlay_dst(struct intel_overlay *overlay,
 {
 	struct drm_display_mode *mode = &overlay->crtc->base.mode;
 
-	if (rec->dst_x < mode->crtc_hdisplay &&
-	    rec->dst_x + rec->dst_width <= mode->crtc_hdisplay &&
-	    rec->dst_y < mode->crtc_vdisplay &&
-	    rec->dst_y + rec->dst_height <= mode->crtc_vdisplay)
+	if (rec->dst_x < mode->hdisplay &&
+	    rec->dst_x + rec->dst_width <= mode->hdisplay &&
+	    rec->dst_y < mode->vdisplay &&
+	    rec->dst_y + rec->dst_height <= mode->vdisplay)
 		return 0;
 	else
 		return -EINVAL;
Signature · 1 line
1.7.8.3
Reviewed-by on v1 1/1
#24 lore raw

Re: [PATCH] drm/i915: fixup overlay checks for interlaced modes

Quoted 8 lines · Daniel Vetter

The drm core _really_ likes to frob around with the crtc timings and put halfed vertical timings (in fields) in there. Which confuses the overlay code, resulting in it's refusal to display anything at the lower half of an interlaced pipe.

This makes sense, and we have a test-case where it actually solves issues. So

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#25 lore raw

Re: [PATCH] drm/i915: fixup overlay checks for interlaced modes

Quoted 7 lines · Eugeni Dodonov
Quoted 5 lines · Daniel Vetter

The drm core _really_ likes to frob around with the crtc timings and put halfed vertical timings (in fields) in there. Which confuses the overlay code, resulting in it's refusal to display anything at the lower half of an interlaced pipe.

Quoted 7 lines
Quoted 3 lines

This makes sense, and we have a test-case where it actually solves issues. So

Ok, I've slurped this in for -next. Thanks a lot for patches, review, testing, crawling through docs and digging up register dumps from all over the place.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48