Skip to contentSkip to conversation

Supporting fused display configurations

PATCH New Damien Lespiau 3 participants 15 messages Dec 5, 2013

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

A while ago, Ben added support for Quanta devices that had the display hardware fused off. We can a bit more general than that by reading the FUSE_STRAP register and setting num_pipes to 0 when detecting such condition.

To achieve that, the intel_device_info structure in dev_priv needed to be made writable, that's patch 1.

Patches 2 to 5 build the support for reading out FUSE_STRAP on IVB+, client platforms only to detect both "display fused off" and "pipe C fused off" configurations.

Patch 6 removes the Quanta special-case with the (reasonable) hope that it's now covered by the DISPLAY_DISABLE bit.

Patch 7 is a bonus, somewhat unrelated, little clean-up patch.

This series is not tested due to lack of such a device, I was hoping Ben still had the device around somewhere and could give this series a go.

#1 lore raw

PATCH 1/7 drm/i915: Make the intel_device_info structure kept in dev_priv writable

Turns out it'd be nice to change some device information at run-time or simply have some code to fill in the info struct instead of having to declare the values in 30+ structures.

What prompted this change is handling fused out display/pipe and tweaking num_pipes at run-time, but I'm quite sure we'll find other flags/limits to stick into dev_priv->info.

---
 drivers/gpu/drm/i915/i915_dma.c      |   4 +-
 drivers/gpu/drm/i915/i915_drv.h      |   4 +-
 drivers/gpu/drm/i915/i915_gem.c      |   2 +-
 drivers/gpu/drm/i915/i915_irq.c      |   4 +-
 drivers/gpu/drm/i915/i915_reg.h      | 228 +++++++++++++++++------------------
 drivers/gpu/drm/i915/intel_display.c |  20 +--
 drivers/gpu/drm/i915/intel_pm.c      |  12 +-
 7 files changed, 137 insertions(+), 137 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +2 -2
