intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Nick Hoath <nicholas.hoath@intel.com>
To: Dave Gordon <david.s.gordon@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v3 3/3] drm/i915: tidy up a few leftovers
Date: Mon, 18 Jan 2016 16:17:07 +0000	[thread overview]
Message-ID: <569D1003.1040806@intel.com> (raw)
In-Reply-To: <1452162052-22573-4-git-send-email-david.s.gordon@intel.com>

On 07/01/2016 10:20, Dave Gordon wrote:
> There are a few bits of code which the transformations implemented by
> the previous patch reveal to be suboptimal, once the notion of a per-
> ring default context has gone away. So this tidies up the leftovers.
>
> It could have been squashed into the previous patch, but that would have
> made that patch less clearly a simple transformation. In particular, any
> change which alters the code block structure or indentation has been
> deferred into this separate patch, because such things tend to make diffs
> more difficult to read.
>
> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>

Reviewed-by: Nick Hoath <nicholas.hoath@intel.com>

> ---
>   drivers/gpu/drm/i915/i915_debugfs.c | 15 +++++----------
>   drivers/gpu/drm/i915/i915_gem.c     |  6 ++----
>   drivers/gpu/drm/i915/intel_lrc.c    | 38 +++++++++++++++++--------------------
>   3 files changed, 24 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 2613708..bbb23da 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1942,11 +1942,8 @@ static int i915_context_status(struct seq_file *m, void *unused)
>
>   		seq_puts(m, "HW context ");
>   		describe_ctx(m, ctx);
> -		for_each_ring(ring, dev_priv, i) {
> -			if (dev_priv->kernel_context == ctx)
> -				seq_printf(m, "(default context %s) ",
> -					   ring->name);
> -		}
> +		if (ctx == dev_priv->kernel_context)
> +			seq_printf(m, "(kernel context) ");
>
>   		if (i915.enable_execlists) {
>   			seq_putc(m, '\n');
> @@ -2037,13 +2034,11 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
>   	if (ret)
>   		return ret;
>
> -	list_for_each_entry(ctx, &dev_priv->context_list, link) {
> -		for_each_ring(ring, dev_priv, i) {
> -			if (dev_priv->kernel_context != ctx)
> +	list_for_each_entry(ctx, &dev_priv->context_list, link)
> +		if (ctx != dev_priv->kernel_context)
> +			for_each_ring(ring, dev_priv, i)
>   				i915_dump_lrc_obj(m, ring,
>   						  ctx->engine[i].state);
> -		}
> -	}
>
>   	mutex_unlock(&dev->struct_mutex);
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 8f101121..4f45eb2 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2677,10 +2677,8 @@ void i915_gem_request_free(struct kref *req_ref)
>   		i915_gem_request_remove_from_client(req);
>
>   	if (ctx) {
> -		if (i915.enable_execlists) {
> -			if (ctx != req->i915->kernel_context)
> -				intel_lr_context_unpin(req);
> -		}
> +		if (i915.enable_execlists && ctx != req->i915->kernel_context)
> +			intel_lr_context_unpin(req);
>
>   		i915_gem_context_unreference(ctx);
>   	}
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index aaaa5a3..8c4c9b9 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -660,16 +660,10 @@ static int execlists_move_to_gpu(struct drm_i915_gem_request *req,
>
>   int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request)
>   {
> -	int ret;
> +	int ret = 0;
>
>   	request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
>
> -	if (request->ctx != request->i915->kernel_context) {
> -		ret = intel_lr_context_pin(request);
> -		if (ret)
> -			return ret;
> -	}
> -
>   	if (i915.enable_guc_submission) {
>   		/*
>   		 * Check that the GuC has space for the request before
> @@ -683,7 +677,10 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
>   			return ret;
>   	}
>
> -	return 0;
> +	if (request->ctx != request->i915->kernel_context)
> +		ret = intel_lr_context_pin(request);
> +
> +	return ret;
>   }
>
>   static int logical_ring_wait_for_space(struct drm_i915_gem_request *req,
> @@ -2382,22 +2379,21 @@ void intel_lr_context_free(struct intel_context *ctx)
>   {
>   	int i;
>
> -	for (i = 0; i < I915_NUM_RINGS; i++) {
> +	for (i = I915_NUM_RINGS; --i >= 0; ) {
> +		struct intel_ringbuffer *ringbuf = ctx->engine[i].ringbuf;
>   		struct drm_i915_gem_object *ctx_obj = ctx->engine[i].state;
>
> -		if (ctx_obj) {
> -			struct intel_ringbuffer *ringbuf =
> -					ctx->engine[i].ringbuf;
> -			struct intel_engine_cs *ring = ringbuf->ring;
> +		if (!ctx_obj)
> +			continue;
>
> -			if (ctx == ctx->i915->kernel_context) {
> -				intel_unpin_ringbuffer_obj(ringbuf);
> -				i915_gem_object_ggtt_unpin(ctx_obj);
> -			}
> -			WARN_ON(ctx->engine[ring->id].pin_count);
> -			intel_ringbuffer_free(ringbuf);
> -			drm_gem_object_unreference(&ctx_obj->base);
> +		if (ctx == ctx->i915->kernel_context) {
> +			intel_unpin_ringbuffer_obj(ringbuf);
> +			i915_gem_object_ggtt_unpin(ctx_obj);
>   		}
> +
> +		WARN_ON(ctx->engine[i].pin_count);
> +		intel_ringbuffer_free(ringbuf);
> +		drm_gem_object_unreference(&ctx_obj->base);
>   	}
>   }
>
> @@ -2472,7 +2468,7 @@ static void lrc_setup_hardware_status_page(struct intel_engine_cs *ring,
>    */
>
>   int intel_lr_context_deferred_alloc(struct intel_context *ctx,
> -				     struct intel_engine_cs *ring)
> +				    struct intel_engine_cs *ring)
>   {
>   	struct drm_device *dev = ring->dev;
>   	struct drm_i915_gem_object *ctx_obj;
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2016-01-18 16:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07 10:20 [PATCH v3 0/3] improve handling of the driver's internal (default) context Dave Gordon
2016-01-07 10:20 ` [PATCH v3 1/3] drm/i915: simplify allocation of driver-internal requests Dave Gordon
2016-01-07 11:58   ` Chris Wilson
2016-01-07 12:34     ` Dave Gordon
2016-01-07 16:56       ` Chris Wilson
2016-01-11 12:45         ` Dave Gordon
2016-01-07 16:49     ` Jesse Barnes
2016-01-07 16:53       ` Chris Wilson
2016-01-12 13:02         ` Dave Gordon
2016-01-12 13:50   ` Daniel Vetter
2016-01-12 13:56     ` Chris Wilson
2016-01-12 14:27       ` Chris Wilson
2016-01-13 13:27         ` Dave Gordon
2016-01-13 13:41           ` Chris Wilson
2016-01-13 18:46             ` Dave Gordon
2016-01-13 20:23               ` Chris Wilson
2016-01-18 16:16   ` Nick Hoath
2016-01-07 10:20 ` [PATCH v3 2/3] drm/i915: abolish separate per-ring default_context pointers Dave Gordon
2016-01-12 13:51   ` Daniel Vetter
2016-01-18 16:16   ` Nick Hoath
2016-01-19  8:54     ` Daniel Vetter
2016-01-07 10:20 ` [PATCH v3 3/3] drm/i915: tidy up a few leftovers Dave Gordon
2016-01-12 13:53   ` Daniel Vetter
2016-01-13 12:41     ` Dave Gordon
2016-01-18 16:17   ` Nick Hoath [this message]

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=569D1003.1040806@intel.com \
    --to=nicholas.hoath@intel.com \
    --cc=david.s.gordon@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;
as well as URLs for NNTP newsgroup(s).