From mboxrd@z Thu Jan 1 00:00:00 1970 From: John.C.Harrison@Intel.com Subject: [RFC 07/21] drm/i915: Ensure requests stick around during waits Date: Mon, 6 Oct 2014 15:15:11 +0100 Message-ID: <1412604925-11290-8-git-send-email-John.C.Harrison@Intel.com> References: <1412604925-11290-1-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-2-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-3-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-4-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-5-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-6-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-7-git-send-email-John.C.Harrison@Intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 16E50899F3 for ; Mon, 6 Oct 2014 07:15:41 -0700 (PDT) In-Reply-To: <1412604925-11290-7-git-send-email-John.C.Harrison@Intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Intel-GFX@Lists.FreeDesktop.Org List-Id: intel-gfx@lists.freedesktop.org From: John Harrison For: VIZ-4377 Signed-off-by: John.C.Harrison@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