[Intel-gfx] [PATCH] drm/i915: Reorder ring reinitialisation round reset

Chris Wilson chris at chris-wilson.co.uk
Mon Jun 10 14:54:50 CEST 2013


In particular, we were reseting our GEM tracking before even attempting
(and failing) to reset the chip. Do it with the other bookkeeping after
successfully reseting. Note that we can simplify the reset to always do
the GPU reinitialisation as for UMS it will simply be redundant in the
case where X was switched away. And that we can safely re-establish all
the features that were setup during initialisation - any that were not
enabled for UMS/DRI1 will not be restored and should still not be enabled.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c |   50 +++++++++++++--------------------------
 1 file changed, 17 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index ac145bb..16c273c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -897,16 +897,15 @@ int intel_gpu_reset(struct drm_device *dev)
 int i915_reset(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
+	struct intel_ring_buffer *ring;
 	bool simulated;
-	int ret;
+	int i, ret;
 
 	if (!i915_try_reset)
 		return 0;
 
 	mutex_lock(&dev->struct_mutex);
 
-	i915_gem_reset(dev);
-
 	simulated = dev_priv->gpu_error.stop_rings != 0;
 
 	if (!simulated && get_seconds() - dev_priv->gpu_error.last_reset < 5) {
@@ -935,38 +934,23 @@ int i915_reset(struct drm_device *dev)
 
 	/* Ok, now get things going again... */
 
-	/*
-	 * Everything depends on having the GTT running, so we need to start
-	 * there.  Fortunately we don't need to do this unless we reset the
-	 * chip at a PCI level.
-	 *
-	 * Next we need to restore the context, but we don't use those
-	 * yet either...
-	 *
-	 * Ring buffer needs to be re-initialized in the KMS case, or if X
-	 * was running at the time of the reset (i.e. we weren't VT
-	 * switched away).
-	 */
-	if (drm_core_check_feature(dev, DRIVER_MODESET) ||
-			!dev_priv->mm.suspended) {
-		struct intel_ring_buffer *ring;
-		int i;
-
-		dev_priv->mm.suspended = 0;
+	i915_gem_init_swizzling(dev);
 
-		i915_gem_init_swizzling(dev);
+	for_each_ring(ring, dev_priv, i) {
+		ret = ring->init(ring);
+		if (ret)
+			goto unlock;
+	}
 
-		for_each_ring(ring, dev_priv, i) {
-			ret = ring->init(ring);
-			if (ret)
-				goto unlock;
-		}
+	i915_gem_reset(dev);
+	i915_gem_context_init(dev);
+	if (dev_priv->mm.aliasing_ppgtt) {
+		if (dev_priv->mm.aliasing_ppgtt->enable(dev))
+			i915_gem_cleanup_aliasing_ppgtt(dev);
+	}
 
-		i915_gem_context_init(dev);
-		if (dev_priv->mm.aliasing_ppgtt) {
-			if (dev_priv->mm.aliasing_ppgtt->enable(dev))
-				i915_gem_cleanup_aliasing_ppgtt(dev);
-		}
+	if (drm_core_check_feature(dev, DRIVER_MODESET))
+		dev_priv->mm.suspended = 0;
 
 		/*
 		 * It would make sense to re-init all the other hw state, at
@@ -974,13 +958,13 @@ int i915_reset(struct drm_device *dev)
 		 * some unknown reason, this blows up my ilk, so don't.
 		 */
 
-unlock:
 		mutex_unlock(&dev->struct_mutex);
 
 		drm_irq_uninstall(dev);
 		drm_irq_install(dev);
 		intel_hpd_init(dev);
 	} else {
+unlock:
 		mutex_unlock(&dev->struct_mutex);
 	}
 
-- 
1.7.10.4




More information about the Intel-gfx mailing list