public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: Intel-GFX <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 02/18] drm/i915: Semaphore MBOX update generalization
Date: Tue, 7 May 2013 22:17:47 -0700	[thread overview]
Message-ID: <20130508051746.GA3582@bwidawsk.net> (raw)
In-Reply-To: <20130507153446.GH26612@strange.ger.corp.intel.com>

On Tue, May 07, 2013 at 04:34:46PM +0100, Damien Lespiau wrote:
> On Sat, Apr 27, 2013 at 05:59:13PM -0700, Ben Widawsky wrote:
> > This replaces the existing MBOX update code with a more generalized
> > calculation for emitting mbox updates. We also create a sentinel for
> > doing the updates so we can more abstractly deal with the rings.
> > 
> > When doing MBOX updates the code must be aware of the /other/ rings.
> > Until now the platforms which supported semaphores had a fixed number of
> > rings and so it made sense for the code to be very specialized
> > (hardcoded).
> > 
> > The patch does contain a functional change, but should have no
> > behavioral changes.
> > 
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h         |  1 +
> >  drivers/gpu/drm/i915/intel_ringbuffer.c | 38 +++++++++++++++++++++------------
> >  drivers/gpu/drm/i915/intel_ringbuffer.h |  2 +-
> >  3 files changed, 26 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index 767aa32..5be4a75 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -568,6 +568,7 @@
> >  #define GEN6_VRSYNC (RING_SYNC_1(GEN6_BSD_RING_BASE))
> >  #define GEN6_VBSYNC (RING_SYNC_0(GEN6_BSD_RING_BASE))
> >  #define GEN6_BRSYNC (RING_SYNC_0(BLT_RING_BASE))
> > +#define GEN6_NOSYNC 0
> >  #define GEN6_BVSYNC (RING_SYNC_1(BLT_RING_BASE))
> >  #define RING_MAX_IDLE(base)	((base)+0x54)
> >  #define RING_HWS_PGA(base)	((base)+0x80)
> > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > index 38751a7..0f97547 100644
> > --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > @@ -578,9 +578,11 @@ static void
> >  update_mboxes(struct intel_ring_buffer *ring,
> >  	      u32 mmio_offset)
> >  {
> > +#define MBOX_UPDATE_DWORDS 4
> >  	intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
> >  	intel_ring_emit(ring, mmio_offset);
> >  	intel_ring_emit(ring, ring->outstanding_lazy_request);
> > +	intel_ring_emit(ring, MI_NOOP);
> 
> Not sure why you are adding a MI_NOOP here, mind documenting this?
> 

Sure. The key is that we move to for_each_ring and the number of rings
we must update move from even to odd...
How's this:
/* In order to be able to do semaphore MBOX updates for varying number
 * of rings, it's easiest if we round up each individual update to a
 * multiple of 2 (since ring updates must always be a multiple of 2)
 * even though the actual update only requires 3 dwords.
 */

> >  }
> >  
> >  /**
> > @@ -595,19 +597,24 @@ update_mboxes(struct intel_ring_buffer *ring,
> >  static int
> >  gen6_add_request(struct intel_ring_buffer *ring)
> >  {
> > -	u32 mbox1_reg;
> > -	u32 mbox2_reg;
> > -	int ret;
> > +	struct drm_device *dev = ring->dev;
> > +	struct drm_i915_private *dev_priv = dev->dev_private;
> > +	struct intel_ring_buffer *useless;
> > +	int i, ret;
> >  
> > -	ret = intel_ring_begin(ring, 10);
> > +	ret = intel_ring_begin(ring, ((I915_NUM_RINGS-1) *
> > +				      MBOX_UPDATE_DWORDS) +
> > +				      4);
> >  	if (ret)
> >  		return ret;
> > +#undef MBOX_UPDATE_DWORDS
> >  
> > -	mbox1_reg = ring->signal_mbox[0];
> > -	mbox2_reg = ring->signal_mbox[1];
> > +	for_each_ring(useless, dev_priv, i) {
> > +		u32 mbox_reg = ring->signal_mbox[i];
> > +		if (mbox_reg != GEN6_NOSYNC)
> > +			update_mboxes(ring, mbox_reg);
> > +	}
> >  
> > -	update_mboxes(ring, mbox1_reg);
> > -	update_mboxes(ring, mbox2_reg);
> >  	intel_ring_emit(ring, MI_STORE_DWORD_INDEX);
> >  	intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
> >  	intel_ring_emit(ring, ring->outstanding_lazy_request);
> > @@ -1669,8 +1676,9 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
> >  		ring->semaphore_register[RCS] = MI_SEMAPHORE_SYNC_INVALID;
> >  		ring->semaphore_register[VCS] = MI_SEMAPHORE_SYNC_RV;
> >  		ring->semaphore_register[BCS] = MI_SEMAPHORE_SYNC_RB;
> > -		ring->signal_mbox[0] = GEN6_VRSYNC;
> > -		ring->signal_mbox[1] = GEN6_BRSYNC;
> > +		ring->signal_mbox[RCS] = GEN6_NOSYNC;
> > +		ring->signal_mbox[VCS] = GEN6_VRSYNC;
> > +		ring->signal_mbox[BCS] = GEN6_BRSYNC;
> >  	} else if (IS_GEN5(dev)) {
> >  		ring->add_request = pc_render_add_request;
> >  		ring->flush = gen4_render_ring_flush;
> > @@ -1828,8 +1836,9 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev)
> >  		ring->semaphore_register[RCS] = MI_SEMAPHORE_SYNC_VR;
> >  		ring->semaphore_register[VCS] = MI_SEMAPHORE_SYNC_INVALID;
> >  		ring->semaphore_register[BCS] = MI_SEMAPHORE_SYNC_VB;
> > -		ring->signal_mbox[0] = GEN6_RVSYNC;
> > -		ring->signal_mbox[1] = GEN6_BVSYNC;
> > +		ring->signal_mbox[RCS] = GEN6_RVSYNC;
> > +		ring->signal_mbox[VCS] = GEN6_NOSYNC;
> > +		ring->signal_mbox[BCS] = GEN6_BVSYNC;
> >  	} else {
> >  		ring->mmio_base = BSD_RING_BASE;
> >  		ring->flush = bsd_ring_flush;
> > @@ -1874,8 +1883,9 @@ int intel_init_blt_ring_buffer(struct drm_device *dev)
> >  	ring->semaphore_register[RCS] = MI_SEMAPHORE_SYNC_BR;
> >  	ring->semaphore_register[VCS] = MI_SEMAPHORE_SYNC_BV;
> >  	ring->semaphore_register[BCS] = MI_SEMAPHORE_SYNC_INVALID;
> > -	ring->signal_mbox[0] = GEN6_RBSYNC;
> > -	ring->signal_mbox[1] = GEN6_VBSYNC;
> > +	ring->signal_mbox[RCS] = GEN6_RBSYNC;
> > +	ring->signal_mbox[VCS] = GEN6_VBSYNC;
> > +	ring->signal_mbox[BCS] = GEN6_NOSYNC;
> >  	ring->init = init_ring_common;
> >  
> >  	return intel_init_ring_buffer(dev, ring);
> > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> > index 785df13..f1aef0d 100644
> > --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> > @@ -103,7 +103,7 @@ struct  intel_ring_buffer {
> >  				   u32 seqno);
> >  
> >  	u32		semaphore_register[I915_NUM_RINGS]; /*our mbox written by others */
> > -	u32		signal_mbox[2]; /* mboxes this ring signals to */
> > +	u32		signal_mbox[I915_NUM_RINGS]; /* mboxes this ring signals to + sentinel */
> >  	/**
> >  	 * List of objects currently involved in rendering from the
> >  	 * ringbuffer.
> > -- 
> > 1.8.2.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ben Widawsky, Intel Open Source Technology Center

  reply	other threads:[~2013-05-08  5:15 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28  0:59 [PATCH 00/18] Introduce the Haswell VECS Ben Widawsky
2013-04-28  0:59 ` [PATCH 01/18] drm/i915: Comments for semaphore clarification Ben Widawsky
2013-05-07 13:54   ` Damien Lespiau
2013-05-07 16:51     ` Ben Widawsky
2013-05-07 17:00       ` Ben Widawsky
2013-04-28  0:59 ` [PATCH 02/18] drm/i915: Semaphore MBOX update generalization Ben Widawsky
2013-05-07 15:34   ` Damien Lespiau
2013-05-08  5:17     ` Ben Widawsky [this message]
2013-04-28  0:59 ` [PATCH 03/18] drm/i915: Introduce VECS: the 4th ring Ben Widawsky
2013-05-07 15:35   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 04/18] drm/i915: Add VECS semaphore bits Ben Widawsky
2013-05-07 14:49   ` Damien Lespiau
2013-05-08  5:59     ` Ben Widawsky
2013-04-28  0:59 ` [PATCH 05/18] drm/i915: Rename ring flush functions Ben Widawsky
2013-05-07 17:28   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 06/18] drm/i915: add HAS_VEBOX Ben Widawsky
2013-05-07 14:59   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 07/18] drm/i915: Vebox ringbuffer init Ben Widawsky
2013-05-07 17:16   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 08/18] drm/i915: Create a more generic pm handler for hsw+ Ben Widawsky
2013-05-28 13:00   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 09/18] drm/i915: make PM interrupt writes non-destructive Ben Widawsky
2013-05-28 13:30   ` Damien Lespiau
2013-05-28 18:02     ` Ben Widawsky
2013-04-28  0:59 ` [PATCH 10/18] drm/i915: Create an ivybridge_irq_preinstall Ben Widawsky
2013-05-28 13:37   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 11/18] drm/i915: Add PM regs to pre install Ben Widawsky
2013-05-28 13:38   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 12/18] drm/i915: Convert irq_refounct to struct Ben Widawsky
2013-05-28 13:40   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 13/18] drm/i915: consolidate interrupt naming scheme Ben Widawsky
2013-05-28 14:01   ` Damien Lespiau
2013-05-28 18:50     ` Ben Widawsky
2013-05-29 15:51       ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 14/18] drm/i915: vebox interrupt get/put Ben Widawsky
2013-05-28 14:38   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 15/18] drm/i915: Enable vebox interrupts Ben Widawsky
2013-05-28 14:52   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 16/18] drm/i915: add VEBOX into debugfs Ben Widawsky
2013-05-28 15:06   ` Damien Lespiau
2013-05-28 18:44     ` Ben Widawsky
2013-04-28  0:59 ` [PATCH 17/18] drm/i915: add I915_EXEC_VEBOX to i915_gem_do_execbuffer() Ben Widawsky
2013-05-28 15:08   ` Damien Lespiau
2013-04-28  0:59 ` [PATCH 18/18] drm/i915: add I915_PARAM_HAS_VEBOX to i915_getparam Ben Widawsky
2013-05-28 15:10   ` Damien Lespiau
2013-04-30 21:25 ` [PATCH 00/18] Introduce the Haswell VECS Jesse Barnes
2013-05-08  6:13 ` Ben Widawsky
2013-05-09  9:07   ` Li, Zhong
2013-05-29  2:22 ` [PATCH 00/18] Introduce the Haswell VECS v2 Ben Widawsky
2013-05-29  2:22   ` [PATCH 01/18] [v2] drm/i915: Comments for semaphore clarification Ben Widawsky
2013-05-29 16:02     ` Damien Lespiau
2013-05-29  2:22   ` [PATCH 02/18] drm/i915: Semaphore MBOX update generalization Ben Widawsky
2013-05-29 16:05     ` Damien Lespiau
2013-05-29  2:22   ` [PATCH 03/18] drm/i915: Introduce VECS: the 4th ring Ben Widawsky
2013-05-29 19:10     ` Daniel Vetter
2013-05-29  2:22   ` [PATCH 04/18] [v2] drm/i915: Add VECS semaphore bits Ben Widawsky
2013-05-29 16:06     ` Damien Lespiau
2013-05-29  2:22   ` [PATCH 05/18] drm/i915: Rename ring flush functions Ben Widawsky
2013-05-29  2:22   ` [PATCH 06/18] drm/i915: add HAS_VEBOX Ben Widawsky
2013-05-29  2:22   ` [PATCH 07/18] [v2] drm/i915: Vebox ringbuffer init Ben Widawsky
2013-05-29  2:22   ` [PATCH 08/18] drm/i915: Create a more generic pm handler for hsw+ Ben Widawsky
2013-05-29 19:19     ` Daniel Vetter
2013-05-31 18:25       ` Daniel Vetter
2013-05-29  2:22   ` [PATCH 09/18] [v2] drm/i915: Create an ivybridge_irq_preinstall Ben Widawsky
2013-05-29 16:23     ` Damien Lespiau
2013-05-29 19:48       ` Daniel Vetter
2013-05-29  2:22   ` [PATCH 10/18] [v2] drm/i915: Add PM regs to pre/post install Ben Widawsky
2013-05-29 17:04     ` Damien Lespiau
2013-05-29  2:22   ` [PATCH 11/18] [v5] drm/i915: make PM interrupt writes non-destructive Ben Widawsky
2013-05-29 17:02     ` Damien Lespiau
2013-05-29  2:22   ` [PATCH 12/18] drm/i915: Convert irq_refounct to struct Ben Widawsky
2013-05-29  2:22   ` [PATCH 13/18] [v2] drm/i915: consolidate interrupt naming scheme Ben Widawsky
2013-05-29  2:22   ` [PATCH 14/18] [v2] drm/i915: vebox interrupt get/put Ben Widawsky
2013-05-29  2:22   ` [PATCH 15/18] [v3] drm/i915: Enable vebox interrupts Ben Widawsky
2013-05-29  2:22   ` [PATCH 16/18] [v2] drm/i915: add VEBOX into debugfs Ben Widawsky
2013-05-29 16:22     ` [PATCH 16/18] [v3] " Ben Widawsky
2013-05-29 16:44       ` Damien Lespiau
2013-05-29  2:22   ` [PATCH 17/18] drm/i915: add I915_EXEC_VEBOX to i915_gem_do_execbuffer() Ben Widawsky
2013-05-29  2:22   ` [PATCH 18/18] drm/i915: add I915_PARAM_HAS_VEBOX to i915_getparam Ben Widawsky
2013-05-31 18:52     ` Daniel Vetter
2013-05-31 19:52       ` Ben Widawsky
2013-05-31 20:08         ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2012-11-06 16:25 [PATCH 00/18] [RFC] Introduce the Haswell VECS Ben Widawsky
2012-11-06 16:25 ` [PATCH 02/18] drm/i915: Semaphore MBOX update generalization Ben Widawsky
2012-11-07 14:00   ` Jani Nikula

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=20130508051746.GA3582@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=damien.lespiau@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox