All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: "Xiang, Haihao" <haihao.xiang@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Inter-gfx][PATCH][v3 3/4] drm/i915: add set_tail hook in struct intel_ring_buffer
Date: Thu, 16 Sep 2010 12:21:21 +0800	[thread overview]
Message-ID: <20100916042121.GN9765@zhen-devel.sh.intel.com> (raw)
In-Reply-To: <1284604993-2810-3-git-send-email-haihao.xiang@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 4807 bytes --]

On 2010.09.16 10:43:12 +0800, Xiang, Haihao wrote:
> This is prepared for video codec ring buffer on Sandybridge. It is
> needed to read/write more than one register to move the tail pointer of
> the video codec ring on Sandybridge.

Do we really need new 'set_tail'? Isn't advance_ring used for set ring tail?

Sandybridge workaround can be put into advance_ring, so your 'set_tail''s only
left usage is for initialization. Is that workaround even needed for initial
0 setting? Or can't that be done in init function by using advance_ring?

> 
> Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_ringbuffer.c |   22 +++++++++++++++++-----
>  drivers/gpu/drm/i915/intel_ringbuffer.h |    2 ++
>  2 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index a9d4f5b..0a65182 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -134,6 +134,12 @@ static unsigned int render_ring_get_tail(struct drm_device *dev,
>  	return I915_READ(PRB0_TAIL) & TAIL_ADDR;
>  }
>  
> +static inline void render_ring_set_tail(struct drm_device *dev, u32 value)
> +{
> +	drm_i915_private_t *dev_priv = dev->dev_private;
> +	I915_WRITE(PRB0_TAIL, value);
> +}
> +
>  static unsigned int render_ring_get_active_head(struct drm_device *dev,
>  		struct intel_ring_buffer *ring)
>  {
> @@ -146,8 +152,7 @@ static unsigned int render_ring_get_active_head(struct drm_device *dev,
>  static void render_ring_advance_ring(struct drm_device *dev,
>  		struct intel_ring_buffer *ring)
>  {
> -	drm_i915_private_t *dev_priv = dev->dev_private;
> -	I915_WRITE(PRB0_TAIL, ring->tail);
> +	render_ring_set_tail(dev, ring->tail);
>  }
>  
>  static int init_ring_common(struct drm_device *dev,
> @@ -161,7 +166,7 @@ static int init_ring_common(struct drm_device *dev,
>  	/* Stop the ring if it's running. */
>  	I915_WRITE(ring->regs.ctl, 0);
>  	I915_WRITE(ring->regs.head, 0);
> -	I915_WRITE(ring->regs.tail, 0);
> +	ring->set_tail(dev, 0);
>  
>  	/* Initialize the ring. */
>  	I915_WRITE(ring->regs.start, obj_priv->gtt_offset);
> @@ -404,6 +409,12 @@ static inline unsigned int bsd_ring_get_tail(struct drm_device *dev,
>  	return I915_READ(BSD_RING_TAIL) & TAIL_ADDR;
>  }
>  
> +static inline void bsd_ring_set_tail(struct drm_device *dev, u32 value)
> +{
> +	drm_i915_private_t *dev_priv = dev->dev_private;
> +	I915_WRITE(BSD_RING_TAIL, value);
> +}
> +
>  static inline unsigned int bsd_ring_get_active_head(struct drm_device *dev,
>  		struct intel_ring_buffer *ring)
>  {
> @@ -414,8 +425,7 @@ static inline unsigned int bsd_ring_get_active_head(struct drm_device *dev,
>  static inline void bsd_ring_advance_ring(struct drm_device *dev,
>  		struct intel_ring_buffer *ring)
>  {
> -	drm_i915_private_t *dev_priv = dev->dev_private;
> -	I915_WRITE(BSD_RING_TAIL, ring->tail);
> +	bsd_ring_set_tail(dev, ring->tail);
>  }
>  
>  static int init_bsd_ring(struct drm_device *dev,
> @@ -820,6 +830,7 @@ static struct intel_ring_buffer render_ring = {
>  	.init			= init_render_ring,
>  	.get_head		= render_ring_get_head,
>  	.get_tail		= render_ring_get_tail,
> +	.set_tail		= render_ring_set_tail,
>  	.get_active_head	= render_ring_get_active_head,
>  	.advance_ring		= render_ring_advance_ring,
>  	.flush			= render_ring_flush,
> @@ -857,6 +868,7 @@ static struct intel_ring_buffer bsd_ring = {
>  	.init			= init_bsd_ring,
>  	.get_head		= bsd_ring_get_head,
>  	.get_tail		= bsd_ring_get_tail,
> +	.set_tail		= bsd_ring_set_tail,
>  	.get_active_head	= bsd_ring_get_active_head,
>  	.advance_ring		= bsd_ring_advance_ring,
>  	.flush			= bsd_ring_flush,
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index df7acc5..f89e528 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -44,6 +44,8 @@ struct  intel_ring_buffer {
>  			struct intel_ring_buffer *ring);
>  	unsigned int	(*get_tail)(struct drm_device *dev,
>  			struct intel_ring_buffer *ring);
> +	void		(*set_tail)(struct drm_device *dev,
> +			u32 value);
>  	unsigned int	(*get_active_head)(struct drm_device *dev,
>  			struct intel_ring_buffer *ring);
>  	void		(*advance_ring)(struct drm_device *dev,
> -- 
> 1.7.0.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

  reply	other threads:[~2010-09-16  4:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16  2:43 [Inter-gfx][PATCH][v3 1/4] drm/i915: fix HAS_BSD with a device info flag Xiang, Haihao
2010-09-16  2:43 ` [Inter-gfx][PATCH][v3 2/4] drm/i915: do not export the instances of struct intel_ring_buffer Xiang, Haihao
2010-09-16  2:43 ` [Inter-gfx][PATCH][v3 3/4] drm/i915: add set_tail hook in " Xiang, Haihao
2010-09-16  4:21   ` Zhenyu Wang [this message]
2010-09-16  5:10     ` Xiang, Haihao
2010-09-16  5:37       ` Zhenyu Wang
2010-09-16  6:03         ` Xiang, Haihao
2010-09-16  2:43 ` [Inter-gfx][PATCH][v3 4/4] drm/i915: add a new ring buffer on Sandybridge Xiang, Haihao
2010-09-19 13:50 ` [Inter-gfx][PATCH][v3 1/4] drm/i915: fix HAS_BSD with a device info flag 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=20100916042121.GN9765@zhen-devel.sh.intel.com \
    --to=zhenyuw@linux.intel.com \
    --cc=haihao.xiang@intel.com \
    --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.