summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Widawsky <benjamin.widawsky@intel.com>2015-01-19 19:19:55 -0800
committerBen Widawsky <benjamin.widawsky@intel.com>2015-01-19 19:19:55 -0800
commit30b46eace34358c2742c9722a9342ae6905714cc (patch)
tree710ea2b3279ae6fdbc52f2119bd75df6865dfca7
parentb47ab76b11efeabf5307c979fa8f2b88d9f38615 (diff)
free shortcutbraswell+wbinvd
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h2
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e48111353b12..c6ce2c5f855d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1937,6 +1937,8 @@ struct drm_i915_gem_object_ops {
struct drm_i915_gem_object {
struct drm_gem_object base;
+ bool dying;
+
const struct drm_i915_gem_object_ops *ops;
/** List of VMAs backed by this object */
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 5d80924409ba..62bd3e1c2a4b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -98,7 +98,6 @@ is_cpu_flush_required(struct drm_i915_gem_object *obj)
return !cpu_cache_is_coherent(obj->base.dev, obj->cache_level);
}
-
static inline void i915_gem_object_fence_lost(struct drm_i915_gem_object *obj)
{
if (obj->tiling_mode)
@@ -2017,6 +2016,16 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
BUG_ON(obj->madv == __I915_MADV_PURGED);
+ if (obj->dying) {
+ ret = i915_gem_object_wait_rendering(obj, false);
+ if (ret) {
+ DRM_ERROR("dsjfhksdjf\n");
+ return;
+ }
+ i915_gem_object_retire(obj);
+ goto out;
+ }
+
ret = i915_gem_object_set_to_cpu_domain(obj, true);
if (ret) {
/* In the event of a disaster, abandon all caches and
@@ -2044,6 +2053,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
page_cache_release(page);
}
+out:
obj->dirty = 0;
sg_free_table(obj->pages);
@@ -4530,6 +4540,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
trace_i915_gem_object_destroy(obj);
+ obj->dying = true;
+
list_for_each_entry_safe(vma, next, &obj->vma_list, vma_link) {
int ret;