[Intel-gfx] [PATCH][drm/i915] restore HWS_PGA if resuming from suspend

Li Peng peng.li at linux.intel.com
Tue Nov 18 03:44:20 CET 2008


On Mon, 2008-11-17 at 10:26 -0800, Eric Anholt wrote:
> On Mon, 2008-11-17 at 18:14 +0800, Li Peng wrote:
> > This patch restore HWS_PGA for device who don't use gtt mapped hardware
> > status page.
> > It is to fix the suspend/resume failure of xf86-video-intel dri2 branch
> > on 945GME, as the dri2 branch doesn't call I830Resume() to restore
> > hardware status page anymore and we need to handle this in
> > i915_gem_entervt_ioctl()
> 
> This should also be saved/restored in i915_suspend.c so that it works
> correctly in the absence of the X Server doing the enter/leavevt path.
> 
Yes, It is better to do this in i915_save_state()/i915_restore_state(),
here is the updated patch and works well 
on 945GME.

Peng

diff --git a/drivers/gpu/drm/i915/i915_drv.h
b/drivers/gpu/drm/i915/i915_drv.h
index 42d79f7..05c470e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -158,6 +158,7 @@ typedef struct drm_i915_private {
 	u32 saveDSPBCNTR;
 	u32 saveDSPARB;
 	u32 saveRENDERSTANDBY;
+	u32 saveHWS;
 	u32 savePIPEACONF;
 	u32 savePIPEBCONF;
 	u32 savePIPEASRC;
diff --git a/drivers/gpu/drm/i915/i915_suspend.c
b/drivers/gpu/drm/i915/i915_suspend.c
index 5ddc6e5..5d84027 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -244,6 +244,9 @@ int i915_save_state(struct drm_device *dev)
 	if (IS_I965G(dev) && IS_MOBILE(dev))
 		dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY);
 
+	/* Hardware status page */
+	dev_priv->saveHWS = I915_READ(HWS_PGA);
+
 	/* Display arbitration control */
 	dev_priv->saveDSPARB = I915_READ(DSPARB);
 
@@ -373,6 +376,9 @@ int i915_restore_state(struct drm_device *dev)
 	if (IS_I965G(dev) && IS_MOBILE(dev))
 		I915_WRITE(MCHBAR_RENDER_STANDBY, dev_priv->saveRENDERSTANDBY);
 
+	/* Hardware status page */
+	I915_WRITE(HWS_PGA, dev_priv->saveHWS);
+
 	/* Display arbitration */
 	I915_WRITE(DSPARB, dev_priv->saveDSPARB);
 
> > Peng
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c
> > b/drivers/gpu/drm/i915/i915_gem.c
> > index a15b098..b6b451a 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -2924,8 +2924,13 @@ i915_gem_init_hws(struct drm_device *dev)
> >  	/* If we need a physical address for the status page, it's already
> >  	 * initialized at driver load time.
> >  	 */
> > -	if (!I915_NEED_GFX_HWS(dev))
> > +	if (!I915_NEED_GFX_HWS(dev)) {
> > +		if (dev_priv->mm.suspended) {
> > +			I915_WRITE(HWS_PGA, dev_priv->dma_status_page);
> > +			I915_READ(HWS_PGA); /* posting read */
> > +		}
> >  		return 0;
> > +	}
> >  
> >  	obj = drm_gem_object_alloc(dev, 4096);
> >  	if (obj == NULL) {
> > 
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx




More information about the Intel-gfx mailing list