Skip to content

Commit a314d5c

Browse files
committed
drm/i915: Before accessing an object via the cpu, flush GTT writes
If we want to read the pages directly via the CPU, we have to be sure that we have to flush the writes via the GTT (as the CPU can not see the address aliasing). Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Joonas Lahtinen <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 43394c7 commit a314d5c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
622622
if (ret)
623623
return ret;
624624

625+
i915_gem_object_flush_gtt_write_domain(obj);
626+
625627
/* If we're not in the cpu read domain, set ourself into the gtt
626628
* read domain and manually flush cachelines (if required). This
627629
* optimizes for the case when the gpu will dirty the data
@@ -662,6 +664,8 @@ int i915_gem_obj_prepare_shmem_write(struct drm_i915_gem_object *obj,
662664
if (ret)
663665
return ret;
664666

667+
i915_gem_object_flush_gtt_write_domain(obj);
668+
665669
/* If we're not in the cpu write domain, set ourself into the
666670
* gtt write domain and manually flush cachelines (as required).
667671
* This optimizes for the case when the gpu will use the data

0 commit comments

Comments
 (0)