All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 3/4] drm/i915: Cleanup handling of last_fenced_seqno
Date: Fri, 18 Mar 2011 22:35:18 +0000	[thread overview]
Message-ID: <1300487719-26578-4-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1300487719-26578-1-git-send-email-chris@chris-wilson.co.uk>

Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 5201f82..2dbf8f7 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -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(&reg->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;
-- 
1.7.2.3

  parent reply	other threads:[~2011-03-18 22:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 22:35 Pipelined fence fixes Chris Wilson
2011-03-18 22:35 ` [PATCH 1/4] drm/i915: Track fence setup separately from fenced object lifetime Chris Wilson
2011-03-19 22:35   ` Daniel Vetter
2011-03-19 22:42     ` Chris Wilson
2011-03-19 23:11       ` Daniel Vetter
2011-03-18 22:35 ` [PATCH 2/4] drm/i915: Invalidate fenced read domains upon flush Chris Wilson
2011-03-19 22:49   ` Daniel Vetter
2011-03-18 22:35 ` Chris Wilson [this message]
2011-03-19 22:55   ` [PATCH 3/4] drm/i915: Cleanup handling of last_fenced_seqno Daniel Vetter
2011-03-19 23:09     ` Chris Wilson
2011-03-18 22:35 ` [PATCH 4/4] drm/i915: Prevent fence-reuse stalls Chris Wilson
2011-03-19 22:57   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300487719-26578-4-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=apw@canonical.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.