Subject: Re: Current suspend issues on Lenovo X200

From: Jesse Barnes <[email-masked]>
Date: Fri, 24 Oct 2008 11:23:17 -0700

On Friday, October 24, 2008 7:28 am Andres Freund wrote:
> Hi Nico,
>
> On Thursday 23 October 2008 22:43:26 Nico -telmich- Schottelius wrote:
> >  - 2.6.27-next-20081023:
> >    -> no X running (because xorg does not work with that kernel)
>
> I think what you need is one rather short fix for the intel xorg driver:
>
> diff --git a/src/i830_driver.c b/src/i830_driver.c
> index c1d61f4..eaf5d27 100644
> --- a/src/i830_driver.c
> +++ b/src/i830_driver.c
> @@ -502,8 +502,8 @@ I830DetectMemory(ScrnInfoPtr pScrn)
>     range = gtt_size + 4;
>
>     /* new 4 series hardware has seperate GTT stolen with GFX stolen */
> - if (IS_G4X(pI830))
> - range = 0;
> + if (IS_G4X(pI830) || IS_GM45(pI830))
> + range = 4;
>
>     if (IS_I85X(pI830) || IS_I865G(pI830) || IS_I9XX(pI830)) {
>        switch (gmch_ctrl & I855_GMCH_GMS_MASK) {
>
> (Out of the "[git pull] agp patches for 2.6.28-rc1" thread)

Something like this might also help.

G4x chips do their own memory arbitration management, so we shouldn't trying
to save/restore the DSPARB reg.

Jesse

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f20ffe1..6ba8712 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -657,6 +657,9 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
 
 #define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_GM45(dev) || IS_G4X(dev))
 
+/* dsparb controlled by hw only */
+#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_GM45(dev))
+
 #define PRIMARY_RINGBUFFER_SIZE         (128*1024)
 
 #endif
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 603fe74..4bea6ea 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -241,7 +241,8 @@ int i915_save_state(struct drm_device *dev)
 	pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
 
 	/* Display arbitration control */
-	dev_priv->saveDSPARB = I915_READ(DSPARB);
+	if (!DSPARB_HWCONTROL(dev))
+		dev_priv->saveDSPARB = I915_READ(DSPARB);
 
 	/* Pipe & plane A info */
 	dev_priv->savePIPEACONF = I915_READ(PIPEACONF);
@@ -365,7 +366,8 @@ int i915_restore_state(struct drm_device *dev)
 
 	pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);
 
-	I915_WRITE(DSPARB, dev_priv->saveDSPARB);
+	if (!DSPARB_HWCONTROL(dev))
+		I915_WRITE(DSPARB, dev_priv->saveDSPARB);
 
 	/* Pipe & plane A info */
 	/* Prime the clock */