Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Gupta, Sourab" <sourab.gupta@intel.com>
To: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	"Goel, Akash" <akash.goel@intel.com>
Subject: Re: [PATCH v4 2/6] drm/i915/vlv: Added a rendering specific Hw WA 'WaSendDummy3dPrimitveAfterSetContext'
Date: Tue, 8 Apr 2014 04:41:46 +0000	[thread overview]
Message-ID: <1396932146.19246.5.camel@sourabgu-desktop> (raw)
In-Reply-To: <1395682207-7092-3-git-send-email-sourab.gupta@intel.com>

On Mon, 2014-03-24 at 17:30 +0000, Gupta, Sourab wrote:
> From: Akash Goel <akash.goel@intel.com>
> 
> This workaround is needed on VLV for the HW context feature.
> It is used after adding the mi_set_context command in ring buffer
> for Hw context switch. As per the spec
> "The software must send a pipe_control with a CS stall and a post sync
> operation and then a dummy DRAW after every MI_SET_CONTEXT and after any
> PIPELINE_SELECT that is enabling 3D mode".
> 
> v2: Modified the WA comment. (Ville)
> 
> v3: Added the vlv identifier with the WA name
> 
> v4: Check removed for scratch page initialization. (Chris/Daniel)
> 
> Signed-off-by: Sourab Gupta <sourab.gupta@intel.com>
> Signed-off-by: Akash Goel <akash.goel@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 54 +++++++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/i915_reg.h         |  1 +
>  drivers/gpu/drm/i915/intel_ringbuffer.c |  9 ++++++
>  drivers/gpu/drm/i915/intel_ringbuffer.h |  1 +
>  4 files changed, 63 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 6043062..83bf89e 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -584,6 +584,47 @@ i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
>  	return ctx;
>  }
>  
> +static inline void
> +mi_set_context_dummy3d_prim_wa(struct intel_ring_buffer *ring)
> +{
> +	u32 scratch_addr;
> +	u32 flags = 0;
> +
> +	/* Actual scratch location is at 128 bytes offset */
> +	scratch_addr = intel_get_pipe_control_scratch_addr(ring) + 128;
> +
> +	/*
> +	 * WaSendDummy3dPrimitveAfterSetContext:vlv
> +	 * Software must send a pipe_control with a CS stall
> +	 * and a post sync operation and then a dummy DRAW after
> +	 * every MI_SET_CONTEXT and after any PIPELINE_SELECT that
> +	 * is enabling 3D mode. A dummy draw is a 3DPRIMITIVE command
> +	 * with Indirect Parameter Enable set to 0, UAV Coherency
> +	 * Required set to 0, Predicate Enable set to 0,
> +	 * End Offset Enable set to 0, and Vertex Count Per Instance
> +	 * set to 0, All other parameters are a don't care.
> +	 */
> +
> +	/*
> +	 * Add a pipe control with CS Stall and postsync op
> +	 * before dummy 3D_PRIMITIVE
> +	 */
> +	flags |= PIPE_CONTROL_QW_WRITE | PIPE_CONTROL_CS_STALL;
> +	intel_ring_emit(ring, GFX_OP_PIPE_CONTROL(4));
> +	intel_ring_emit(ring, flags);
> +	intel_ring_emit(ring, scratch_addr | PIPE_CONTROL_GLOBAL_GTT);
> +	intel_ring_emit(ring, 0);
> +
> +	/* Add a dummy 3D_PRIMITVE */
> +	intel_ring_emit(ring, GFX_OP_3DPRIMITIVE);
> +	intel_ring_emit(ring, 4); /* PrimTopoType*/
> +	intel_ring_emit(ring, 0); /* VertexCountPerInstance */
> +	intel_ring_emit(ring, 0); /* StartVertexLocation */
> +	intel_ring_emit(ring, 0); /* InstanceCount */
> +	intel_ring_emit(ring, 0); /* StartInstanceLocation */
> +	intel_ring_emit(ring, 0); /* BaseVertexLocation  */
> +}
> +
>  static inline int
>  mi_set_context(struct intel_ring_buffer *ring,
>  	       struct i915_hw_context *new_context,
> @@ -602,7 +643,10 @@ mi_set_context(struct intel_ring_buffer *ring,
>  			return ret;
>  	}
>  
> -	ret = intel_ring_begin(ring, 6);
> +	if (IS_VALLEYVIEW(ring->dev))
> +		ret = intel_ring_begin(ring, 6+4+8);
> +	else
> +		ret = intel_ring_begin(ring, 6);
>  	if (ret)
>  		return ret;
>  
> @@ -626,7 +670,13 @@ mi_set_context(struct intel_ring_buffer *ring,
>  	intel_ring_emit(ring, MI_NOOP);
>  
>  	if (IS_GEN7(ring->dev))
> -		intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_ENABLE);
> +		if (IS_VALLEYVIEW(ring->dev)) {
> +			/* FIXME, should also apply to ivb */
> +			mi_set_context_dummy3d_prim_wa(ring);
> +			intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_ENABLE);
> +			intel_ring_emit(ring, MI_NOOP);
> +		} else
> +			intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_ENABLE);
>  	else
>  		intel_ring_emit(ring, MI_NOOP);
>  
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index adcb9c7..b922e38 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -348,6 +348,7 @@
>  #define   PIPE_CONTROL_DEPTH_CACHE_FLUSH		(1<<0)
>  #define   PIPE_CONTROL_GLOBAL_GTT (1<<2) /* in addr dword */
>  
> +#define GFX_OP_3DPRIMITIVE ((0x3<<29)|(0x3<<27)|(0x3<<24)|(7-2))
>  
>  /*
>   * Reset registers
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 75cac4e..bace089 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -583,6 +583,15 @@ err:
>  	return ret;
>  }
>  
> +u32
> +intel_get_pipe_control_scratch_addr(struct intel_ring_buffer *ring)
> +{
> +	if (ring->scratch.obj == NULL)
> +		return 0;
> +
> +	return ring->scratch.gtt_offset;
> +}
> +
>  static int init_render_ring(struct intel_ring_buffer *ring)
>  {
>  	struct drm_device *dev = ring->dev;
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index f11ceb2..e38ca82 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -294,6 +294,7 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev);
>  
>  u32 intel_ring_get_active_head(struct intel_ring_buffer *ring);
>  void intel_ring_setup_status_page(struct intel_ring_buffer *ring);
> +u32 intel_get_pipe_control_scratch_addr(struct intel_ring_buffer *ring);
>  
>  static inline u32 intel_ring_get_tail(struct intel_ring_buffer *ring)
>  {

Gentle Reminder to review the patch.

Thanks,
Sourab

  reply	other threads:[~2014-04-08  4:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24 17:30 [PATCH 0/6] Rendering Specific HW Workarounds for VLV sourab.gupta
2014-03-24 17:30 ` [PATCH v4 1/6] drm/i915/vlv: Added a rendering specific Hw WA 'WaTlbInvalidateStoreDataBefore' sourab.gupta
2014-03-24 17:30 ` [PATCH v4 2/6] drm/i915/vlv: Added a rendering specific Hw WA 'WaSendDummy3dPrimitveAfterSetContext' sourab.gupta
2014-04-08  4:41   ` Gupta, Sourab [this message]
2014-04-14  9:45     ` [PATCH v5 " sourab.gupta
2014-05-28  9:57       ` Gupta, Sourab
2014-06-05  5:44         ` Gupta, Sourab
2014-03-24 17:30 ` [PATCH v2 3/6] drm/i915: Enabling the TLB invalidate bit in GFX Mode register sourab.gupta
2014-04-01  5:01   ` Gupta, Sourab
2014-04-02 11:34   ` Ville Syrjälä
2014-04-02 11:55     ` Daniel Vetter
2014-03-24 17:30 ` [PATCH 4/6] drm/i915/vlv: Remove the enabling of VS_TIMER_DISPATCH bit in MI MODE reg sourab.gupta
2014-03-24 17:47   ` Chris Wilson
2014-03-24 17:55     ` Gupta, Sourab
2014-03-24 18:01       ` Chris Wilson
2014-03-24 18:28         ` [PATCH v2 " sourab.gupta
2014-03-25 11:33           ` Ville Syrjälä
2014-03-25 12:31             ` [PATCH v3 4/6] drm/i915: " sourab.gupta
2014-03-25 13:11               ` Ville Syrjälä
2014-03-25 15:41                 ` Daniel Vetter
2014-03-24 17:30 ` [PATCH v2 5/6] drm/i915/vlv:Implement the WA 'WaDisable_RenderCache_OperationalFlush' sourab.gupta
2014-04-01 10:51   ` Ville Syrjälä
2014-04-03  4:42     ` [PATCH v3 " sourab.gupta
2014-04-04 11:17       ` Ville Syrjälä
2014-04-04 11:44         ` [PATCH v4 " sourab.gupta
2014-04-04 15:24           ` Chris Wilson
2014-04-04 15:35             ` Ville Syrjälä
2014-04-04 15:59               ` Chris Wilson
2014-04-04 15:59             ` Daniel Vetter
2014-03-24 17:30 ` [PATCH v2 6/6] drm/i915/vlv: Modifying WA 'WaDisableL3Bank2xClockGate for vlv sourab.gupta
2014-03-24 17:56   ` Damien Lespiau
2014-03-25  6:52     ` Gupta, Sourab
2014-04-01  5:22       ` Gupta, Sourab
2014-04-14 10:22         ` Gupta, Sourab
2014-05-26 10:33           ` Gupta, Sourab
2014-05-27 14:27   ` Damien Lespiau
2014-05-27 16:54     ` 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=1396932146.19246.5.camel@sourabgu-desktop \
    --to=sourab.gupta@intel.com \
    --cc=akash.goel@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --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