From: "Gupta, Sourab" <sourab.gupta@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "S, Deepak" <deepak.s@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"Goel, Akash" <akash.goel@intel.com>
Subject: Re: [PATCH v10] drm/i915: Replaced Blitter ring based flips with MMIO flips
Date: Mon, 2 Jun 2014 10:38:13 +0000 [thread overview]
Message-ID: <1401705543.9396.110.camel@sourabgu-desktop> (raw)
In-Reply-To: <20140602065612.GJ10916@nuc-i3427.alporthouse.com>
On Mon, 2014-06-02 at 06:56 +0000, Chris Wilson wrote:
> On Sun, Jun 01, 2014 at 04:43:13PM +0530, sourab.gupta@intel.com wrote:
> > From: Sourab Gupta <sourab.gupta@intel.com>
> >
> > This patch enables the framework for using MMIO based flip calls,
> > in contrast with the CS based flip calls which are being used currently.
> >
> > MMIO based flip calls can be enabled on architectures where
> > Render and Blitter engines reside in different power wells. The
> > decision to use MMIO flips can be made based on workloads to give
> > 100% residency for Media power well.
> >
> > v2: The MMIO flips now use the interrupt driven mechanism for issuing the
> > flips when target seqno is reached. (Incorporating Ville's idea)
> >
> > v3: Rebasing on latest code. Code restructuring after incorporating
> > Damien's comments
> >
> > v4: Addressing Ville's review comments
> > -general cleanup
> > -updating only base addr instead of calling update_primary_plane
> > -extending patch for gen5+ platforms
> >
> > v5: Addressed Ville's review comments
> > -Making mmio flip vs cs flip selection based on module parameter
> > -Adding check for DRIVER_MODESET feature in notify_ring before calling
> > notify mmio flip.
> > -Other changes mostly in function arguments
> >
> > v6: -Having a seperate function to check condition for using mmio flips (Ville)
> > -propogating error code from i915_gem_check_olr (Ville)
> >
> > v7: -Adding __must_check with i915_gem_check_olr (Chris)
> > -Renaming mmio_flip_data to mmio_flip (Chris)
> > -Rebasing on latest nightly
> >
> > v8: -Rebasing on latest code
> > -squash 3rd patch in series(mmio setbase vs page flip race) with this patch
> > -Added new tiling mode update in intel_do_mmio_flip (Chris)
> >
> > v9: -check for obj->last_write_seqno being 0 instead of obj->ring being NULL in
> > intel_postpone_flip, as this is a more restrictive condition (Chris)
> >
> > v10: -Applied Chris's suggestions for squashing patches 2,3 into this patch.
> > These patches make the selection of CS vs MMIO flip at the page flip time, and
> > make the module parameter for using mmio flips as tristate, the states being
> > 'force CS flips', 'force mmio flips', 'driver discretion'.
> > Changed the logic for driver discretion (Chris)
> >
> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Sourab Gupta <sourab.gupta@intel.com>
> > Signed-off-by: Akash Goel <akash.goel@intel.com>
> Tested-by: Chris Wilson <chris@chris-wilson.co.uk> # snb, ivb
>
> Really happy with this now, just a few irrelevant bikesheds.
>
> > -static int
> > +__must_check int
> > i915_gem_check_olr(struct intel_engine_cs *ring, u32 seqno)
> > {
>
> Only the declaration requires the __must_check attribute, we don't need
> it here as well.
>
> > int ret;
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > index 4ef6423..e0edb1f 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -1218,6 +1218,9 @@ static void notify_ring(struct drm_device *dev,
> >
> > trace_i915_gem_request_complete(ring);
> >
> > + if (drm_core_check_feature(dev, DRIVER_MODESET))
> > + intel_notify_mmio_flip(ring);
> > +
>
> I wish Ville had suggested making UMS do the extra work of setting up
> the spinlock instead.
>
> > +static bool use_mmio_flip(struct intel_engine_cs *ring,
> > + struct drm_i915_gem_object *obj)
> > +{
> > + /* This is not being used for older platforms, because
> > + * non-availability of flip done interrupt forces us to use
> > + * CS flips. Older platforms derive flip done using some clever
> > + * tricks involving the flip_pending status bits and vblank irqs.
> > + * So using MMIO flips there would disrupt this mechanism.
> > + */
> > +
> > + if (INTEL_INFO(ring->dev)->gen < 5)
> > + return false;
> > +
> > + if (i915.use_mmio_flip < 0)
> > + return false;
> > + else if (i915.use_mmio_flip > 0)
> > + return true;
> > + else
> > + return ring != obj->ring;
> > +}
>
> Check whitespace.
>
Hi Chris,
Couldn't get the whitespace error here, and at other places. Also,
checkpatch.pl doesn't show any. Can you please point out the error.
Thanks,
Sourab
> > +
> > +static void intel_do_mmio_flip(struct intel_crtc *intel_crtc)
> > +{
> > + struct drm_device *dev = intel_crtc->base.dev;
> > + struct drm_i915_private *dev_priv = dev->dev_private;
> > + struct intel_framebuffer *intel_fb =
> > + to_intel_framebuffer(intel_crtc->base.primary->fb);
> > + struct drm_i915_gem_object *obj = intel_fb->obj;
> > + u32 dspcntr;
> > + u32 reg;
> > +
> > + intel_mark_page_flip_active(intel_crtc);
> > +
> > + reg = DSPCNTR(intel_crtc->plane);
> > + dspcntr = I915_READ(reg);
> > +
> > + if (INTEL_INFO(dev)->gen >= 4) {
> > + if (obj->tiling_mode != I915_TILING_NONE)
> > + dspcntr |= DISPPLANE_TILED;
> > + else
> > + dspcntr &= ~DISPPLANE_TILED;
> > + }
> > + I915_WRITE(reg, dspcntr);
> > +
> > + I915_WRITE(DSPSURF(intel_crtc->plane),
> > + intel_crtc->unpin_work->gtt_offset);
> > + POSTING_READ(DSPSURF(intel_crtc->plane));
> > +}
> > +
> > +static int intel_postpone_flip(struct drm_i915_gem_object *obj)
> > +{
> struct intel_engine_cs *ring = obj->ring; // will save our eyes
> > + int ret;
> > +
>
> // I had to go back and check the locking, so save the
> // next person the same task.
> lockdep_assert_held(&obj->base.dev->struct_mutex);
>
> > + if (!obj->last_write_seqno)
> > + return 0;
> > +
> > + if (i915_seqno_passed(obj->ring->get_seqno(obj->ring, true),
> > + obj->last_write_seqno))
> > + return 0;
> > +
> > + ret = i915_gem_check_olr(obj->ring, obj->last_write_seqno);
> > + if (ret)
> > + return ret;
> > +
> > + if (WARN_ON(!obj->ring->irq_get(obj->ring)))
> > + return 0;
> > +
> > + return 1;
> > +}
> > +
> > +void intel_notify_mmio_flip(struct intel_engine_cs *ring)
> > +{
> > + struct drm_i915_private *dev_priv = ring->dev->dev_private;
>
> struct drm_i915_private *dev_priv = to_i915(ring->dev);
>
> > + struct intel_crtc *intel_crtc;
> > + unsigned long irq_flags;
> > + u32 seqno;
> > +
> > + seqno = ring->get_seqno(ring, false);
> > +
> > + spin_lock_irqsave(&dev_priv->mmio_flip_lock, irq_flags);
> > + for_each_intel_crtc(ring->dev, intel_crtc) {
> > + struct intel_mmio_flip *mmio_flip;
> > +
> > + mmio_flip = &intel_crtc->mmio_flip;
> > + if (mmio_flip->seqno == 0)
> > + continue;
> > +
> > + if (ring->id != mmio_flip->ring_id)
> > + continue;
> > +
> > + if (i915_seqno_passed(seqno, mmio_flip->seqno)) {
> > + intel_do_mmio_flip(intel_crtc);
> > + mmio_flip->seqno = 0;
> > + ring->irq_put(ring);
> > + }
> > + }
> > + spin_unlock_irqrestore(&dev_priv->mmio_flip_lock, irq_flags);
> > +}
> > +
> > +static int intel_queue_mmio_flip(struct drm_device *dev,
> > + struct drm_crtc *crtc,
> > + struct drm_framebuffer *fb,
> > + struct drm_i915_gem_object *obj,
> > + struct intel_engine_cs *ring,
> > + uint32_t flags)
> > +{
> > + struct drm_i915_private *dev_priv = dev->dev_private;
> > + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > + unsigned long irq_flags;
> > + int ret;
> > +
> > + if (WARN_ON(intel_crtc->mmio_flip.seqno))
> > + return -EBUSY;
> > +
> > + ret = intel_postpone_flip(obj);
> > + if (ret < 0)
> > + return ret;
> > + if (ret == 0) {
> > + intel_do_mmio_flip(intel_crtc);
> > + return 0;
> > + }
> > +
> > + spin_lock_irqsave(&dev_priv->mmio_flip_lock, irq_flags);
> > + intel_crtc->mmio_flip.seqno = obj->last_write_seqno;
> > + intel_crtc->mmio_flip.ring_id = obj->ring->id;
> > + spin_unlock_irqrestore(&dev_priv->mmio_flip_lock, irq_flags);
> > +
> > + /* Double check to catch cases where irq fired before
> > + * mmio flip data was ready
> > + */
> > + intel_notify_mmio_flip(obj->ring);
> > + return 0;
> > +}
>
> Check whitespace.
> -Chris
>
next prev parent reply other threads:[~2014-06-02 10:38 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 11:26 [PATCH 0/2] Using MMIO based flips on VLV akash.goel
2014-01-09 11:26 ` [PATCH 1/2] drm/i915: Creating a new workqueue to handle MMIO flip work items akash.goel
2014-01-09 11:26 ` [PATCH 2/2] drm/i915/vlv: Replaced Blitter ring based flips with MMIO Flips for VLV akash.goel
2014-01-09 11:31 ` Chris Wilson
2014-01-13 9:47 ` Goel, Akash
2014-02-07 11:59 ` Goel, Akash
2014-02-07 14:47 ` Daniel Vetter
2014-02-07 17:17 ` Goel, Akash
[not found] ` <8BF5CF93467D8C498F250C96583BC09CC718E3@BGSMSX103.gar.corp.intel.com>
2014-03-07 13:17 ` Gupta, Sourab
2014-03-07 13:30 ` Ville Syrjälä
2014-03-13 7:21 ` [PATCH] drm/i915: Replaced Blitter ring based flips with MMIO flips " sourab.gupta
2014-03-13 9:01 ` [PATCH v2] " sourab.gupta
2014-03-17 4:33 ` Gupta, Sourab
2014-03-21 17:10 ` Gupta, Sourab
2014-03-21 18:15 ` Damien Lespiau
2014-03-23 9:01 ` [PATCH v3] " sourab.gupta
2014-03-26 7:49 ` Gupta, Sourab
2014-04-03 8:40 ` Gupta, Sourab
2014-04-07 11:19 ` Gupta, Sourab
2014-05-09 11:59 ` Ville Syrjälä
2014-05-09 13:28 ` Ville Syrjälä
2014-05-09 17:18 ` Ville Syrjälä
2014-05-15 6:17 ` [PATCH v4] " sourab.gupta
2014-05-15 12:27 ` Ville Syrjälä
2014-05-16 12:34 ` Gupta, Sourab
2014-05-16 12:51 ` Ville Syrjälä
2014-05-19 9:19 ` Gupta, Sourab
2014-05-19 10:58 ` [PATCH v5] " sourab.gupta
2014-05-19 11:47 ` Ville Syrjälä
2014-05-19 12:29 ` Daniel Vetter
2014-05-19 13:06 ` Ville Syrjälä
2014-05-19 13:41 ` Daniel Vetter
2014-05-20 10:49 ` [PATCH 0/3] Replace Blitter ring based flips with MMIO flips sourab.gupta
2014-05-20 10:49 ` [PATCH v6 1/3] drm/i915: Replaced " sourab.gupta
2014-05-20 11:59 ` Chris Wilson
2014-05-20 18:01 ` Gupta, Sourab
2014-05-22 14:36 ` [PATCH v2 0/3] Replace " sourab.gupta
2014-05-22 14:36 ` [PATCH v7 1/3] drm/i915: Replaced " sourab.gupta
2014-05-27 12:52 ` Ville Syrjälä
2014-05-27 13:09 ` Daniel Vetter
2014-05-28 7:12 ` [PATCH v3 0/2] Replace " sourab.gupta
2014-05-28 7:12 ` [PATCH 1/2] drm/i915: Replaced " sourab.gupta
2014-05-28 7:30 ` Chris Wilson
2014-05-28 9:42 ` Gupta, Sourab
2014-05-28 7:31 ` Chris Wilson
2014-05-28 8:12 ` Ville Syrjälä
2014-05-28 7:12 ` [PATCH 2/2] drm/i915: Default to mmio flips on VLV sourab.gupta
2014-05-28 9:56 ` Chris Wilson
2014-05-29 9:40 ` [PATCH v4 0/3] Replace Blitter ring based flips with MMIO flips sourab.gupta
2014-05-29 9:40 ` [PATCH v9 1/3] drm/i915: Replaced " sourab.gupta
2014-05-30 10:31 ` Chris Wilson
2014-05-29 9:40 ` [PATCH 2/3] drm/i915: Selection of MMIO vs CS flip at page flip time sourab.gupta
2014-05-29 9:40 ` [PATCH 3/3] drm/i915: Make module param for MMIO flip selection as tristate sourab.gupta
2014-05-30 10:49 ` Chris Wilson
2014-06-01 11:13 ` [PATCH v10] drm/i915: Replaced Blitter ring based flips with MMIO flips sourab.gupta
2014-06-02 6:56 ` Chris Wilson
2014-06-02 10:38 ` Gupta, Sourab [this message]
2014-06-02 10:56 ` Chris Wilson
2014-06-02 11:17 ` [PATCH v11] " sourab.gupta
2014-06-17 14:14 ` Daniel Vetter
2014-06-17 14:17 ` Chris Wilson
2014-05-22 14:36 ` [PATCH 2/3] drm/i915: Default to mmio flips on VLV sourab.gupta
2014-05-22 14:36 ` [PATCH 3/3] drm/i915: Fix mmio page flip vs mmio set base race sourab.gupta
2014-05-26 8:51 ` [PATCH v2 0/3] Replace Blitter ring based flips with MMIO flips Gupta, Sourab
2014-05-20 10:49 ` [PATCH 2/3] drm/i915: Default to mmio flips on VLV sourab.gupta
2014-05-20 10:49 ` [PATCH 3/3] drm/i915: Fix mmio page flip vs mmio set base race sourab.gupta
2014-01-09 11:29 ` [PATCH 0/2] Using MMIO based flips on VLV 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=1401705543.9396.110.camel@sourabgu-desktop \
--to=sourab.gupta@intel.com \
--cc=akash.goel@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=deepak.s@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