[Intel-gfx] [PATCH 064/190] drm/i915: Rename intel_pin_and_map_ring()

Chris Wilson chris at chris-wilson.co.uk
Mon Jan 11 01:17:15 PST 2016


For more consistent oop-naming, we would use intel_ring_verb, so pick
intel_ring_map().

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_lrc.c        |  6 ++---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 44 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_ringbuffer.h |  4 +--
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index fa4c0c0db994..3a80d9d45f5c 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -889,7 +889,7 @@ static int intel_lr_context_do_pin(struct intel_engine_cs *ring,
 	if (ret)
 		return ret;
 
-	ret = intel_pin_and_map_ring(ring->dev, ringbuf);
+	ret = intel_ring_map(ringbuf);
 	if (ret)
 		goto unpin_ctx_obj;
 
@@ -936,7 +936,7 @@ void intel_lr_context_unpin(struct drm_i915_gem_request *rq)
 	if (ctx_obj) {
 		WARN_ON(!mutex_is_locked(&rq->i915->dev->struct_mutex));
 		if (--rq->ctx->engine[engine].pin_count == 0) {
-			intel_unpin_ring(ring);
+			intel_ring_unmap(ring);
 			i915_gem_object_ggtt_unpin(ctx_obj);
 			i915_gem_context_unreference(rq->ctx);
 		}
@@ -2178,7 +2178,7 @@ void intel_lr_context_free(struct intel_context *ctx)
 			struct intel_engine_cs *engine = ring->engine;
 
 			if (ctx == engine->default_context) {
-				intel_unpin_ring(ring);
+				intel_ring_unmap(ring);
 				i915_gem_object_ggtt_unpin(ctx_obj);
 			}
 			WARN_ON(ctx->engine[engine->id].pin_count);
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 95974156a1d9..74a4a54e6ca5 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1845,22 +1845,12 @@ static int init_phys_status_page(struct intel_engine_cs *ring)
 	return 0;
 }
 
-void intel_unpin_ring(struct intel_ring *ringbuf)
+int intel_ring_map(struct intel_ring *ring)
 {
-	if (HAS_LLC(ringbuf->obj->base.dev) && !ringbuf->obj->stolen)
-		i915_gem_object_unpin_vmap(ringbuf->obj);
-	else
-		iounmap(ringbuf->virtual_start);
-	i915_gem_object_ggtt_unpin(ringbuf->obj);
-}
-
-int intel_pin_and_map_ring(struct drm_device *dev, struct intel_ring *ringbuf)
-{
-	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct drm_i915_gem_object *obj = ringbuf->obj;
+	struct drm_i915_gem_object *obj = ring->obj;
 	int ret;
 
-	if (HAS_LLC(dev_priv) && !obj->stolen) {
+	if (HAS_LLC(ring->engine->i915) && !obj->stolen) {
 		ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, 0);
 		if (ret)
 			return ret;
@@ -1869,10 +1859,10 @@ int intel_pin_and_map_ring(struct drm_device *dev, struct intel_ring *ringbuf)
 		if (ret)
 			goto unpin;
 
-		ringbuf->virtual_start = i915_gem_object_pin_vmap(obj);
-		if (IS_ERR(ringbuf->virtual_start)) {
-			ret = PTR_ERR(ringbuf->virtual_start);
-			ringbuf->virtual_start = NULL;
+		ring->virtual_start = i915_gem_object_pin_vmap(obj);
+		if (IS_ERR(ring->virtual_start)) {
+			ret = PTR_ERR(ring->virtual_start);
+			ring->virtual_start = NULL;
 			goto unpin;
 		}
 	} else {
@@ -1884,9 +1874,10 @@ int intel_pin_and_map_ring(struct drm_device *dev, struct intel_ring *ringbuf)
 		if (ret)
 			goto unpin;
 
-		ringbuf->virtual_start = ioremap_wc(dev_priv->gtt.mappable_base +
-						    i915_gem_obj_ggtt_offset(obj), ringbuf->size);
-		if (ringbuf->virtual_start == NULL) {
+		ring->virtual_start = ioremap_wc(ring->engine->i915->gtt.mappable_base +
+						 i915_gem_obj_ggtt_offset(obj),
+						 ring->size);
+		if (ring->virtual_start == NULL) {
 			ret = -ENOMEM;
 			goto unpin;
 		}
@@ -1899,6 +1890,15 @@ unpin:
 	return ret;
 }
 
+void intel_ring_unmap(struct intel_ring *ring)
+{
+	if (HAS_LLC(ring->engine->i915) && !ring->obj->stolen)
+		i915_gem_object_unpin_vmap(ring->obj);
+	else
+		iounmap(ring->virtual_start);
+	i915_gem_object_ggtt_unpin(ring->obj);
+}
+
 static void intel_destroy_ringbuffer_obj(struct intel_ring *ringbuf)
 {
 	drm_gem_object_unreference(&ringbuf->obj->base);
@@ -2012,7 +2012,7 @@ static int intel_init_engine(struct drm_device *dev,
 			goto error;
 	}
 
-	ret = intel_pin_and_map_ring(dev, ringbuf);
+	ret = intel_ring_map(ringbuf);
 	if (ret) {
 		DRM_ERROR("Failed to pin and map ringbuffer %s: %d\n",
 				engine->name, ret);
@@ -2042,7 +2042,7 @@ void intel_engine_cleanup(struct intel_engine_cs *ring)
 		intel_engine_stop(ring);
 		WARN_ON(!IS_GEN2(ring->dev) && (I915_READ_MODE(ring) & MODE_IDLE) == 0);
 
-		intel_unpin_ring(ring->buffer);
+		intel_ring_unmap(ring->buffer);
 		intel_ring_free(ring->buffer);
 		ring->buffer = NULL;
 	}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 71941af13560..15d067b9b8a2 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -456,8 +456,8 @@ intel_write_status_page(struct intel_engine_cs *ring,
 
 struct intel_ring *
 intel_engine_create_ring(struct intel_engine_cs *engine, int size);
-int intel_pin_and_map_ring(struct drm_device *dev, struct intel_ring *ring);
-void intel_unpin_ring(struct intel_ring *ring);
+int intel_ring_map(struct intel_ring *ring);
+void intel_ring_unmap(struct intel_ring *ring);
 void intel_ring_free(struct intel_ring *ring);
 
 void intel_engine_stop(struct intel_engine_cs *ring);
-- 
2.7.0.rc3



More information about the Intel-gfx mailing list