drm/i915: Clear fence registers on GPU reset
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 30 Sep 2010 15:53:18 +0000 (16:53 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 Oct 2010 13:45:22 +0000 (14:45 +0100)
When the GPU is reset, the fence registers are invalidated, so release
the objects and clear them out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c

index 2184d29e7a9fc361cc7a14721b16c3c62f0f3e7d..2109537d1b90f99b51d01c5299697b439e222ca5 100644 (file)
@@ -395,7 +395,7 @@ int i915_reset(struct drm_device *dev, u8 flags)
 
        mutex_lock(&dev->struct_mutex);
 
-       i915_gem_reset_lists(dev);
+       i915_gem_reset(dev);
 
        /*
         * Set the domains we want to reset (GRDOM/bits 2 and 3) as
index 7cfbc0fbd9523dbb98d34e63a544d8a40027d5b5..d19a26af3f8e4250aed07e21a71ad5130ee10894 100644 (file)
@@ -1033,7 +1033,7 @@ int i915_gem_object_get_fence_reg(struct drm_gem_object *obj,
 int i915_gem_object_put_fence_reg(struct drm_gem_object *obj,
                                  bool interruptible);
 void i915_gem_retire_requests(struct drm_device *dev);
-void i915_gem_reset_lists(struct drm_device *dev);
+void i915_gem_reset(struct drm_device *dev);
 void i915_gem_clflush_object(struct drm_gem_object *obj);
 int i915_gem_object_set_domain(struct drm_gem_object *obj,
                               uint32_t read_domains,
index c033c5a2e9fc9bc78c20c68737378a19607a99b5..db9d36fb588356400174af9e39cd7351c02d6d69 100644 (file)
@@ -1826,10 +1826,11 @@ static void i915_gem_reset_ring_lists(struct drm_i915_private *dev_priv,
        }
 }
 
-void i915_gem_reset_lists(struct drm_device *dev)
+void i915_gem_reset(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct drm_i915_gem_object *obj_priv;
+       int i;
 
        i915_gem_reset_ring_lists(dev_priv, &dev_priv->render_ring);
        if (HAS_BSD(dev))
@@ -1858,6 +1859,17 @@ void i915_gem_reset_lists(struct drm_device *dev)
        {
                obj_priv->base.read_domains &= ~I915_GEM_GPU_DOMAINS;
        }
+
+       /* The fence registers are invalidated so clear them out */
+       for (i = 0; i < 16; i++) {
+               struct drm_i915_fence_reg *reg;
+
+               reg = &dev_priv->fence_regs[i];
+               if (!reg->obj)
+                       continue;
+
+               i915_gem_clear_fence_reg(reg->obj);
+       }
 }
 
 /**