Commit 2b3c8317 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Stop skipping the final clflush back to system pages

When we release the shmem backing storage, we make sure that the pages
are coherent with the cpu cache. However, our clflush routine was
skipping the flush as the object had no pages at release time. Fix this by
explicitly flushing the sg_table we are decoupling.

Fixes: 03ac84f1 ("drm/i915: Pass around sg_table to get_pages/put_pages backend")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161111145809.9701-2-chris@chris-wilson.co.uk
parent 9caa34aa
...@@ -220,7 +220,8 @@ i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) ...@@ -220,7 +220,8 @@ i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
} }
static void static void
__i915_gem_object_release_shmem(struct drm_i915_gem_object *obj) __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
struct sg_table *pages)
{ {
GEM_BUG_ON(obj->mm.madv == __I915_MADV_PURGED); GEM_BUG_ON(obj->mm.madv == __I915_MADV_PURGED);
...@@ -228,7 +229,7 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj) ...@@ -228,7 +229,7 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj)
obj->mm.dirty = false; obj->mm.dirty = false;
if ((obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0) if ((obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0)
i915_gem_clflush_object(obj, false); drm_clflush_sg(pages);
obj->base.read_domains = I915_GEM_DOMAIN_CPU; obj->base.read_domains = I915_GEM_DOMAIN_CPU;
obj->base.write_domain = I915_GEM_DOMAIN_CPU; obj->base.write_domain = I915_GEM_DOMAIN_CPU;
...@@ -238,7 +239,7 @@ static void ...@@ -238,7 +239,7 @@ static void
i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
struct sg_table *pages) struct sg_table *pages)
{ {
__i915_gem_object_release_shmem(obj); __i915_gem_object_release_shmem(obj, pages);
if (obj->mm.dirty) { if (obj->mm.dirty) {
struct address_space *mapping = obj->base.filp->f_mapping; struct address_space *mapping = obj->base.filp->f_mapping;
...@@ -2150,7 +2151,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj, ...@@ -2150,7 +2151,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj,
struct sgt_iter sgt_iter; struct sgt_iter sgt_iter;
struct page *page; struct page *page;
__i915_gem_object_release_shmem(obj); __i915_gem_object_release_shmem(obj, pages);
i915_gem_gtt_finish_pages(obj, pages); i915_gem_gtt_finish_pages(obj, pages);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment