public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: oscar.mateo@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 6/8] drm/i915: Generalize ring_space to take a ringbuf
Date: Thu,  3 Jul 2014 16:28:03 +0100	[thread overview]
Message-ID: <1404401285-19918-6-git-send-email-oscar.mateo@intel.com> (raw)
In-Reply-To: <1404401285-19918-1-git-send-email-oscar.mateo@intel.com>

From: Oscar Mateo <oscar.mateo@intel.com>

It's simple enough that it doesn't need to know anything about the
engine.

Trivial change.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index ffdb366..405edec 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -48,9 +48,8 @@ static inline int __ring_space(int head, int tail, int size)
 	return space;
 }
 
-static inline int ring_space(struct intel_engine_cs *ring)
+static inline int ring_space(struct intel_ringbuffer *ringbuf)
 {
-	struct intel_ringbuffer *ringbuf = ring->buffer;
 	return __ring_space(ringbuf->head & HEAD_ADDR, ringbuf->tail, ringbuf->size);
 }
 
@@ -545,7 +544,7 @@ static int init_ring_common(struct intel_engine_cs *ring)
 	else {
 		ringbuf->head = I915_READ_HEAD(ring);
 		ringbuf->tail = I915_READ_TAIL(ring) & TAIL_ADDR;
-		ringbuf->space = ring_space(ring);
+		ringbuf->space = ring_space(ringbuf);
 		ringbuf->last_retired_head = -1;
 	}
 
@@ -1537,7 +1536,7 @@ static int intel_ring_wait_request(struct intel_engine_cs *ring, int n)
 		ringbuf->head = ringbuf->last_retired_head;
 		ringbuf->last_retired_head = -1;
 
-		ringbuf->space = ring_space(ring);
+		ringbuf->space = ring_space(ringbuf);
 		if (ringbuf->space >= n)
 			return 0;
 	}
@@ -1560,7 +1559,7 @@ static int intel_ring_wait_request(struct intel_engine_cs *ring, int n)
 	ringbuf->head = ringbuf->last_retired_head;
 	ringbuf->last_retired_head = -1;
 
-	ringbuf->space = ring_space(ring);
+	ringbuf->space = ring_space(ringbuf);
 	return 0;
 }
 
@@ -1589,7 +1588,7 @@ static int ring_wait_for_space(struct intel_engine_cs *ring, int n)
 	trace_i915_ring_wait_begin(ring);
 	do {
 		ringbuf->head = I915_READ_HEAD(ring);
-		ringbuf->space = ring_space(ring);
+		ringbuf->space = ring_space(ringbuf);
 		if (ringbuf->space >= n) {
 			ret = 0;
 			break;
@@ -1641,7 +1640,7 @@ static int intel_wrap_ring_buffer(struct intel_engine_cs *ring)
 		iowrite32(MI_NOOP, virt++);
 
 	ringbuf->tail = 0;
-	ringbuf->space = ring_space(ring);
+	ringbuf->space = ring_space(ringbuf);
 
 	return 0;
 }
-- 
1.9.0

  parent reply	other threads:[~2014-07-03 15:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 15:27 [PATCH 1/8] drm/i915: Extract context backing object allocation oscar.mateo
2014-07-03 15:27 ` [PATCH 2/8] drm/i915: Emphasize that ctx->obj & ctx->id refer to the legacy hw render context oscar.mateo
2014-07-03 15:28 ` [PATCH 3/8] drm/i915: Emphasize that ctx->id is merely a user handle oscar.mateo
2014-07-03 15:28 ` [PATCH 4/8] drm/i915: Add kerneldoc comments to the intel_context struct oscar.mateo
2014-07-03 15:38   ` Mateo Lozano, Oscar
2014-07-08  9:29     ` Daniel Vetter
2014-07-08 10:28       ` Daniel Vetter
2014-07-03 15:28 ` [PATCH 5/8] drm/i915: Extract ringbuffer destroy & generalize alloc to take a ringbuf oscar.mateo
2014-07-03 15:28 ` oscar.mateo [this message]
2014-07-03 15:28 ` [PATCH 7/8] drm/i915: Generalize intel_ring_get_tail " oscar.mateo
2014-07-03 15:28 ` [PATCH 8/8] drm/i915: Extract the actual workload submission mechanism from execbuffer oscar.mateo
2014-07-08  9:39 ` [PATCH 1/8] drm/i915: Extract context backing object allocation Chris Wilson
2014-07-08 10:31   ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2014-06-26 13:24 [PATCH 0/8] Execlists prep-work (II) oscar.mateo
2014-06-26 13:24 ` [PATCH 6/8] drm/i915: Generalize ring_space to take a ringbuf oscar.mateo
2014-06-30 20:58   ` Jesse Barnes

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=1404401285-19918-6-git-send-email-oscar.mateo@intel.com \
    --to=oscar.mateo@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox