[Intel-gfx] [PATCH] i915: Restore fence registers on resume

Eric Anholt eric at anholt.net
Mon May 4 22:07:04 CEST 2009


On Mon, 2009-05-04 at 15:59 -0400, Kristian Høgsberg wrote:
> From: Kristian Høgsberg <krh at redhat.com>
> 
> Buffers that stay pinned during suspend/resume need to have their
> fence registers rewritten when we come back from resume.
> 
> Signed-off-by: Kristian Høgsberg <krh at redhat.com>

I'd already pulled one for this from keithp.

commit 79f11c19a396e8cea7dad322dcfb46c0a8517fe6
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Apr 30 14:43:44 2009 -0700

    drm/i915: save/restore fence registers across suspend/resume
    
    This makes software fallbacks not do tiling wrong on i965 and later after
    resume. It also should fix 945 performance reduction after resume which
    would have disabled tiling without causing any visible effect.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    [anholt: Fixed up the 915 case to not save/restore the new regs]
    Signed-off-by: Eric Anholt <eric at anholt.net>


> ---
>  drivers/gpu/drm/i915/i915_drv.c |    2 ++
>  drivers/gpu/drm/i915/i915_drv.h |    1 +
>  drivers/gpu/drm/i915/i915_gem.c |   26 ++++++++++++++++++++++++++
>  3 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index b293ef0..a77d7f1 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -111,6 +111,8 @@ static int i915_resume(struct drm_device *dev)
>  			ret = -1;
>  		mutex_unlock(&dev->struct_mutex);
>  
> +		i915_gem_restore_fences(dev);
> +			
>  		drm_irq_install(dev);
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index d6cc986..2c9faa7 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -632,6 +632,7 @@ int i915_gem_attach_phys_object(struct drm_device *dev,
>  void i915_gem_detach_phys_object(struct drm_device *dev,
>  				 struct drm_gem_object *obj);
>  void i915_gem_free_all_phys_object(struct drm_device *dev);
> +int i915_gem_restore_fences(struct drm_device *dev);
>  
>  /* i915_gem_tiling.c */
>  void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index fb6390a..2b36a32 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1708,6 +1708,32 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj)
>  	obj_priv->fence_reg = I915_FENCE_REG_NONE;
>  }
>  
> +int
> +i915_gem_restore_fences(struct drm_device *dev)
> +{
> +	drm_i915_private_t *dev_priv = dev->dev_private;
> +	struct drm_i915_fence_reg *reg;
> +	int i, count, ret = 0;
> +
> +	for (i = dev_priv->fence_reg_start;
> +	     i < dev_priv->num_fence_regs; i++) {
> +		reg = &dev_priv->fence_regs[i];
> +		if (!reg->obj)
> +			continue;
> +
> +		count++;
> +		if (IS_I965G(dev))
> +			i965_write_fence_reg(reg);
> +		else if (IS_I9XX(dev))
> +			i915_write_fence_reg(reg);
> +		else
> +			i830_write_fence_reg(reg);
> +	}
> +
> +	if (count > 0)
> +		DRM_DEBUG("restored %d fence regs\n", count);
> +}
> +
>  /**
>   * Finds free space in the GTT aperture and binds the object there.
>   */
-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090504/06a2e78e/attachment.sig>


More information about the Intel-gfx mailing list