index 89e4cf1..63aae7b 100644
@@ -1432,7 +1432,7 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
 
 static void i915_dump_device_info(struct drm_i915_private *dev_priv)
 {
-	const struct intel_device_info *info = dev_priv->info;
+	const struct intel_device_info *info = &dev_priv->info;
 
 #define PRINT_S(name) "%s"
 #define SEP_EMPTY
@@ -1482,7 +1482,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
 	dev->dev_private = (void *)dev_priv;
 	dev_priv->dev = dev;
-	dev_priv->info = info;
+	memcpy(&dev_priv->info, info, sizeof(*info));
 
 	spin_lock_init(&dev_priv->irq_lock);
 	spin_lock_init(&dev_priv->gpu_error.lock);
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 780f815..55ad44e 100644
@@ -1323,7 +1323,7 @@ typedef struct drm_i915_private {
 	struct drm_device *dev;
 	struct kmem_cache *slab;
 
-	const struct intel_device_info *info;
+	struct intel_device_info info;
 
 	int relative_constants_mode;
 
@@ -1745,7 +1745,7 @@ struct drm_i915_file_private {
 	atomic_t rps_wait_boost;
 };
 
-#define INTEL_INFO(dev)	(to_i915(dev)->info)
+#define INTEL_INFO(dev)	(&to_i915(dev)->info)
 
 #define IS_I830(dev)		((dev)->pdev->device == 0x3577)
 #define IS_845G(dev)		((dev)->pdev->device == 0x2562)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index 0ecc735..f196f0b 100644
@@ -1027,7 +1027,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 
 	timeout_jiffies = timeout ? timespec_to_jiffies_timeout(timeout) : 1;
 
-	if (dev_priv->info->gen >= 6 && can_wait_boost(file_priv)) {
+	if (dev_priv->info.gen >= 6 && can_wait_boost(file_priv)) {
 		gen6_rps_boost(dev_priv);
 		if (file_priv)
 			mod_delayed_work(dev_priv->wq,
drivers/gpu/drm/i915/i915_irq.c +2 -2
index 74918e7..e3ddd32 100644
@@ -2209,7 +2209,7 @@ static int i915_enable_vblank(struct drm_device *dev, int pipe)
 				     PIPE_VBLANK_INTERRUPT_ENABLE);
 
 	/* maintain vblank delivery even in deep C-states */
-	if (dev_priv->info->gen == 3)
+	if (dev_priv->info.gen == 3)
 		I915_WRITE(INSTPM, _MASKED_BIT_DISABLE(INSTPM_AGPBUSY_DIS));
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
 
@@ -2281,7 +2281,7 @@ static void i915_disable_vblank(struct drm_device *dev, int pipe)
 	unsigned long irqflags;
 
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
-	if (dev_priv->info->gen == 3)
+	if (dev_priv->info.gen == 3)
 		I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_AGPBUSY_DIS));
 
 	i915_disable_pipestat(dev_priv, pipe,
drivers/gpu/drm/i915/i915_reg.h +114 -114

444 lines not on this page · raw message

drivers/gpu/drm/i915/intel_display.c +10 -10
index 3c59b67..8b50b5f 100644
@@ -1030,7 +1030,7 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv,
 	u32 val;
 
 	/* ILK FDI PLL is always enabled */
-	if (dev_priv->info->gen == 5)
+	if (dev_priv->info.gen == 5)
 		return;
 
 	/* On Haswell, DDI ports are responsible for the FDI PLL setup */
@@ -1429,7 +1429,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
 	assert_pipe_disabled(dev_priv, crtc->pipe);
 
 	/* No really, not for ILK+ */
-	BUG_ON(dev_priv->info->gen >= 5);
+	BUG_ON(dev_priv->info.gen >= 5);
 
 	/* PLL is protected by panel, make sure we can write it */
 	if (IS_MOBILE(dev) && !IS_I830(dev))
@@ -1536,7 +1536,7 @@ static void ironlake_enable_shared_dpll(struct intel_crtc *crtc)
 	struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc);
 
 	/* PCH PLLs only available on ILK, SNB and IVB */
-	BUG_ON(dev_priv->info->gen < 5);
+	BUG_ON(dev_priv->info.gen < 5);
 	if (WARN_ON(pll == NULL))
 		return;
 
@@ -1565,7 +1565,7 @@ static void intel_disable_shared_dpll(struct intel_crtc *crtc)
 	struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc);
 
 	/* PCH only available on ILK+ */
-	BUG_ON(dev_priv->info->gen < 5);
+	BUG_ON(dev_priv->info.gen < 5);
 	if (WARN_ON(pll == NULL))
 	       return;
 
@@ -1600,7 +1600,7 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
 	uint32_t reg, val, pipeconf_val;
 
 	/* PCH only available on ILK+ */
-	BUG_ON(dev_priv->info->gen < 5);
+	BUG_ON(dev_priv->info.gen < 5);
 
 	/* Make sure PCH DPLL is enabled */
 	assert_shared_dpll_enabled(dev_priv,
@@ -1653,7 +1653,7 @@ static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,
 	u32 val, pipeconf_val;
 
 	/* PCH only available on ILK+ */
-	BUG_ON(dev_priv->info->gen < 5);
+	BUG_ON(dev_priv->info.gen < 5);
 
 	/* FDI must be feeding us bits for PCH ports */
 	assert_fdi_tx_enabled(dev_priv, (enum pipe) cpu_transcoder);
@@ -1834,7 +1834,7 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv,
 void intel_flush_primary_plane(struct drm_i915_private *dev_priv,
 			       enum plane plane)
 {
-	u32 reg = dev_priv->info->gen >= 4 ? DSPSURF(plane) : DSPADDR(plane);
+	u32 reg = dev_priv->info.gen >= 4 ? DSPSURF(plane) : DSPADDR(plane);
 
 	I915_WRITE(reg, I915_READ(reg));
 	POSTING_READ(reg);
@@ -7521,7 +7521,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
 
 	/* we only need to pin inside GTT if cursor is non-phy */
 	mutex_lock(&dev->struct_mutex);
-	if (!dev_priv->info->cursor_needs_physical) {
+	if (!dev_priv->info.cursor_needs_physical) {
 		unsigned alignment;
 
 		if (obj->tiling_mode) {
@@ -7569,7 +7569,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
 
  finish:
 	if (intel_crtc->cursor_bo) {
-		if (dev_priv->info->cursor_needs_physical) {
+		if (dev_priv->info.cursor_needs_physical) {
 			if (intel_crtc->cursor_bo != obj)
 				i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
 		} else
@@ -8147,7 +8147,7 @@ void intel_mark_idle(struct drm_device *dev)
 		intel_decrease_pllclock(crtc);
 	}
 
-	if (dev_priv->info->gen >= 6)
+	if (dev_priv->info.gen >= 6)
 		gen6_rps_idle(dev->dev_private);
 }
 
drivers/gpu/drm/i915/intel_pm.c +6 -6
index a23eb27..711a213 100644
@@ -3585,7 +3585,7 @@ void gen6_rps_idle(struct drm_i915_private *dev_priv)
 {
 	mutex_lock(&dev_priv->rps.hw_lock);
 	if (dev_priv->rps.enabled) {
-		if (dev_priv->info->is_valleyview)
+		if (dev_priv->info.is_valleyview)
 			valleyview_set_rps(dev_priv->dev, dev_priv->rps.min_delay);
 		else
 			gen6_set_rps(dev_priv->dev, dev_priv->rps.min_delay);
@@ -3598,7 +3598,7 @@ void gen6_rps_boost(struct drm_i915_private *dev_priv)
 {
 	mutex_lock(&dev_priv->rps.hw_lock);
 	if (dev_priv->rps.enabled) {
-		if (dev_priv->info->is_valleyview)
+		if (dev_priv->info.is_valleyview)
 			valleyview_set_rps(dev_priv->dev, dev_priv->rps.max_delay);
 		else
 			gen6_set_rps(dev_priv->dev, dev_priv->rps.max_delay);
@@ -4367,7 +4367,7 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
 {
 	unsigned long val;
 
-	if (dev_priv->info->gen != 5)
+	if (dev_priv->info.gen != 5)
 		return 0;
 
 	spin_lock_irq(&mchdev_lock);
@@ -4529,7 +4529,7 @@ static u16 pvid_to_extvid(struct drm_i915_private *dev_priv, u8 pxvid)
 		{ 16000, 14875, },
 		{ 16125, 15000, },
 	};
-	if (dev_priv->info->is_mobile)
+	if (dev_priv->info.is_mobile)
 		return v_table[pxvid].vm;
 	else
 		return v_table[pxvid].vd;
@@ -4572,7 +4572,7 @@ static void __i915_update_gfx_val(struct drm_i915_private *dev_priv)
 
 void i915_update_gfx_val(struct drm_i915_private *dev_priv)
 {
-	if (dev_priv->info->gen != 5)
+	if (dev_priv->info.gen != 5)
 		return;
 
 	spin_lock_irq(&mchdev_lock);
@@ -4623,7 +4623,7 @@ unsigned long i915_gfx_val(struct drm_i915_private *dev_priv)
 {
 	unsigned long val;
 
-	if (dev_priv->info->gen != 5)
+	if (dev_priv->info.gen != 5)
 		return 0;
 
 	spin_lock_irq(&mchdev_lock);
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/7 drm/i915: Move num_plane to the intel_device_info structure

In reply to Damien Lespiau

And rename it to num_planes to match num_pipes.

This limit lives with num_pipes really, and now that dev_priv->info is writable we can put it there instead.

While at it, introduce a intel_device_info_runtime_init() where we'll be able to gather the device info fields at run-time.

---
 drivers/gpu/drm/i915/i915_dma.c      | 21 ++++++++++++++++++---
 drivers/gpu/drm/i915/i915_drv.h      |  5 ++---
 drivers/gpu/drm/i915/intel_display.c |  4 ++--
 3 files changed, 22 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +18 -3
index 63aae7b..cd22ec6 100644
@@ -1449,6 +1449,23 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv)
 #undef SEP_COMMA
 }
 
+/*
+ * Determine various intel_device_info fields at runtime.
+ *
+ * Use it when either:
+ *   - it's judged too laborious to fill n static structures with the limit
+ *     when a simple if statement does the job,
+ *   - run-time checks (eg read fuse/strap registers) are needed.
+ */
+static void intel_device_info_runtime_init(struct drm_device *dev)
+{
+	struct intel_device_info *info = INTEL_INFO(dev);
+
+	info->num_planes = 1;
+	if (IS_VALLEYVIEW(dev))
+		info->num_planes = 2;
+}
+
 /**
  * i915_driver_load - setup chip and create an initial config
  * @dev: DRM device
@@ -1629,9 +1646,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	if (!IS_I945G(dev) && !IS_I945GM(dev))
 		pci_enable_msi(dev->pdev);
 
-	dev_priv->num_plane = 1;
-	if (IS_VALLEYVIEW(dev))
-		dev_priv->num_plane = 2;
+	intel_device_info_runtime_init(dev);
 
 	if (INTEL_INFO(dev)->num_pipes) {
 		ret = drm_vblank_init(dev, INTEL_INFO(dev)->num_pipes);
drivers/gpu/drm/i915/i915_drv.h +2 -3
index 55ad44e..8a3e5cd 100644
@@ -77,7 +77,7 @@ enum plane {
 };
 #define plane_name(p) ((p) + 'A')
 
-#define sprite_name(p, s) ((p) * dev_priv->num_plane + (s) + 'A')
+#define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_planes + (s) + 'A')
 
 enum port {
 	PORT_A = 0,
@@ -503,6 +503,7 @@ struct intel_uncore {
 struct intel_device_info {
 	u32 display_mmio_offset;
 	u8 num_pipes:3;
+	u8 num_planes:2;
 	u8 gen;
 	u8 ring_mask; /* Rings supported by the HW */
 	DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON);
@@ -1385,8 +1386,6 @@ typedef struct drm_i915_private {
 	u32 hpd_event_bits;
 	struct timer_list hotplug_reenable_timer;
 
-	int num_plane;
-
 	struct i915_fbc fbc;
 	struct intel_opregion opregion;
 	struct intel_vbt_data vbt;
drivers/gpu/drm/i915/intel_display.c +2 -2
index 8b50b5f..4d0b35a 100644
@@ -1189,7 +1189,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
 	u32 val;
 
 	if (IS_VALLEYVIEW(dev)) {
-		for (i = 0; i < dev_priv->num_plane; i++) {
+		for (i = 0; i < INTEL_INFO(dev)->num_planes; i++) {
 			reg = SPCNTR(pipe, i);
 			val = I915_READ(reg);
 			WARN((val & SP_ENABLE),
@@ -10853,7 +10853,7 @@ void intel_modeset_init(struct drm_device *dev)
 
 	for_each_pipe(i) {
 		intel_crtc_init(dev, i);
-		for (j = 0; j < dev_priv->num_plane; j++) {
+		for (j = 0; j < INTEL_INFO(dev)->num_planes; j++) {
 			ret = intel_plane_init(dev, i, j);
 			if (ret)
 				DRM_DEBUG_KMS("pipe %c sprite %c init failed: %d\n",
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/7 drm/i915: Consolidate FUSE_STRAP in one set of defines

In reply to Damien Lespiau

We had 2 set of defines for the same register, so make it one.

---
 drivers/gpu/drm/i915/i915_reg.h      | 18 ++++++++----------
 drivers/gpu/drm/i915/intel_ddi.c     |  2 +-
 drivers/gpu/drm/i915/intel_display.c |  3 +--
 3 files changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -10
index 7348755..5a0cd52 100644
@@ -4114,13 +4114,14 @@
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
 #define  ILK_DPARB_GATE	(1<<22)
 #define  ILK_VSDPFD_FULL	(1<<21)
-#define ILK_DISPLAY_CHICKEN_FUSES	0x42014
-#define  ILK_INTERNAL_GRAPHICS_DISABLE	(1<<31)
-#define  ILK_INTERNAL_DISPLAY_DISABLE	(1<<30)
-#define  ILK_DISPLAY_DEBUG_DISABLE	(1<<29)
-#define  ILK_HDCP_DISABLE		(1<<25)
-#define  ILK_eDP_A_DISABLE		(1<<24)
-#define  ILK_DESKTOP			(1<<23)
+#define FUSE_STRAP			0x42014
+#define  ILK_INTERNAL_GRAPHICS_DISABLE	(1 << 31)
+#define  ILK_INTERNAL_DISPLAY_DISABLE	(1 << 30)
+#define  ILK_DISPLAY_DEBUG_DISABLE	(1 << 29)
+#define  ILK_HDCP_DISABLE		(1 << 25)
+#define  ILK_eDP_A_DISABLE		(1 << 24)
+#define  HSW_CDCLK_LIMIT		(1 << 24)
+#define  ILK_DESKTOP			(1 << 23)
 
 #define ILK_DSPCLK_GATE_D			0x42020
 #define   ILK_VRHUNIT_CLOCK_GATE_DISABLE	(1 << 28)
@@ -4172,9 +4173,6 @@
 #define HSW_SCRATCH1				0xb038
 #define  HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE	(1<<27)
 
-#define HSW_FUSE_STRAP		0x42014
-#define  HSW_CDCLK_LIMIT	(1 << 24)
-
 /* PCH */
 
 /* south display engine interrupt: IBX */
drivers/gpu/drm/i915/intel_ddi.c +1 -1
index c8a5fb7..6800130 100644
@@ -1249,7 +1249,7 @@ int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
 
 	if (lcpll & LCPLL_CD_SOURCE_FCLK) {
 		return 800000;
-	} else if (I915_READ(HSW_FUSE_STRAP) & HSW_CDCLK_LIMIT) {
+	} else if (I915_READ(FUSE_STRAP) & HSW_CDCLK_LIMIT) {
 		return 450000;
 	} else if (freq == LCPLL_CLK_FREQ_450) {
 		return 450000;
drivers/gpu/drm/i915/intel_display.c +1 -2
index 4d0b35a..1577a7e 100644
@@ -10216,8 +10216,7 @@ static bool has_edp_a(struct drm_device *dev)
 	if ((I915_READ(DP_A) & DP_DETECTED) == 0)
 		return false;
 
-	if (IS_GEN5(dev) &&
-	    (I915_READ(ILK_DISPLAY_CHICKEN_FUSES) & ILK_eDP_A_DISABLE))
+	if (IS_GEN5(dev) && (I915_READ(FUSE_STRAP) & ILK_eDP_A_DISABLE))
 		return false;
 
 	return true;
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/7 drm/i915: Disable display when fused off

In reply to Damien Lespiau

FUSE_STRAP has a bit to inform us that the display has been fused off. Use it to setup the definitive number of pipes at run-time.

---
 drivers/gpu/drm/i915/i915_dma.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +18 -1
index cd22ec6..88bc0c2 100644
@@ -1456,14 +1456,31 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv)
  *   - it's judged too laborious to fill n static structures with the limit
  *     when a simple if statement does the job,
  *   - run-time checks (eg read fuse/strap registers) are needed.
+ *
+ * This function needs to be called after the MMIO has been setup as we are
+ * reading registers, and before the first usage of the fields it can tweak.
  */
 static void intel_device_info_runtime_init(struct drm_device *dev)
 {
-	struct intel_device_info *info = INTEL_INFO(dev);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_device_info *info = &dev_priv->info;
+	u32 fuse_strap;
 
 	info->num_planes = 1;
 	if (IS_VALLEYVIEW(dev))
 		info->num_planes = 2;
+
+	/*
+	 * FUSE_STRAP exists since ILK, but we haven't seen a fused out display
+	 * before IVB.
+	 */
+	if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev)) {
+		fuse_strap = I915_READ(FUSE_STRAP);
+		if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE) {
+			DRM_DEBUG_DRIVER("Display fused off, disabling\n");
+			info->num_planes = 0;
+		}
+	}
 }
 
 /**
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v2 4/7 drm/i915: Disable display when fused off

FUSE_STRAP has a bit to inform us that the display has been fused off. Use it to setup the definitive number of pipes at run-time.

v2: actually tweak num_pipes, not num_planes

---
 drivers/gpu/drm/i915/i915_dma.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +18 -1
index cd22ec6..3e9828c 100644
@@ -1456,14 +1456,31 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv)
  *   - it's judged too laborious to fill n static structures with the limit
  *     when a simple if statement does the job,
  *   - run-time checks (eg read fuse/strap registers) are needed.
+ *
+ * This function needs to be called after the MMIO has been setup as we are
+ * reading registers, and before the first usage of the fields it can tweak.
  */
 static void intel_device_info_runtime_init(struct drm_device *dev)
 {
-	struct intel_device_info *info = INTEL_INFO(dev);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_device_info *info = &dev_priv->info;
+	u32 fuse_strap;
 
 	info->num_planes = 1;
 	if (IS_VALLEYVIEW(dev))
 		info->num_planes = 2;
+
+	/*
+	 * FUSE_STRAP exists since ILK, but we haven't seen a fused out display
+	 * before IVB.
+	 */
+	if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev)) {
+		fuse_strap = I915_READ(FUSE_STRAP);
+		if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE) {
+			DRM_DEBUG_DRIVER("Display fused off, disabling\n");
+			info->num_pipes = 0;
+		}
+	}
 }
 
 /**
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH 5/7 drm/i915: Support fused off pipe C configurations

In reply to Damien Lespiau

Starting from IVB, pipe C can be fused off. We have yet to see such configuration in the wild though (ie not tested).

---
 drivers/gpu/drm/i915/i915_dma.c | 4 ++++
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +4 -0
index 88bc0c2..3af79e3 100644
@@ -1480,6 +1480,10 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 			DRM_DEBUG_DRIVER("Display fused off, disabling\n");
 			info->num_planes = 0;
 		}
+		if (fuse_strap & IVB_PIPE_C_DISABLE) {
+			DRM_DEBUG_DRIVER("Pipe C fused off, disabling\n");
+			info->num_planes = 2;
+		}
 	}
 }
 
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 5a0cd52..9e127b2 100644
@@ -4118,6 +4118,7 @@
 #define  ILK_INTERNAL_GRAPHICS_DISABLE	(1 << 31)
 #define  ILK_INTERNAL_DISPLAY_DISABLE	(1 << 30)
 #define  ILK_DISPLAY_DEBUG_DISABLE	(1 << 29)
+#define  IVB_PIPE_C_DISABLE		(1 << 28)
 #define  ILK_HDCP_DISABLE		(1 << 25)
 #define  ILK_eDP_A_DISABLE		(1 << 24)
 #define  HSW_CDCLK_LIMIT		(1 << 24)
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v2 5/7 drm/i915: Support fused off pipe C configurations

Starting from IVB, pipe C can be fused off. We have yet to see such configuration in the wild though (ie not tested).

v2: Actually tweak num_pipes, not num_planes.

---
 drivers/gpu/drm/i915/i915_dma.c | 4 ++++
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +4 -0
index 3e9828c..6d39f94 100644
@@ -1480,6 +1480,10 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 			DRM_DEBUG_DRIVER("Display fused off, disabling\n");
 			info->num_pipes = 0;
 		}
+		if (fuse_strap & IVB_PIPE_C_DISABLE) {
+			DRM_DEBUG_DRIVER("Pipe C fused off, disabling\n");
+			info->num_pipes = 2;
+		}
 	}
 }
 
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 5a0cd52..9e127b2 100644
@@ -4118,6 +4118,7 @@
 #define  ILK_INTERNAL_GRAPHICS_DISABLE	(1 << 31)
 #define  ILK_INTERNAL_DISPLAY_DISABLE	(1 << 30)
 #define  ILK_DISPLAY_DEBUG_DISABLE	(1 << 29)
+#define  IVB_PIPE_C_DISABLE		(1 << 28)
 #define  ILK_HDCP_DISABLE		(1 << 25)
 #define  ILK_eDP_A_DISABLE		(1 << 24)
 #define  HSW_CDCLK_LIMIT		(1 << 24)
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 6/7 drm/i915: Remove the Quanta special case

In reply to Damien Lespiau

We now read out the FUSE_STRAP register, looking for configurations with display fused off. Let's remove the Quanta special case and rely on the programmed fuses to set num_pipes to 0.

This patch is untested.

---
 drivers/gpu/drm/i915/i915_drv.c | 13 -------------
 include/drm/i915_pciids.h       |  9 ---------
 2 files changed, 22 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -13
index 65b5c83..b12b180 100644
@@ -295,12 +295,6 @@ static const struct intel_device_info intel_ivybridge_m_info = {
 	.is_mobile = 1,
 };
 
-static const struct intel_device_info intel_ivybridge_q_info = {
-	GEN7_FEATURES,
-	.is_ivybridge = 1,
-	.num_pipes = 0, /* legal, last one wins */
-};
-
 static const struct intel_device_info intel_valleyview_m_info = {
 	GEN7_FEATURES,
 	.is_mobile = 1,
@@ -355,12 +349,6 @@ static const struct intel_device_info intel_broadwell_m_info = {
 	.has_ddi = 1,
 };
 
-/*
- * Make sure any device matches here are from most specific to most
- * general.  For example, since the Quanta match is based on the subsystem
- * and subvendor IDs, we need it to come before the more general IVB
- * PCI ID matches, otherwise we'll use the wrong info struct above.
- */
 #define INTEL_PCI_IDS \
 	INTEL_I830_IDS(&intel_i830_info),	\
 	INTEL_I845G_IDS(&intel_845g_info),	\
@@ -380,7 +368,6 @@ static const struct intel_device_info intel_broadwell_m_info = {
 	INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),	\
 	INTEL_SNB_D_IDS(&intel_sandybridge_d_info),	\
 	INTEL_SNB_M_IDS(&intel_sandybridge_m_info),	\
-	INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */ \
 	INTEL_IVB_M_IDS(&intel_ivybridge_m_info),	\
 	INTEL_IVB_D_IDS(&intel_ivybridge_d_info),	\
 	INTEL_HSW_D_IDS(&intel_haswell_d_info), \
include/drm/i915_pciids.h +0 -9
index 940ece4..02ebb67 100644
@@ -41,12 +41,6 @@
 	0x030000, 0xff0000,			\
 	(unsigned long) info }
 
-#define INTEL_QUANTA_VGA_DEVICE(info) {		\
-	0x8086,	0x16a,				\
-	0x152d,	0x8990,				\
-	0x030000, 0xff0000,			\
-	(unsigned long) info }
-
 #define INTEL_I830_IDS(info)				\
 	INTEL_VGA_DEVICE(0x3577, info)
 
@@ -131,9 +125,6 @@
 	INTEL_VGA_DEVICE(0x015a, info), /* GT1 server */ \
 	INTEL_VGA_DEVICE(0x016a, info)  /* GT2 server */
 
-#define INTEL_IVB_Q_IDS(info) \
-	INTEL_QUANTA_VGA_DEVICE(info) /* Quanta transcode */
-
 #define INTEL_HSW_D_IDS(info) \
 	INTEL_VGA_DEVICE(0x0402, info), /* GT1 desktop */ \
 	INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH 7/7 drm/i915: Use I915_MAX_PIPES in the pipe/plane_to_crtc_mapping definitions

In reply to Damien Lespiau
---
 drivers/gpu/drm/i915/i915_drv.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 8a3e5cd..85d126e 100644
@@ -1436,8 +1436,8 @@ typedef struct drm_i915_private {
 
 	struct sdvo_device_mapping sdvo_mappings[2];
 
-	struct drm_crtc *plane_to_crtc_mapping[3];
-	struct drm_crtc *pipe_to_crtc_mapping[3];
+	struct drm_crtc *plane_to_crtc_mapping[I915_MAX_PIPES];
+	struct drm_crtc *pipe_to_crtc_mapping[I915_MAX_PIPES];
 	wait_queue_head_t pending_flip_queue;
 
 #ifdef CONFIG_DEBUG_FS
Signature · 1 line
1.8.3.1
#10 lore raw
In reply to Damien Lespiau
Quoted 3 lines · Damien Lespiau

A while ago, Ben added support for Quanta devices that had the display hardware fused off. We can a bit more general than that by reading the FUSE_STRAP register and setting num_pipes to 0 when detecting such condition.

I'm an idiot and relied on auto-completion that completed num_ to num_planes instead of num_pipes... v2 to follow...

Signature · 1 line
Damien
#11 lore raw
In reply to Damien Lespiau
Quoted 11 lines · Damien Lespiau

A while ago, Ben added support for Quanta devices that had the display hardware fused off. We can a bit more general than that by reading the FUSE_STRAP register and setting num_pipes to 0 when detecting such condition.

To achieve that, the intel_device_info structure in dev_priv needed to be made writable, that's patch 1.

Patches 2 to 5 build the support for reading out FUSE_STRAP on IVB+, client platforms only to detect both "display fused off" and "pipe C fused off" configurations.

Quoted 7 lines

Patch 6 removes the Quanta special-case with the (reasonable) hope that it's now covered by the DISPLAY_DISABLE bit.

Patch 7 is a bonus, somewhat unrelated, little clean-up patch.

This series is not tested due to lack of such a device, I was hoping Ben still had the device around somewhere and could give this series a go.

Patches look fine. Just relying on fuse registers being correct is like relying on vbt being correct, fraught with anxiety.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#12 lore raw
Quoted 2 lines · Chris Wilson

Patches look fine. Just relying on fuse registers being correct is like relying on vbt being correct, fraught with anxiety.

Well, I believe those bits are directly reflecting the fuses/straps programmed (the sames that will actually disable hw), so it should be better than VBT. On the other hand, that's the reason why I only check from IVB on and not from ILK to not take unecessary risks on platforms with no known fused config.

In any case, if someone with such a device could test the series :)

Signature · 1 line
Damien
#13 lore raw
Quoted 9 lines · Damien Lespiau
Quoted 2 lines · Chris Wilson

Patches look fine. Just relying on fuse registers being correct is like relying on vbt being correct, fraught with anxiety.

Well, I believe those bits are directly reflecting the fuses/straps programmed (the sames that will actually disable hw), so it should be better than VBT. On the other hand, that's the reason why I only check from IVB on and not from ILK to not take unecessary risks on platforms with no known fused config.

I'm surprised by this. We had a semi-lengthy mail on the matter internally, and ISTR there was no way to actually make this work for all cases. I guess I need to go re-read that.

Quoted 2 lines

In any case, if someone with such a device could test the series :)

IMHO the patches can't be merged until it can be verified. If you want to call that a nak-until-then on patch 6, do. I'd much rather have a dynamic solution like this though.

Quoted 3 lines
Signature · 2 lines
-- 
Damien
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#14 lore raw
Quoted 11 lines · Ben Widawsky
Quoted 9 lines · Damien Lespiau
Quoted 2 lines · Chris Wilson

Patches look fine. Just relying on fuse registers being correct is like relying on vbt being correct, fraught with anxiety.

Well, I believe those bits are directly reflecting the fuses/straps programmed (the sames that will actually disable hw), so it should be better than VBT. On the other hand, that's the reason why I only check from IVB on and not from ILK to not take unecessary risks on platforms with no known fused config.

Quoted 3 lines

I'm surprised by this. We had a semi-lengthy mail on the matter internally, and ISTR there was no way to actually make this work for all cases. I guess I need to go re-read that.

Oh? I must have missed it or it wasn't broadcasted. Mind digging out the thread again?

Quoted 5 lines
Quoted 1 line

In any case, if someone with such a device could test the series :)

IMHO the patches can't be merged until it can be verified. If you want to call that a nak-until-then on patch 6, do. I'd much rather have a dynamic solution like this though.

Yes, of course! (I'd like to have the writable info in any case).

Signature · 1 line
Damien