From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/gt: Expose more parameters for emitting writes into the ring
Date: Tue, 03 Nov 2020 12:12:37 +0200 [thread overview]
Message-ID: <877dr2g356.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20201102221057.29626-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> Add another lower level to emit_ggtt_write so that the GGTT nature of
> the write is not hardcoded into the emitter.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/gt/intel_engine.h | 55 ++++++++++++++++----------
> 1 file changed, 35 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine.h b/drivers/gpu/drm/i915/gt/intel_engine.h
> index 7c3a1012e702..760fefdfe392 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine.h
> +++ b/drivers/gpu/drm/i915/gt/intel_engine.h
> @@ -245,22 +245,14 @@ static inline u32 *gen12_emit_pipe_control(u32 *batch, u32 flags0, u32 flags1, u
> }
>
> static inline u32 *
> -__gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
> +__gen8_emit_write_rcs(u32 *cs, u32 value, u32 offset, u32 flags0, u32 flags1)
Opportunity to swap the offset/value to be in line with the actual qw
write. Just an observation rather than a value add proposal.
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> {
> - /* We're using qword write, offset should be aligned to 8 bytes. */
> - GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
> -
> - /* w/a for post sync ops following a GPGPU operation we
> - * need a prior CS_STALL, which is emitted by the flush
> - * following the batch.
> - */
> *cs++ = GFX_OP_PIPE_CONTROL(6) | flags0;
> - *cs++ = flags1 | PIPE_CONTROL_QW_WRITE | PIPE_CONTROL_GLOBAL_GTT_IVB;
> - *cs++ = gtt_offset;
> + *cs++ = flags1 | PIPE_CONTROL_QW_WRITE;
> + *cs++ = offset;
> *cs++ = 0;
> *cs++ = value;
> - /* We're thrashing one dword of HWS. */
> - *cs++ = 0;
> + *cs++ = 0; /* We're thrashing one extra dword. */
>
> return cs;
> }
> @@ -268,13 +260,38 @@ __gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 f
> static inline u32*
> gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
> {
> - return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, 0, flags);
> + /* We're using qword write, offset should be aligned to 8 bytes. */
> + GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
> +
> + return __gen8_emit_write_rcs(cs,
> + value,
> + gtt_offset,
> + 0,
> + flags | PIPE_CONTROL_GLOBAL_GTT_IVB);
> }
>
> static inline u32*
> gen12_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
> {
> - return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, flags0, flags1);
> + /* We're using qword write, offset should be aligned to 8 bytes. */
> + GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
> +
> + return __gen8_emit_write_rcs(cs,
> + value,
> + gtt_offset,
> + flags0,
> + flags1 | PIPE_CONTROL_GLOBAL_GTT_IVB);
> +}
> +
> +static inline u32 *
> +__gen8_emit_flush_dw(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
> +{
> + *cs++ = (MI_FLUSH_DW + 1) | flags;
> + *cs++ = gtt_offset;
> + *cs++ = 0;
> + *cs++ = value;
> +
> + return cs;
> }
>
> static inline u32 *
> @@ -285,12 +302,10 @@ gen8_emit_ggtt_write(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
> /* Offset should be aligned to 8 bytes for both (QW/DW) write types */
> GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
>
> - *cs++ = (MI_FLUSH_DW + 1) | MI_FLUSH_DW_OP_STOREDW | flags;
> - *cs++ = gtt_offset | MI_FLUSH_DW_USE_GTT;
> - *cs++ = 0;
> - *cs++ = value;
> -
> - return cs;
> + return __gen8_emit_flush_dw(cs,
> + value,
> + gtt_offset | MI_FLUSH_DW_USE_GTT,
> + flags | MI_FLUSH_DW_OP_STOREDW);
> }
>
> static inline void __intel_engine_reset(struct intel_engine_cs *engine,
> --
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2020-11-03 10:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 22:10 [Intel-gfx] [PATCH 1/2] drm/i915/gt: Expose more parameters for emitting writes into the ring Chris Wilson
2020-11-02 22:10 ` [Intel-gfx] [PATCH 2/2] drm/i915/gt: Flush xcs before tgl breadcrumbs Chris Wilson
2020-11-02 22:10 ` Chris Wilson
2020-11-03 12:44 ` [Intel-gfx] " Mika Kuoppala
2020-11-03 12:44 ` Mika Kuoppala
2020-11-03 14:16 ` [Intel-gfx] " Chris Wilson
2020-11-03 14:16 ` Chris Wilson
2020-11-02 23:01 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/i915/gt: Expose more parameters for emitting writes into the ring Patchwork
2020-11-02 23:25 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-11-03 7:16 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-11-03 10:12 ` Mika Kuoppala [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=877dr2g356.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@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 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.