@@ -2461,13 +2461,15 @@ i915_gem_object_flush_fence(struct drm_i915_gem_object *obj,
obj->fenced_gpu_access = false;
}
+ if (obj->last_fenced_seqno &&
+ ring_passed_seqno(obj->ring, obj->last_fenced_seqno))
+ obj->last_fenced_seqno = 0;
+
if (obj->last_fenced_seqno && pipelined != obj->ring) {
- if (!ring_passed_seqno(obj->ring, obj->last_fenced_seqno)) {
- ret = i915_wait_request(obj->ring,
- obj->last_fenced_seqno);
- if (ret)
- return ret;
- }
+ ret = i915_wait_request(obj->ring,
+ obj->last_fenced_seqno);
+ if (ret)
+ return ret;
obj->last_fenced_seqno = 0;
}
@@ -2586,9 +2588,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
if (ret)
return ret;
- if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
- pipelined = NULL;
-
goto update;
}
@@ -2606,9 +2605,12 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
reg->setup_ring = NULL;
}
} else if (obj->last_fenced_seqno && obj->ring != pipelined) {
- ret = i915_gem_object_flush_fence(obj, pipelined);
+ ret = i915_wait_request(obj->ring,
+ obj->last_fenced_seqno);
if (ret)
return ret;
+
+ obj->last_fenced_seqno = 0;
}
return 0;
@@ -2648,15 +2650,18 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
old->last_fenced_seqno);
}
+ obj->last_fenced_seqno = old->last_fenced_seqno;
drm_gem_object_unreference(&old->base);
- } else if (obj->last_fenced_seqno == 0)
- pipelined = NULL;
+ }
reg->obj = obj;
list_move_tail(®->lru_list, &dev_priv->mm.fence_list);
obj->fence_reg = reg - dev_priv->fence_regs;
update:
+ if (obj->last_fenced_seqno == 0)
+ pipelined = NULL;
+
reg->setup_seqno =
pipelined ? i915_gem_next_request_seqno(pipelined) : 0;
reg->setup_ring = pipelined;