]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - drivers/gpu/drm/i915/i915_gem.c
drm/i915: Emit a request to clear a flushed and idle ring for unbusy bo
[~shefty/rdma-dev.git] / drivers / gpu / drm / i915 / i915_gem.c
index 5e54821af99691ee139e3170eea00315cc15c750..275ec6ed43ae7dcc4f396322909296e00305c617 100644 (file)
@@ -4374,10 +4374,20 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
                 * use this buffer rather sooner than later, so issuing the required
                 * flush earlier is beneficial.
                 */
-               if (obj->write_domain & I915_GEM_GPU_DOMAINS)
+               if (obj->write_domain & I915_GEM_GPU_DOMAINS) {
                        i915_gem_flush_ring(dev, file_priv,
                                            obj_priv->ring,
                                            0, obj->write_domain);
+               } else if (obj_priv->ring->outstanding_lazy_request) {
+                       /* This ring is not being cleared by active usage,
+                        * so emit a request to do so.
+                        */
+                       u32 seqno = i915_add_request(dev,
+                                                    NULL, NULL,
+                                                    obj_priv->ring);
+                       if (seqno == 0)
+                               ret = -ENOMEM;
+               }
 
                /* Update the active list for the hardware's current position.
                 * Otherwise this only updates on a delayed timer or when irqs