public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915/lrc: Only enable per-context and per-bb buffers if set
Date: Thu, 21 Sep 2017 16:10:51 +0100	[thread overview]
Message-ID: <21549192-ab20-9392-e91d-400c66d2cda1@linux.intel.com> (raw)
In-Reply-To: <20170921135444.27330-1-chris@chris-wilson.co.uk>


On 21/09/2017 14:54, Chris Wilson wrote:
> The per-context and per-batch workaround buffers are optional, yet we
> tell the GPU to execute them even if they contain no instructions. Doing
> so incurs the dispatch latency, which we can avoid if we don't ask the
> GPU to execute the no-op buffers. Allow ourselves to skip setup of empty
> buffer, and then to only enable non-empty buffers in the context image.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_lrc.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 86fed9f1f1ae..297c9c1564e5 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1265,7 +1265,8 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
>   			ret = -EINVAL;
>   			break;
>   		}
> -		batch_ptr = wa_bb_fn[i](engine, batch_ptr);
> +		if (wa_bb_fn[i])
> +			batch_ptr = wa_bb_fn[i](engine, batch_ptr);
>   		wa_bb[i]->size = batch_ptr - (batch + wa_bb[i]->offset);
>   	}
>   
> @@ -1994,13 +1995,12 @@ static void execlists_init_reg_state(u32 *regs,
>   	CTX_REG(regs, CTX_SECOND_BB_HEAD_L, RING_SBBADDR(base), 0);
>   	CTX_REG(regs, CTX_SECOND_BB_STATE, RING_SBBSTATE(base), 0);
>   	if (rcs) {
> -		CTX_REG(regs, CTX_BB_PER_CTX_PTR, RING_BB_PER_CTX_PTR(base), 0);
> +		struct i915_ctx_workarounds *wa_ctx = &engine->wa_ctx;
> +
>   		CTX_REG(regs, CTX_RCS_INDIRECT_CTX, RING_INDIRECT_CTX(base), 0);
>   		CTX_REG(regs, CTX_RCS_INDIRECT_CTX_OFFSET,
>   			RING_INDIRECT_CTX_OFFSET(base), 0);
> -
> -		if (engine->wa_ctx.vma) {
> -			struct i915_ctx_workarounds *wa_ctx = &engine->wa_ctx;
> +		if (wa_ctx->indirect_ctx.size) {
>   			u32 ggtt_offset = i915_ggtt_offset(wa_ctx->vma);
>   
>   			regs[CTX_RCS_INDIRECT_CTX + 1] =
> @@ -2009,6 +2009,11 @@ static void execlists_init_reg_state(u32 *regs,
>   
>   			regs[CTX_RCS_INDIRECT_CTX_OFFSET + 1] =
>   				intel_lr_indirect_ctx_offset(engine) << 6;
> +		}
> +
> +		CTX_REG(regs, CTX_BB_PER_CTX_PTR, RING_BB_PER_CTX_PTR(base), 0);
> +		if (wa_ctx->per_ctx.size) {
> +			u32 ggtt_offset = i915_ggtt_offset(wa_ctx->vma);
>   
>   			regs[CTX_BB_PER_CTX_PTR + 1] =
>   				(ggtt_offset + wa_ctx->per_ctx.offset) | 0x01;
> 

Looks OK. Does it make sense to fetch the ggtt offset only once ("if 
(size || size) ggtt_offset = ...")? Meh.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

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

  parent reply	other threads:[~2017-09-21 15:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21 13:54 [PATCH 1/2] drm/i915/lrc: Only enable per-context and per-bb buffers if set Chris Wilson
2017-09-21 13:54 ` [PATCH 2/2] drm/i915/lrc: Skip no-op per-bb buffer on gen9 Chris Wilson
2017-09-21 15:12   ` Tvrtko Ursulin
2017-09-21 15:41     ` Chris Wilson
2017-09-21 14:53 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/lrc: Only enable per-context and per-bb buffers if set Patchwork
2017-09-21 15:10 ` Tvrtko Ursulin [this message]
2017-09-21 16:38 ` ✗ Fi.CI.IGT: failure " Patchwork
2017-09-25  9:23   ` Chris Wilson

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=21549192-ab20-9392-e91d-400c66d2cda1@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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