Re: [PATCH 04/18] drm/i915: Rename intel_context[engine].ringbuf

Joonas Lahtinen
2016-07-21T11:43:09Z

On ke, 2016-07-20 at 14:11 +0100, Chris Wilson wrote:
> Perform s/ringbuf/ring/ on the context struct for consistency with the
> ring/engine split.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c        |  8 ++++----
>  drivers/gpu/drm/i915/i915_drv.h            |  2 +-
>  drivers/gpu/drm/i915/i915_gem_context.c    |  4 ++--
>  drivers/gpu/drm/i915/i915_guc_submission.c |  2 +-
>  drivers/gpu/drm/i915/intel_lrc.c           | 33 ++++++++++++++----------------
>  5 files changed, 23 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9aa62c5b5f65..bde68741809b 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -425,8 +425,8 @@ static int per_file_ctx_stats(int id, void *ptr, void *data)
>   for (n = 0; n < ARRAY_SIZE(ctx->engine); n++) {
>   if (ctx->engine[n].state)
>   per_file_stats(0, ctx->engine[n].state, data);
> - if (ctx->engine[n].ringbuf)
> - per_file_stats(0, ctx->engine[n].ringbuf->obj, data);
> + if (ctx->engine[n].ring)
> + per_file_stats(0, ctx->engine[n].ring->obj, data);
>   }
>
>   return 0;
> @@ -2066,8 +2066,8 @@ static int i915_context_status(struct seq_file *m, void *unused)
>   seq_putc(m, ce->initialised ? 'I' : 'i');
>   if (ce->state)
>   describe_obj(m, ce->state);
> - if (ce->ringbuf)
> - describe_ctx_ringbuf(m, ce->ringbuf);
> + if (ce->ring)
> + describe_ctx_ringbuf(m, ce->ring);
>   seq_putc(m, '\n');
>   }
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 0f408ada1c65..87e06a6a797a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -894,7 +894,7 @@ struct i915_gem_context {
>
>   struct intel_context {
>   struct drm_i915_gem_object *state;
> - struct intel_ringbuffer *ringbuf;
> + struct intel_ringbuffer *ring;
>   struct i915_vma *lrc_vma;
>   uint32_t *lrc_reg_state;
>   u64 lrc_desc;
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 16138c4ff7db..c8bf7b8e959f 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -173,8 +173,8 @@ void i915_gem_context_free(struct kref *ctx_ref)
>   continue;
>
>   WARN_ON(ce->pin_count);
> - if (ce->ringbuf)
> - intel_ringbuffer_free(ce->ringbuf);
> + if (ce->ring)
> + intel_ringbuffer_free(ce->ring);
>
>   i915_gem_object_put(ce->state);
>   }
> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> index 01c1c1671811..eccd34832fe6 100644
> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -363,7 +363,7 @@ static void guc_init_ctx_desc(struct intel_guc *guc,
>   lrc->context_id = (client->ctx_index << GUC_ELC_CTXID_OFFSET) |
>   (engine->guc_id << GUC_ELC_ENGINE_OFFSET);
>
> - obj = ce->ringbuf->obj;
> + obj = ce->ring->obj;
>   gfx_addr = i915_gem_obj_ggtt_offset(obj);
>
>   lrc->ring_begin = gfx_addr;
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index c3542eb338ca..7bc1d0c92799 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -482,11 +482,8 @@ static void execlists_context_unqueue(struct intel_engine_cs *engine)
>    * resubmit the request. See gen8_emit_request() for where we
>    * prepare the padding after the end of the request.
>    */
> - struct intel_ringbuffer *ringbuf;
> -
> - ringbuf = req0->ctx->engine[engine->id].ringbuf;
>   req0->tail += 8;
> - req0->tail &= ringbuf->size - 1;
> + req0->tail &= req0->ring->size - 1;
>   }
>
>   execlists_submit_requests(req0, req1);
> @@ -714,7 +711,7 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
>   return ret;
>   }
>
> - request->ring = ce->ringbuf;
> + request->ring = ce->ring;
>
>   if (i915.enable_guc_submission) {
>   /*
> @@ -976,14 +973,14 @@ static int intel_lr_context_pin(struct i915_gem_context *ctx,
>
>   lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE;
>
> - ret = intel_pin_and_map_ringbuffer_obj(dev_priv, ce->ringbuf);
> + ret = intel_pin_and_map_ringbuffer_obj(dev_priv, ce->ring);
>   if (ret)
>   goto unpin_map;
>
>   ce->lrc_vma = i915_gem_obj_to_ggtt(ce->state);
>   intel_lr_context_descriptor_update(ctx, engine);
>
> - lrc_reg_state[CTX_RING_BUFFER_START+1] = ce->ringbuf->vma->node.start;
> + lrc_reg_state[CTX_RING_BUFFER_START+1] = ce->ring->vma->node.start;
>   ce->lrc_reg_state = lrc_reg_state;
>   ce->state->dirty = true;
>
> @@ -1014,7 +1011,7 @@ void intel_lr_context_unpin(struct i915_gem_context *ctx,
>   if (--ce->pin_count)
>   return;
>
> - intel_unpin_ringbuffer_obj(ce->ringbuf);
> + intel_unpin_ringbuffer_obj(ce->ring);
>
>   i915_gem_object_unpin_map(ce->state);
>   i915_gem_object_ggtt_unpin(ce->state);
> @@ -2338,7 +2335,7 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
>   struct drm_i915_gem_object *ctx_obj;
>   struct intel_context *ce = &ctx->engine[engine->id];
>   uint32_t context_size;
> - struct intel_ringbuffer *ringbuf;
> + struct intel_ringbuffer *ring;
>   int ret;
>
>   WARN_ON(ce->state);
> @@ -2354,29 +2351,29 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
>   return PTR_ERR(ctx_obj);
>   }
>
> - ringbuf = intel_engine_create_ringbuffer(engine, ctx->ring_size);
> - if (IS_ERR(ringbuf)) {
> - ret = PTR_ERR(ringbuf);
> + ring = intel_engine_create_ringbuffer(engine, ctx->ring_size);
> + if (IS_ERR(ring)) {
> + ret = PTR_ERR(ring);
>   goto error_deref_obj;
>   }
>
> - ret = populate_lr_context(ctx, ctx_obj, engine, ringbuf);
> + ret = populate_lr_context(ctx, ctx_obj, engine, ring);
>   if (ret) {
>   DRM_DEBUG_DRIVER("Failed to populate LRC: %d\n", ret);
>   goto error_ringbuf;
>   }
>
> - ce->ringbuf = ringbuf;
> + ce->ring = ring;
>   ce->state = ctx_obj;
>   ce->initialised = engine->init_context == NULL;
>
>   return 0;
>
>  error_ringbuf:

All the same to change the label too, then;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas

> - intel_ringbuffer_free(ringbuf);
> + intel_ringbuffer_free(ring);
>  error_deref_obj:
>   i915_gem_object_put(ctx_obj);
> - ce->ringbuf = NULL;
> + ce->ring = NULL;
>   ce->state = NULL;
>   return ret;
>  }
> @@ -2407,7 +2404,7 @@ void intel_lr_context_reset(struct drm_i915_private *dev_priv,
>
>   i915_gem_object_unpin_map(ctx_obj);
>
> - ce->ringbuf->head = 0;
> - ce->ringbuf->tail = 0;
> + ce->ring->head = 0;
> + ce->ring->tail = 0;
>   }
>  }
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation