[Intel-gfx] [RFC 07/21] drm/i915: Ensure requests stick around during waits
John.C.Harrison at Intel.com
John.C.Harrison at Intel.com
Mon Oct 6 16:15:11 CEST 2014
From: John Harrison <John.C.Harrison at Intel.com>
For: VIZ-4377
Signed-off-by: John.C.Harrison at Intel.com
---
drivers/gpu/drm/i915/i915_gem.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2c33a83..53b48ad 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1360,9 +1360,11 @@ i915_gem_object_wait_rendering__nonblocking(struct drm_i915_gem_object *obj,
return ret;
reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
+ i915_gem_request_reference(req);
mutex_unlock(&dev->struct_mutex);
ret = __wait_seqno(ring, seqno, reset_counter, true, NULL, file_priv);
mutex_lock(&dev->struct_mutex);
+ i915_gem_request_unreference(req);
if (ret)
return ret;
@@ -2825,6 +2827,7 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_wait *args = data;
struct drm_i915_gem_object *obj;
+ struct drm_i915_gem_request *req;
struct intel_engine_cs *ring = NULL;
unsigned reset_counter;
u32 seqno = 0;
@@ -2845,14 +2848,13 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
if (ret)
goto out;
- if (obj->active) {
- if (!obj->last_read_req)
- goto out;
+ if (!obj->active || !obj->last_read_req)
+ goto out;
- seqno = i915_gem_request_get_seqno(obj->last_read_req);
- BUG_ON(seqno == 0);
- ring = obj->ring;
- }
+ req = obj->last_read_req;
+ seqno = i915_gem_request_get_seqno(req);
+ BUG_ON(seqno == 0);
+ ring = obj->ring;
/* Do this after OLR check to make sure we make forward progress polling
* on this IOCTL with a timeout <=0 (like busy ioctl)
@@ -2864,10 +2866,15 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
drm_gem_object_unreference(&obj->base);
reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
+ i915_gem_request_reference(req);
mutex_unlock(&dev->struct_mutex);
- return __wait_seqno(ring, seqno, reset_counter, true, &args->timeout_ns,
- file->driver_priv);
+ ret = __wait_seqno(ring, seqno, reset_counter, true, &args->timeout_ns,
+ file->driver_priv);
+ mutex_lock(&dev->struct_mutex);
+ i915_gem_request_unreference(req);
+ mutex_unlock(&dev->struct_mutex);
+ return ret;
out:
drm_gem_object_unreference(&obj->base);
--
1.7.9.5
More information about the Intel-gfx
mailing list