Skip to contentSkip to conversation

drm/i915: Delay disabling of VGA memory until vgacon->fbcon handoff is done

PATCH Applied [email protected] 3 participants 3 messages Sep 5, 2013 – Sep 11, 2013

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

PATCH 1/1 drm/i915: Delay disabling of VGA memory until vgacon->fbcon handoff is done

From: Ville Syrjälä <[email protected]>

When transitioning away from vgacon the system tries to save the current contents of the VGA memory, so that it can be cleanly handed off to fbcon (or whatever comes afterwards).

The recent change

commit 81b5c7bc8de3e6f63419139c2fc91bf81dea8a7d
Author: Alex Williamson <[email protected]>
Date: Wed Aug 28 09:39:08 2013 -0600

i915: Update VGA arbiter support for newer devices

caused i915 to disable VGA memory decode for the IGD when i915 is initializing. Unfortunately that happens before the vgacon->fbcon handoff so vgacon_save_screen() will read out all ones from the VGA memory.

After the handoff fbcon will inherit the bogus state from vgacon, and pre-fills the fb with matching contents. The end result is a white rectangle in the top left corner of the screen, the size of which matches the now inactive VGA console.

To remedy the situation delay the disabling of VGA memory until the vgacon->fbcon handoff has happened.

Also rename i915_enable_vga to i915_enable_vga_mem to make the relationship between these functions clearer.

---
 drivers/gpu/drm/i915/i915_dma.c      |  6 ++++++
 drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 23 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +6 -0
index 3de6050..9b265a4 100644
@@ -1351,6 +1351,12 @@ static int i915_load_modeset_init(struct drm_device *dev)
 	 */
 	intel_fbdev_initial_config(dev);
 
+	/*
+	 * Must do this after fbcon init so that
+	 * vgacon_save_screen() works during the handover.
+	 */
+	i915_disable_vga_mem(dev);
+
 	/* Only enable hotplug handling once the fbdev is fully set up. */
 	dev_priv->enable_hotplug_processing = true;
 
drivers/gpu/drm/i915/intel_display.c +16 -11
index bdfe5d2..9837472 100644
@@ -10157,15 +10157,6 @@ static void i915_disable_vga(struct drm_device *dev)
 	outb(SR01, VGA_SR_INDEX);
 	sr1 = inb(VGA_SR_DATA);
 	outb(sr1 | 1<<5, VGA_SR_DATA);
-
-	/* Disable VGA memory on Intel HD */
-	if (HAS_PCH_SPLIT(dev)) {
-		outb(inb(VGA_MSR_READ) & ~VGA_MSR_MEM_EN, VGA_MSR_WRITE);
-		vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO |
-						   VGA_RSRC_NORMAL_IO |
-						   VGA_RSRC_NORMAL_MEM);
-	}
-
 	vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
 	udelay(300);
 
@@ -10173,7 +10164,7 @@ static void i915_disable_vga(struct drm_device *dev)
 	POSTING_READ(vga_reg);
 }
 
-static void i915_enable_vga(struct drm_device *dev)
+static void i915_enable_vga_mem(struct drm_device *dev)
 {
 	/* Enable VGA memory on Intel HD */
 	if (HAS_PCH_SPLIT(dev)) {
@@ -10187,6 +10178,19 @@ static void i915_enable_vga(struct drm_device *dev)
 	}
 }
 
+void i915_disable_vga_mem(struct drm_device *dev)
+{
+	/* Disable VGA memory on Intel HD */
+	if (HAS_PCH_SPLIT(dev)) {
+		vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
+		outb(inb(VGA_MSR_READ) & ~VGA_MSR_MEM_EN, VGA_MSR_WRITE);
+		vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO |
+						   VGA_RSRC_NORMAL_IO |
+						   VGA_RSRC_NORMAL_MEM);
+		vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
+	}
+}
+
 void intel_modeset_init_hw(struct drm_device *dev)
 {
 	intel_init_power_well(dev);
@@ -10465,6 +10469,7 @@ void i915_redisable_vga(struct drm_device *dev)
 	if (I915_READ(vga_reg) != VGA_DISP_DISABLE) {
 		DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
 		i915_disable_vga(dev);
+		i915_disable_vga_mem(dev);
 	}
 }
 
@@ -10669,7 +10674,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
 
 	intel_disable_fbc(dev);
 
-	i915_enable_vga(dev);
+	i915_enable_vga_mem(dev);
 
 	intel_disable_gt_powersave(dev);
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 5b8d5d9..fefb073 100644
@@ -815,5 +815,6 @@ extern void hsw_pc8_restore_interrupts(struct drm_device *dev);
 extern void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv);
 extern void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv);
 extern bool intel_crtc_active(struct drm_crtc *crtc);
+extern void i915_disable_vga_mem(struct drm_device *dev);
 
 #endif /* __INTEL_DRV_H__ */
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 24 lines · On Thu, Sep 05, 2013 at 08:40:52PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

When transitioning away from vgacon the system tries to save the current contents of the VGA memory, so that it can be cleanly handed off to fbcon (or whatever comes afterwards).

The recent change

commit 81b5c7bc8de3e6f63419139c2fc91bf81dea8a7d
Author: Alex Williamson <[email protected]>
Date: Wed Aug 28 09:39:08 2013 -0600

i915: Update VGA arbiter support for newer devices

caused i915 to disable VGA memory decode for the IGD when i915 is initializing. Unfortunately that happens before the vgacon->fbcon handoff so vgacon_save_screen() will read out all ones from the VGA memory.

After the handoff fbcon will inherit the bogus state from vgacon, and pre-fills the fb with matching contents. The end result is a white rectangle in the top left corner of the screen, the size of which matches the now inactive VGA console.

Quoted 8 lines

To remedy the situation delay the disabling of VGA memory until the vgacon->fbcon handoff has happened.

Also rename i915_enable_vga to i915_enable_vga_mem to make the relationship between these functions clearer.

Picked up for -fixes, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw

2013/9/6 Daniel Vetter <[email protected]>:

Quoted 28 lines · On Thu, Sep 05, 2013 at 08:40:52PM +0300, [email protected] wrote:
Quoted 27 lines

From: Ville Syrjälä <[email protected]>

When transitioning away from vgacon the system tries to save the current contents of the VGA memory, so that it can be cleanly handed off to fbcon (or whatever comes afterwards).

The recent change

commit 81b5c7bc8de3e6f63419139c2fc91bf81dea8a7d
Author: Alex Williamson <[email protected]>
Date: Wed Aug 28 09:39:08 2013 -0600

i915: Update VGA arbiter support for newer devices

caused i915 to disable VGA memory decode for the IGD when i915 is initializing. Unfortunately that happens before the vgacon->fbcon handoff so vgacon_save_screen() will read out all ones from the VGA memory.

After the handoff fbcon will inherit the bogus state from vgacon, and pre-fills the fb with matching contents. The end result is a white rectangle in the top left corner of the screen, the size of which matches the now inactive VGA console.

To remedy the situation delay the disabling of VGA memory until the vgacon->fbcon handoff has happened.

Quoted 7 lines
Quoted 5 lines

Also rename i915_enable_vga to i915_enable_vga_mem to make the relationship between these functions clearer.

Picked up for -fixes, thanks for the patch.

This patch causes "Unclaimed register" errors when you boot Haswell with only an eDP output...

Quoted 9 lines

-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni