public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 3/5] drm/i915: Make sprite updates atomic
Date: Thu, 13 Feb 2014 18:43:51 +0200	[thread overview]
Message-ID: <20140213164351.GE3852@intel.com> (raw)
In-Reply-To: <20140213160152.GC29357@nuc-i3427.alporthouse.com>

On Thu, Feb 13, 2014 at 04:01:52PM +0000, Chris Wilson wrote:
> On Thu, Feb 13, 2014 at 05:42:52PM +0200, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Add a mechanism by which we can evade the leading edge of vblank. This
> > guarantees that no two sprite register writes will straddle on either
> > side of the vblank start, and that means all the writes will be latched
> > together in one atomic operation.
> > 
> > We do the vblank evade by checking the scanline counter, and if it's too
> > close to the start of vblank (too close has been hardcoded to 100usec
> > for now), we will wait for the vblank start to pass. In order to
> > eliminate random delayes from the rest of the system, we operate with
> > interrupts disabled, except when waiting for the vblank obviously.
> > 
> > Note that we now go digging through pipe_to_crtc_mapping[] in the
> > vblank interrupt handler, which is a bit dangerous since we set up
> > interrupts before the crtcs. However in this case since it's the vblank
> > interrupt, we don't actually unmask it until some piece of code
> > requests it.
> > 
> > v2: preempt_check_resched() calls after local_irq_enable() (Jesse)
> >     Hook up the vblank irq stuff on BDW as well
> > v3: Pass intel_crtc instead of drm_crtc (Daniel)
> >     Warn if crtc.mutex isn't locked (Daniel)
> >     Add an explicit compiler barrier and document the barriers (Daniel)
> >     Note the irq vs. modeset setup madness in the commit message (Daniel)
> > v4: Use prepare_to_wait() & co. directly and eliminate vbl_received
> 
> intel_pipe_update_start / intel_pipe_update_end are unbalanced (end()
> does too much in the cases where start() failed.)

Ah the drm_vblank_get() fail. Should never happen. But I guess I could
make intel_pipe_update_start() return something to tell the caller
whether it needs to call intel_pipe_update_end().

> 
> intel_pipe_update_start should check for min <= 0 (i.e.
> usecs_to_scanline() returns a value greater than vblank_start).

Mode w/ vertical active portion of < 100 usec. Sounds rather unlikely,
but I suppose I could add a check for that too while I'm at it.

> 
> intel_pipe_update_end() could do a sanity check that it is in the same
> frame as start() and so give us warning when the code is broken.

I think I had something like that a long time, but it vanished along the
way. I'll add it. Getting a clear indication that things went south is
better than just some silent glitch on the screen. On gen2 we don't have
a frame counter but since it always returns 0, I don't even need to
add a special case. We just can't detect the failure on gen2.

> 
> Looks like drm_handle_vblank() could be moved to
> intel_pipe_handle_vblank() for a small refactoring win.

Hmm, yeah. I just need to make intel_pipe_handle_vblank() propagate
the return value from drm_handle_vblank(). Seems cleaner, consider
it done.

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-02-13 16:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 15:42 [PATCH v3 0/5] drm/i915: Atomic sprites v3 ville.syrjala
2014-02-13 15:42 ` [PATCH 1/5] drm/i915: Fix scanout position for real ville.syrjala
2014-03-14  6:16   ` akash goel
2014-04-01 10:36     ` Ville Syrjälä
2014-02-13 15:42 ` [PATCH v3 2/5] drm/i915: Add intel_get_crtc_scanline() ville.syrjala
2014-02-14 12:05   ` [PATCH v4 " ville.syrjala
2014-02-13 15:42 ` [PATCH v4 3/5] drm/i915: Make sprite updates atomic ville.syrjala
2014-02-13 16:01   ` Chris Wilson
2014-02-13 16:43     ` Ville Syrjälä [this message]
2014-02-13 19:42     ` [PATCH v5 " ville.syrjala
2014-02-14 12:06       ` [PATCH v6 " ville.syrjala
2014-02-14 12:50         ` [PATCH v7 " ville.syrjala
2014-03-07 13:42           ` [PATCH v8 " ville.syrjala
2014-03-07 15:57             ` Jesse Barnes
2014-02-13 15:42 ` [PATCH v2 4/5] drm/i915: Perform primary enable/disable atomically with sprite updates ville.syrjala
2014-02-13 15:42 ` [PATCH v3 5/5] drm/i915: Add pipe update trace points ville.syrjala
2014-02-13 19:43   ` [PATCH v4 " ville.syrjala
2014-02-14 12:07 ` [PATCH 6/5] drm/i915: Add a small adjustment to the pixel counter on interlaced modes ville.syrjala
2014-02-18 12:04 ` [PATCH 7/5] drm/i915: Improve gen3/4 frame counter ville.syrjala
2014-02-18 12:04   ` [PATCH 8/5] drm/i915: Fix gen2 scanline counter ville.syrjala
2014-02-20 11:12     ` [PATCH v2 " ville.syrjala
2014-02-18 12:04   ` [PATCH 9/5] drm/i915: Draw a picture about video timings ville.syrjala
2014-02-20 11:14     ` [PATCH v2 " ville.syrjala
2014-02-20 13:42       ` Imre Deak
2014-02-18 14:16   ` [PATCH 7/5] drm/i915: Improve gen3/4 frame counter Imre Deak
2014-02-18 14:41     ` Ville Syrjälä
2014-02-18 15:11       ` Imre Deak
2014-04-09 15:03 ` [PATCH v3 0/5] drm/i915: Atomic sprites v3 sourab gupta
2014-04-09 15:08 ` akash goel

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=20140213164351.GE3852@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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