]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Clear flushing lists on GPU reset
authorChris Wilson <chris@chris-wilson.co.uk>
Sun, 19 Sep 2010 11:21:28 +0000 (12:21 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 21 Sep 2010 10:19:52 +0000 (11:19 +0100)
Owain Ainsworth noticed that the reset code failed to clear the flushing
list leaving the driver in an inconsistent state following a hung GPU.

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 e58e91736f81872693cdc824761ffa609ec7affc..cb1ddc6af6a6351df1494e57ba319f4a4f6af43a 100644 (file)
@@ -385,6 +385,12 @@ int i965_reset(struct drm_device *dev, u8 flags)
         */
        i915_gem_retire_requests(dev);
 
+       /* Remove anything from the flushing lists. The GPU cache is likely
+        * to be lost on reset along with the data, so simply move the
+        * lost bo to the inactive list.
+        */
+       i915_gem_reset_flushing_list(dev);
+
        /*
         * Set the domains we want to reset (GRDOM/bits 2 and 3) as
         * well as the reset bit (GR/bit 0).  Setting the GR bit
index ed09846fac7b24568e8253bb1aa904c26b351b4a..50fcb91218e8efc826ee376ef6816acf6b28fbc8 100644 (file)
@@ -997,6 +997,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_flushing_list(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 cf2765529cfef5193999503b8fe4753f38ac76f0..4e978e4044a3b81e6ae0f35af8fc171bc2684c41 100644 (file)
@@ -1683,6 +1683,22 @@ i915_get_gem_seqno(struct drm_device *dev,
        return ring->get_gem_seqno(dev, ring);
 }
 
+void i915_gem_reset_flushing_list(struct drm_device *dev)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+
+       while (!list_empty(&dev_priv->mm.flushing_list)) {
+               struct drm_i915_gem_object *obj_priv;
+
+               obj_priv = list_first_entry(&dev_priv->mm.flushing_list,
+                                           struct drm_i915_gem_object,
+                                           list);
+
+               obj_priv->base.write_domain = 0;
+               i915_gem_object_move_to_inactive(&obj_priv->base);
+       }
+}
+
 /**
  * This function clears the request list as sequence numbers are passed.
  */