Commit 87ca9c8a authored by Chris Wilson's avatar Chris Wilson

drm/i915: Prevent stalling for a GTT read back from a read-only GPU target

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 257e48f1
...@@ -728,6 +728,12 @@ struct drm_i915_gem_object { ...@@ -728,6 +728,12 @@ struct drm_i915_gem_object {
*/ */
unsigned int dirty : 1; unsigned int dirty : 1;
/**
* This is set if the object has been written to since the last
* GPU flush.
*/
unsigned int pending_gpu_write : 1;
/** /**
* Fence register bits (if any) for this object. Will be set * Fence register bits (if any) for this object. Will be set
* as needed when mapped into the GTT. * as needed when mapped into the GTT.
......
...@@ -1643,6 +1643,7 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj) ...@@ -1643,6 +1643,7 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj)
obj->last_fenced_ring = NULL; obj->last_fenced_ring = NULL;
obj->active = 0; obj->active = 0;
obj->pending_gpu_write = false;
drm_gem_object_unreference(&obj->base); drm_gem_object_unreference(&obj->base);
WARN_ON(i915_verify_lists(dev)); WARN_ON(i915_verify_lists(dev));
...@@ -2810,9 +2811,11 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write) ...@@ -2810,9 +2811,11 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
return -EINVAL; return -EINVAL;
i915_gem_object_flush_gpu_write_domain(obj); i915_gem_object_flush_gpu_write_domain(obj);
ret = i915_gem_object_wait_rendering(obj, true); if (obj->pending_gpu_write || write) {
if (ret) ret = i915_gem_object_wait_rendering(obj, true);
return ret; if (ret)
return ret;
}
i915_gem_object_flush_cpu_write_domain(obj); i915_gem_object_flush_cpu_write_domain(obj);
......
...@@ -775,6 +775,7 @@ i915_gem_execbuffer_move_to_active(struct list_head *objects, ...@@ -775,6 +775,7 @@ i915_gem_execbuffer_move_to_active(struct list_head *objects,
i915_gem_object_move_to_active(obj, ring); i915_gem_object_move_to_active(obj, ring);
if (obj->base.write_domain) { if (obj->base.write_domain) {
obj->dirty = 1; obj->dirty = 1;
obj->pending_gpu_write = true;
list_move_tail(&obj->gpu_write_list, list_move_tail(&obj->gpu_write_list,
&ring->gpu_write_list); &ring->gpu_write_list);
intel_mark_busy(ring->dev, obj); intel_mark_busy(ring->dev, obj);
......
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