All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>
Subject: [PATCH 17/17] drm/i915: restore only the mode of this driver on lastclose (v2)
Date: Thu, 21 Apr 2011 22:18:32 +0100	[thread overview]
Message-ID: <1303420712-6369-18-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1303420712-6369-1-git-send-email-chris@chris-wilson.co.uk>

From: Dave Airlie <airlied@redhat.com>

i915 calls the panic handler function on last close to reset the modes,
however this is a really bad idea for multi-gpu machines, esp shareable
gpus machines. So add a new entry point for the driver to just restore
its own fbcon mode.

v2: move code into fb helper, fix panic code to block mode change on
powered off GPUs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_fb_helper.c  |   27 ++++++++++++++++++++-------
 drivers/gpu/drm/i915/i915_dma.c  |    2 +-
 drivers/gpu/drm/i915/intel_drv.h |    1 +
 drivers/gpu/drm/i915/intel_fb.c  |   10 ++++++++++
 include/drm/drm_fb_helper.h      |    1 +
 5 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 9507204..11d7a72 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -342,9 +342,22 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
 }
 EXPORT_SYMBOL(drm_fb_helper_debug_leave);
 
+bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
+{
+	bool error = false;
+	int i, ret;
+	for (i = 0; i < fb_helper->crtc_count; i++) {
+		struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
+		ret = drm_crtc_helper_set_config(mode_set);
+		if (ret)
+			error = true;
+	}
+	return error;
+}
+EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode);
+
 bool drm_fb_helper_force_kernel_mode(void)
 {
-	int i = 0;
 	bool ret, error = false;
 	struct drm_fb_helper *helper;
 
@@ -352,12 +365,12 @@ bool drm_fb_helper_force_kernel_mode(void)
 		return false;
 
 	list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
-		for (i = 0; i < helper->crtc_count; i++) {
-			struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set;
-			ret = drm_crtc_helper_set_config(mode_set);
-			if (ret)
-				error = true;
-		}
+		if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+			continue;
+
+		ret = drm_fb_helper_restore_fbdev_mode(helper);
+		if (ret)
+			error = true;
 	}
 	return error;
 }
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index b28e023..14a234e 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -2220,7 +2220,7 @@ void i915_driver_lastclose(struct drm_device * dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
 	if (!dev_priv || drm_core_check_feature(dev, DRIVER_MODESET)) {
-		drm_fb_helper_restore();
+		intel_fb_restore_mode(dev);
 		vga_switcheroo_process_delayed_switch();
 		return;
 	}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 6b848d9..2e49b62 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -343,4 +343,5 @@ extern int intel_overlay_attrs(struct drm_device *dev, void *data,
 			       struct drm_file *file_priv);
 
 extern void intel_fb_output_poll_changed(struct drm_device *dev);
+extern void intel_fb_restore_mode(struct drm_device *dev);
 #endif /* __INTEL_DRV_H__ */
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 5127827..ec49bae 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -264,3 +264,13 @@ void intel_fb_output_poll_changed(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper);
 }
+
+void intel_fb_restore_mode(struct drm_device *dev)
+{
+	int ret;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+
+	ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
+	if (ret)
+		DRM_DEBUG("failed to restore crtc mode\n");
+}
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index f22e7fe..ade09d7 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -118,6 +118,7 @@ int drm_fb_helper_setcolreg(unsigned regno,
 			    unsigned transp,
 			    struct fb_info *info);
 
+bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
 void drm_fb_helper_restore(void);
 void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
 			    uint32_t fb_width, uint32_t fb_height);
-- 
1.7.4.1

  parent reply	other threads:[~2011-04-21 21:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21 21:18 Pending i915 fixes Chris Wilson
2011-04-21 21:18 ` [PATCH 01/17] drm/i915: Move the irq wait queue initialisation into the ring init Chris Wilson
2011-04-21 22:26   ` Jesse Barnes
2011-04-21 21:18 ` [PATCH 02/17] drm/i915: Disable all outputs early, before KMS takeover Chris Wilson
2011-04-21 21:18 ` [PATCH 03/17] drm/i915: Release object along create user fb error path Chris Wilson
2011-04-22 18:21   ` Ben Widawsky
2011-04-21 21:18 ` [PATCH 04/17] drm/i915/dp: Be paranoid in case we disable a DP before it is attached Chris Wilson
2011-04-21 21:18 ` [PATCH 05/17] drm/i915/tv: Clear state sense detection for Cantiga Chris Wilson
2011-04-21 23:36   ` Eric Anholt
2011-04-22  5:28     ` Chris Wilson
2011-04-22 21:44     ` Peter Clifton
2011-05-20  9:16       ` Niccolò Belli
2011-05-20 10:00         ` Keith Packard
2011-05-20 13:37           ` Niccolò Belli
2011-04-21 21:18 ` [PATCH 06/17] drm/i915: Check that the plane points to the pipe's framebuffer before enabling Chris Wilson
2011-04-21 21:18 ` [PATCH 07/17] drm/i915: Only enable the plane after setting the fb base (pre-ILK) Chris Wilson
2011-04-21 22:27   ` Jesse Barnes
2011-04-21 21:18 ` [PATCH 08/17] drm/i915: Move the tracking of dpms_mode down into crtc enable/disable Chris Wilson
2011-05-04 19:10   ` Keith Packard
2011-05-04 19:40     ` Chris Wilson
2011-05-04 21:20       ` Keith Packard
2011-05-04 21:59         ` Chris Wilson
2011-04-21 21:18 ` [PATCH 09/17] drm/i915: Simplify return value from intel_get_load_detect_pipe Chris Wilson
2011-04-21 21:18 ` [PATCH 10/17] drm/i915: Propagate failure to set mode for load-detect pipe Chris Wilson
2011-04-21 21:18 ` [PATCH 11/17] drm/i915: Don't store temporary load-detect variables in the generic encoder Chris Wilson
2011-04-21 21:18 ` [PATCH 12/17] drm/i915: Remove unused supported_crtc from intel_load_detect_pipe Chris Wilson
2011-04-21 21:18 ` [PATCH 13/17] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc Chris Wilson
2011-04-21 21:18 ` [PATCH 14/17] drm/i915: Remove dead code from intel_get_load_detect_pipe() Chris Wilson
2011-04-21 21:18 ` [PATCH 15/17] drm/i915: Remove dead code from intel_release_load_detect_pipe() Chris Wilson
2011-04-21 21:18 ` [PATCH 16/17] drm/i915: Attach a fb to the load-detect pipe Chris Wilson
2011-04-21 21:18 ` Chris Wilson [this message]
2011-04-21 21:56 ` Pending i915 fixes Keith Packard
2011-04-21 22:01   ` Dave Airlie
2011-04-22  0:06     ` Keith Packard
2011-04-22  5:33       ` Chris Wilson
2011-04-21 22:40   ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303420712-6369-18-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=airlied@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.