All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Tidy workaround batch buffer emission
Date: Wed, 8 Feb 2017 13:20:58 +0000	[thread overview]
Message-ID: <20170208132058.GP11545@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1486559628-392-1-git-send-email-tvrtko.ursulin@linux.intel.com>

On Wed, Feb 08, 2017 at 01:13:48PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> -static int gen9_init_perctx_bb(struct intel_engine_cs *engine,
> -			       struct i915_wa_ctx_bb *wa_ctx,
> -			       uint32_t *batch,
> -			       uint32_t *offset)
> +static u32 *gen9_init_perctx_bb(struct intel_engine_cs *engine, u32 *batch)
>  {
> -	uint32_t index = wa_ctx_start(wa_ctx, *offset, CACHELINE_DWORDS);
> -
> -	wa_ctx_emit(batch, index, MI_BATCH_BUFFER_END);
> +	*batch++ = MI_BATCH_BUFFER_END;
>  
> -	return wa_ctx_end(wa_ctx, *offset = index, 1);
> +	return batch;
>  }

Transformation looks reasonable, but I'd like to omit this per-ctx bb
when empty.

> +	/*
> +	 * Emit the two workaround batch buffers, recording the offset from the
> +	 * start of the workaround batch buffer object for each and their
> +	 * respective sizes.
> +	 */
> +	for (i = 0; i < ARRAY_SIZE(wa_bb_f); i++) {
> +		wa_bb[i]->offset = ALIGN(batch_ptr - batch, CACHELINE_DWORDS);
> +		batch_ptr = wa_bb_f[i](engine, batch_ptr);
> +		wa_bb[i]->size = batch_ptr - &batch[wa_bb[i]->offset];

Which will break this pattern. At the least we could do

if (!ww_bb_fn[i])
	continue;

And then skip loading into the context image if size==0.

I'll double check the mechanical aspects in a bit.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-02-08 13:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 13:13 [PATCH] drm/i915: Tidy workaround batch buffer emission Tvrtko Ursulin
2017-02-08 13:20 ` Chris Wilson [this message]
2017-02-08 14:44   ` Tvrtko Ursulin
2017-02-15 14:28     ` Tvrtko Ursulin
2017-02-09  7:55 ` ✓ Fi.CI.BAT: success for " Patchwork

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=20170208132058.GP11545@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tursulin@ursulin.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.