From: "Volkin, Bradley D" <bradley.d.volkin@intel.com>
To: "oscar.mateo@intel.com" <oscar.mateo@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 28/53] drm/i915/bdw: GEN-specific logical ring emit flush
Date: Fri, 20 Jun 2014 14:39:31 -0700 [thread overview]
Message-ID: <20140620213931.GE32083@bdvolkin-ubuntu-desktop> (raw)
In-Reply-To: <1402673891-14618-29-git-send-email-oscar.mateo@intel.com>
On Fri, Jun 13, 2014 at 08:37:46AM -0700, oscar.mateo@intel.com wrote:
> From: Oscar Mateo <oscar.mateo@intel.com>
>
> Notice that the BSD invalidate bit is no longer present in GEN8, so
Hmm. As far as I can tell, it is still present for VCS on gen8. As to
whether we need to set it, I don't know.
> we can consolidate the blt and bsd ring flushes into one.
>
> Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
> ---
> drivers/gpu/drm/i915/intel_lrc.c | 80 +++++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_ringbuffer.c | 7 ---
> drivers/gpu/drm/i915/intel_ringbuffer.h | 11 +++++
> 3 files changed, 91 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 3debe8b..3d7fcd6 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -343,6 +343,81 @@ static int gen8_init_render_ring(struct intel_engine_cs *ring)
> return ret;
> }
>
> +static int gen8_emit_flush(struct intel_engine_cs *ring,
> + struct intel_context *ctx,
> + u32 invalidate_domains,
> + u32 unused)
> +{
> + struct intel_ringbuffer *ringbuf = logical_ringbuf_get(ring, ctx);
> + uint32_t cmd;
> + int ret;
> +
> + ret = intel_logical_ring_begin(ring, ctx, 4);
> + if (ret)
> + return ret;
> +
> + cmd = MI_FLUSH_DW + 1;
> +
> + /*
> + * Bspec vol 1c.3 - blitter engine command streamer:
> + * "If ENABLED, all TLBs will be invalidated once the flush
> + * operation is complete. This bit is only valid when the
> + * Post-Sync Operation field is a value of 1h or 3h."
> + */
> + if (invalidate_domains & I915_GEM_DOMAIN_RENDER)
> + cmd |= MI_INVALIDATE_TLB | MI_FLUSH_DW_STORE_INDEX |
> + MI_FLUSH_DW_OP_STOREDW;
> + intel_logical_ring_emit(ringbuf, cmd);
> + intel_logical_ring_emit(ringbuf, I915_GEM_HWS_SCRATCH_ADDR | MI_FLUSH_DW_USE_GTT);
> + intel_logical_ring_emit(ringbuf, 0); /* upper addr */
> + intel_logical_ring_emit(ringbuf, 0); /* value */
> + intel_logical_ring_advance(ringbuf);
> +
> + return 0;
> +}
> +
> +static int gen8_emit_flush_render(struct intel_engine_cs *ring,
> + struct intel_context *ctx,
> + u32 invalidate_domains,
> + u32 flush_domains)
> +{
> + struct intel_ringbuffer *ringbuf = logical_ringbuf_get(ring, ctx);
> + u32 flags = 0;
> + u32 scratch_addr = ring->scratch.gtt_offset + 2 * CACHELINE_BYTES;
> + int ret;
> +
> + flags |= PIPE_CONTROL_CS_STALL;
> +
> + if (flush_domains) {
> + flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;
> + flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;
> + }
> + if (invalidate_domains) {
> + flags |= PIPE_CONTROL_TLB_INVALIDATE;
> + flags |= PIPE_CONTROL_INSTRUCTION_CACHE_INVALIDATE;
> + flags |= PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE;
> + flags |= PIPE_CONTROL_VF_CACHE_INVALIDATE;
> + flags |= PIPE_CONTROL_CONST_CACHE_INVALIDATE;
> + flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE;
> + flags |= PIPE_CONTROL_QW_WRITE;
> + flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
> + }
> +
> + ret = intel_logical_ring_begin(ring, ctx, 6);
> + if (ret)
> + return ret;
> +
> + intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
> + intel_logical_ring_emit(ringbuf, flags);
> + intel_logical_ring_emit(ringbuf, scratch_addr);
> + intel_logical_ring_emit(ringbuf, 0);
> + intel_logical_ring_emit(ringbuf, 0);
> + intel_logical_ring_emit(ringbuf, 0);
> + intel_logical_ring_advance(ringbuf);
> +
> + return 0;
> +}
> +
> static u32 gen8_get_seqno(struct intel_engine_cs *ring, bool lazy_coherency)
> {
> return intel_read_status_page(ring, I915_GEM_HWS_INDEX);
> @@ -491,6 +566,7 @@ static int logical_render_ring_init(struct drm_device *dev)
> ring->set_seqno = gen8_set_seqno;
> ring->submit_ctx = gen8_submit_ctx;
> ring->emit_request = gen8_emit_request_render;
> + ring->emit_flush = gen8_emit_flush_render;
>
> return logical_ring_init(dev, ring);
> }
> @@ -511,6 +587,7 @@ static int logical_bsd_ring_init(struct drm_device *dev)
> ring->set_seqno = gen8_set_seqno;
> ring->submit_ctx = gen8_submit_ctx;
> ring->emit_request = gen8_emit_request;
> + ring->emit_flush = gen8_emit_flush;
>
> return logical_ring_init(dev, ring);
> }
> @@ -531,6 +608,7 @@ static int logical_bsd2_ring_init(struct drm_device *dev)
> ring->set_seqno = gen8_set_seqno;
> ring->submit_ctx = gen8_submit_ctx;
> ring->emit_request = gen8_emit_request;
> + ring->emit_flush = gen8_emit_flush;
>
> return logical_ring_init(dev, ring);
> }
> @@ -551,6 +629,7 @@ static int logical_blt_ring_init(struct drm_device *dev)
> ring->set_seqno = gen8_set_seqno;
> ring->submit_ctx = gen8_submit_ctx;
> ring->emit_request = gen8_emit_request;
> + ring->emit_flush = gen8_emit_flush;
>
> return logical_ring_init(dev, ring);
> }
> @@ -571,6 +650,7 @@ static int logical_vebox_ring_init(struct drm_device *dev)
> ring->set_seqno = gen8_set_seqno;
> ring->submit_ctx = gen8_submit_ctx;
> ring->emit_request = gen8_emit_request;
> + ring->emit_flush = gen8_emit_flush;
>
> return logical_ring_init(dev, ring);
> }
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 137ee9a..a128f6f 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -33,13 +33,6 @@
> #include "i915_trace.h"
> #include "intel_drv.h"
>
> -/* Early gen2 devices have a cacheline of just 32 bytes, using 64 is overkill,
> - * but keeps the logic simple. Indeed, the whole purpose of this macro is just
> - * to give some inclination as to some of the magic values used in the various
> - * workarounds!
> - */
> -#define CACHELINE_BYTES 64
> -
> bool
> intel_ring_initialized(struct intel_engine_cs *ring)
> {
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index d8ded14..527db2a 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -5,6 +5,13 @@
>
> #define I915_CMD_HASH_ORDER 9
>
> +/* Early gen2 devices have a cacheline of just 32 bytes, using 64 is overkill,
> + * but keeps the logic simple. Indeed, the whole purpose of this macro is just
> + * to give some inclination as to some of the magic values used in the various
> + * workarounds!
> + */
> +#define CACHELINE_BYTES 64
> +
> /*
> * Gen2 BSpec "1. Programming Environment" / 1.4.4.6 "Ring Buffer Use"
> * Gen3 BSpec "vol1c Memory Interface Functions" / 2.3.4.5 "Ring Buffer Use"
> @@ -153,6 +160,10 @@ struct intel_engine_cs {
> struct intel_context *ctx, u32 value);
> int (*emit_request)(struct intel_engine_cs *ring,
> struct intel_context *ctx);
> + int __must_check (*emit_flush)(struct intel_engine_cs *ring,
> + struct intel_context *ctx,
> + u32 invalidate_domains,
> + u32 flush_domains);
Any reason to make this one __must_check but not the others?
Brad
>
> /**
> * List of objects currently involved in rendering from the
> --
> 1.9.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-06-20 21:40 UTC|newest]
Thread overview: 149+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 15:37 [PATCH 00/53] Execlists v3 oscar.mateo
2014-06-13 15:37 ` [PATCH 01/53] drm/i915: Extract context backing object allocation oscar.mateo
2014-06-13 15:37 ` [PATCH 02/53] drm/i915: Rename ctx->obj to ctx->render_obj oscar.mateo
2014-06-13 17:00 ` Daniel Vetter
2014-06-16 15:20 ` Mateo Lozano, Oscar
2014-06-13 17:15 ` Chris Wilson
2014-06-13 15:37 ` [PATCH 03/53] drm/i915: Add a dev pointer to the context oscar.mateo
2014-06-13 15:37 ` [PATCH 04/53] drm/i915: Extract ringbuffer destroy & make alloc outside accesible oscar.mateo
2014-06-18 21:39 ` Volkin, Bradley D
2014-06-19 10:42 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 05/53] drm/i915: Move i915_gem_validate_context() to i915_gem_context.c oscar.mateo
2014-06-13 17:11 ` Chris Wilson
2014-06-16 15:18 ` Mateo Lozano, Oscar
2014-06-18 20:00 ` Volkin, Bradley D
2014-06-13 15:37 ` [PATCH 06/53] drm/i915/bdw: Introduce one context backing object per engine oscar.mateo
2014-06-18 20:16 ` Daniel Vetter
2014-06-19 8:52 ` Mateo Lozano, Oscar
2014-06-19 10:57 ` Daniel Vetter
2014-06-13 15:37 ` [PATCH 07/53] drm/i915/bdw: New file for Logical Ring Contexts and Execlists oscar.mateo
2014-06-18 20:17 ` Daniel Vetter
2014-06-19 9:01 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 08/53] drm/i915/bdw: Macro for LRCs and module option for Execlists oscar.mateo
2014-06-18 20:19 ` Daniel Vetter
2014-06-19 9:04 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 09/53] drm/i915/bdw: Initialization for Logical Ring Contexts oscar.mateo
2014-06-18 20:24 ` Daniel Vetter
2014-06-19 9:23 ` Mateo Lozano, Oscar
2014-06-19 10:08 ` Daniel Vetter
2014-06-19 10:10 ` Mateo Lozano, Oscar
2014-06-19 10:34 ` Daniel Vetter
2014-06-13 15:37 ` [PATCH 10/53] drm/i915/bdw: A bit more advanced context init/fini oscar.mateo
2014-06-18 22:13 ` Volkin, Bradley D
2014-06-19 6:13 ` Daniel Vetter
2014-06-13 15:37 ` [PATCH 11/53] drm/i915/bdw: Allocate ringbuffers for Logical Ring Contexts oscar.mateo
2014-06-18 22:19 ` Volkin, Bradley D
2014-06-23 12:07 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 12/53] drm/i915/bdw: Populate LR contexts (somewhat) oscar.mateo
2014-06-18 23:24 ` Volkin, Bradley D
2014-06-23 12:42 ` Mateo Lozano, Oscar
2014-06-23 15:05 ` Volkin, Bradley D
2014-06-23 15:11 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 13/53] drm/i915/bdw: Deferred creation of user-created LRCs oscar.mateo
2014-06-18 20:27 ` Daniel Vetter
2014-06-13 15:37 ` [PATCH 14/53] drm/i915/bdw: Render moot context reset and switch when LRCs are enabled oscar.mateo
2014-06-13 15:37 ` [PATCH 15/53] drm/i915/bdw: Don't write PDP in the legacy way when using LRCs oscar.mateo
2014-06-18 23:42 ` Volkin, Bradley D
2014-06-23 12:45 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 16/53] drm/i915/bdw: Skeleton for the new logical rings submission path oscar.mateo
2014-06-13 15:37 ` [PATCH 17/53] drm/i915/bdw: Generic logical ring init and cleanup oscar.mateo
2014-06-13 15:37 ` [PATCH 18/53] drm/i915/bdw: New header file for LRs, LRCs and Execlists oscar.mateo
2014-06-13 15:37 ` [PATCH 19/53] drm/i915: Extract pipe control fini & make init outside accesible oscar.mateo
2014-06-18 20:31 ` Daniel Vetter
2014-06-19 0:04 ` Volkin, Bradley D
2014-06-19 10:58 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 20/53] drm/i915/bdw: GEN-specific logical ring init oscar.mateo
2014-06-13 15:37 ` [PATCH 21/53] drm/i915/bdw: GEN-specific logical ring set/get seqno oscar.mateo
2014-06-13 15:37 ` [PATCH 22/53] drm/i915: Make ring_space more generic and outside accesible oscar.mateo
2014-06-13 15:37 ` [PATCH 23/53] drm/i915: Generalize intel_ring_get_tail oscar.mateo
2014-06-20 20:17 ` Volkin, Bradley D
2014-06-13 15:37 ` [PATCH 24/53] drm/i915: Make intel_ring_stopped outside accesible oscar.mateo
2014-06-13 15:37 ` [PATCH 25/53] drm/i915/bdw: GEN-specific logical ring submit context (somewhat) oscar.mateo
2014-06-20 20:28 ` Volkin, Bradley D
2014-06-23 12:49 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 26/53] drm/i915/bdw: New logical ring submission mechanism oscar.mateo
2014-06-20 21:00 ` Volkin, Bradley D
2014-06-23 13:09 ` Mateo Lozano, Oscar
2014-06-23 13:13 ` Chris Wilson
2014-06-23 13:18 ` Mateo Lozano, Oscar
2014-06-23 13:27 ` Chris Wilson
2014-06-23 13:36 ` Mateo Lozano, Oscar
2014-06-23 13:41 ` Chris Wilson
2014-06-23 14:35 ` Mateo Lozano, Oscar
2014-06-23 19:10 ` Volkin, Bradley D
2014-06-24 12:29 ` Mateo Lozano, Oscar
2014-07-07 12:39 ` Daniel Vetter
2014-06-24 0:23 ` Ben Widawsky
2014-06-24 11:45 ` Mateo Lozano, Oscar
2014-06-24 14:41 ` Volkin, Bradley D
2014-06-24 17:19 ` Jesse Barnes
2014-06-26 13:28 ` Mateo Lozano, Oscar
2014-07-07 12:41 ` Daniel Vetter
2014-06-13 15:37 ` [PATCH 27/53] drm/i915/bdw: GEN-specific logical ring emit request oscar.mateo
2014-06-20 21:18 ` Volkin, Bradley D
2014-06-23 15:48 ` Mateo Lozano, Oscar
2014-06-13 15:37 ` [PATCH 28/53] drm/i915/bdw: GEN-specific logical ring emit flush oscar.mateo
2014-06-20 21:39 ` Volkin, Bradley D [this message]
2014-06-13 15:37 ` [PATCH 29/53] drm/i915/bdw: Emission of requests with logical rings oscar.mateo
2014-06-13 15:37 ` [PATCH 30/53] drm/i915/bdw: Ring idle and stop " oscar.mateo
2014-06-13 15:37 ` [PATCH 31/53] drm/i915/bdw: Interrupts " oscar.mateo
2014-06-13 15:37 ` [PATCH 32/53] drm/i915/bdw: GEN-specific logical ring emit batchbuffer start oscar.mateo
2014-06-13 15:37 ` [PATCH 33/53] drm/i915: Extract the actual workload submission mechanism from execbuffer oscar.mateo
2014-06-13 15:37 ` [PATCH 34/53] drm/i915: Make move_to_active and retire_commands outside accesible oscar.mateo
2014-06-13 15:37 ` [PATCH 35/53] drm/i915/bdw: Workload submission mechanism for Execlists oscar.mateo
2014-06-13 15:37 ` [PATCH 36/53] drm/i915: Abstract the workload submission mechanism away oscar.mateo
2014-06-18 20:40 ` Daniel Vetter
2014-06-13 15:37 ` [PATCH 37/53] drm/i915/bdw: Implement context switching (somewhat) oscar.mateo
2014-06-13 17:00 ` Chris Wilson
2014-06-13 15:37 ` [PATCH 38/53] drm/i915/bdw: Write the tail pointer, LRC style oscar.mateo
2014-06-13 15:37 ` [PATCH 39/53] drm/i915/bdw: Two-stage execlist submit process oscar.mateo
2014-06-13 15:37 ` [PATCH 40/53] drm/i915/bdw: Handle context switch events oscar.mateo
2014-06-13 15:37 ` [PATCH 41/53] drm/i915/bdw: Avoid non-lite-restore preemptions oscar.mateo
2014-06-18 20:49 ` Daniel Vetter
2014-06-23 11:52 ` Mateo Lozano, Oscar
2014-07-07 12:47 ` Daniel Vetter
2014-06-13 15:38 ` [PATCH 42/53] drm/i915/bdw: Make sure gpu reset still works with Execlists oscar.mateo
2014-06-18 20:50 ` Daniel Vetter
2014-06-19 9:37 ` Mateo Lozano, Oscar
2014-06-13 15:38 ` [PATCH 43/53] drm/i915/bdw: Make sure error capture keeps working " oscar.mateo
2014-06-13 16:54 ` Chris Wilson
2014-06-18 20:52 ` Daniel Vetter
2014-06-18 20:53 ` Daniel Vetter
2014-06-13 15:38 ` [PATCH 44/53] drm/i915/bdw: Help out the ctx switch interrupt handler oscar.mateo
2014-06-13 15:38 ` [PATCH 45/53] drm/i915/bdw: Do not call intel_runtime_pm_get() in an interrupt oscar.mateo
2014-06-18 20:54 ` Daniel Vetter
2014-07-26 10:27 ` Chris Wilson
2014-07-28 8:54 ` Daniel Vetter
2014-07-29 7:37 ` Chris Wilson
2014-07-29 10:26 ` Daniel Vetter
2014-08-08 9:20 ` Chris Wilson
2014-08-08 9:37 ` Daniel Vetter
2014-08-08 13:41 ` Greg KH
2014-08-09 0:18 ` Rafael J. Wysocki
2014-08-09 0:14 ` Rafael J. Wysocki
2014-08-09 1:21 ` [Intel-gfx] " Alan Stern
2014-08-09 8:53 ` Daniel Vetter
2014-08-10 1:55 ` Rafael J. Wysocki
2014-06-13 15:38 ` [PATCH 46/53] drm/i915/bdw: Display execlists info in debugfs oscar.mateo
2014-06-18 20:59 ` Daniel Vetter
2014-06-13 15:38 ` [PATCH 47/53] drm/i915/bdw: Display context backing obj & ringbuffer " oscar.mateo
2014-06-13 15:38 ` [PATCH 48/53] drm/i915/bdw: Print context state " oscar.mateo
2014-06-13 15:38 ` [PATCH 49/53] drm/i915: Extract render state preparation oscar.mateo
2014-06-13 15:38 ` [PATCH 50/53] drm/i915/bdw: Render state init for Execlists oscar.mateo
2014-06-13 15:38 ` [PATCH 51/53] drm/i915/bdw: Document Logical Rings, LR contexts and Execlists oscar.mateo
2014-06-13 16:51 ` Chris Wilson
2014-06-16 15:24 ` Mateo Lozano, Oscar
2014-06-16 17:56 ` Daniel Vetter
2014-06-17 8:22 ` Mateo Lozano, Oscar
2014-06-17 9:39 ` Daniel Vetter
2014-06-17 9:46 ` Mateo Lozano, Oscar
2014-06-17 10:08 ` Daniel Vetter
2014-06-17 10:12 ` Mateo Lozano, Oscar
2014-06-13 15:38 ` [PATCH 52/53] drm/i915/bdw: Enable logical ring contexts oscar.mateo
2014-06-13 15:38 ` [PATCH 53/53] !UPSTREAM: drm/i915: Use MMIO flips oscar.mateo
2014-06-18 21:01 ` Daniel Vetter
2014-06-19 9:50 ` Mateo Lozano, Oscar
2014-06-19 10:04 ` Daniel Vetter
2014-06-19 10:13 ` Chris Wilson
2014-06-19 10:33 ` Mateo Lozano, Oscar
2014-06-18 21:26 ` [PATCH 00/53] Execlists v3 Daniel Vetter
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=20140620213931.GE32083@bdvolkin-ubuntu-desktop \
--to=bradley.d.volkin@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=oscar.mateo@intel.com \
/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