1. 22 5月, 2014 3 次提交
    • V
      drm/i915: Wait for pending page flips before enabling/disabling the primary plane · 46a55d30
      Ville Syrjälä 提交于
      We have to write to the primary plane base address registrer when we
      enable/disable the primary plane in response to sprite coverage. Those
      writes will cause the flip counter to increment which could interfere
      with the detection of CS flip completion. We could end up completing
      CS flips before the CS has even executed the commands from the ring.
      
      To avoid such issues, wait for CS flips to finish before we toggle the
      primary plane on/off.
      
      v2: Rebased due to atomic sprite update changes
      
      Testcase: igt/kms_mmio_vs_cs_flip/setplane_vs_cs_flip
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by Rodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      46a55d30
    • V
      drm/i915: Shuffle fifo underrun disable/enable points for gmch platforms · 4a3436e8
      Ville Syrjälä 提交于
      Gen2 reports FIFO underruns whenever no planes are enabled on the pipe.
      So in order to avoid false positives we must enable the FIFO underrun
      reporting only when at least one plane is enabled on the pipe. For
      now just move the underrun reporting enable/disable points to the
      other side of the plane enable/disable point. That doesn't cover cases
      when we turn off all the planes for the pipe but leave the pipe running
      on purpose, but it's better than the current situation.
      
      On gen4+ we can actually move the underrun reporting enable/disable to
      the opposite ends of the crtc enable/disable hooks. I suppose in theory
      we could leave the underrun reporting enabled all the time, except on
      VLV where PIPESTAT stops working when the display power well is down.
      If we ever get around to unifying the PIPESTAT irq handling for all
      gmch platforms, we should still follow the VLV route for other platforms.
      It would also micro-optimize the irq handler a bit since we could then
      skip the PIPESTAT reads for all disabled pipes.
      
      Gen3 is still a mystery, but for now I'm going to assume it behaves
      like gen4+.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NThomas Wood <thomas.wood@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4a3436e8
    • V
      drm/i915: Check for FIFO underruns at the end of modeset on gmch · 56b80e1f
      Ville Syrjälä 提交于
      FIFO underruns don't generate interrupts on gmch platforms, so
      if we want to know whether a modeset triggered FIFO underruns we
      need to explicitly check for them.
      
      As a modeset on one pipe could cause underruns on other pipes,
      check for underruns on all pipes.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NThomas Wood <thomas.wood@intel.com>
      [danvet: Fix up merge error, kudos to Ville for noticing it.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      56b80e1f
  2. 21 5月, 2014 9 次提交
    • V
      drm/i915: Re-enable vblank irqs for already active pipes · d3eaf884
      Ville Syrjälä 提交于
      If a pipe is already active when we init/resume there might not be a
      full modeset afterwards so drm_vblank_on() may not get called. In such
      a case if someone is holding a vblank reference across a suspend/resume
      cycle drm_vblank_get() called after resuming won't re-enable the vblank
      interrupts.
      
      So in order to make sure vblank interrupts get re-enabled post-resume,
      call drm_vblank_on() in intel_sanitize_crtc() if the crtc is already
      active.
      
      v2: Also drm_vblank_off() if the pipe got disabled magically
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Testecase: igt/kms_flip/vblank-vs-suspend
      Tested-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d3eaf884
    • D
      drm/i915: Accurately initialize fifo underrun state on gmch platforms · c5ab3bc0
      Daniel Vetter 提交于
      We don't have hardware based disable bits on gmch platforms, so need
      to block spurious underrun reports in software. Which means that we
      _must_ start out with fifo underrun reporting disabled everywhere.
      
      This is in big contrast to ilk/hsw/cpt where there's only _one_
      disable bit for all platforms and hence we must allow underrun
      reporting on disabled pipes. Otherwise nothing really works,
      especially the CRC support since that's key'ed off the same irq
      disable bit.
      
      This allows us to ditch the fifo underrun reporting hack from the vlv
      runtime pm code and unexport the internal function from i915_irq.c
      again. Yay!
      
      v2: Keep the display irq disabling, spotted by Imre.
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c5ab3bc0
    • D
      drm/i915: Use new kms-native vblank functions · 87b6b101
      Daniel Vetter 提交于
      Only the low-level irq handling functions still use integer crtc
      indices with this. But fixing that will require a lot more sugery
      and some good ideas for backwards compat with old ums userspace.
      Both in drivers and in the drm core.
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      87b6b101
    • D
      drm/i915: Remove drm_vblank_pre/post_modeset calls · add1d008
      Daniel Vetter 提交于
      Originally these functions have been for user modesetting drivers to
      ensure vblank processing doesn't fall over completely around modeset
      changes. This has been carried over ever since then.
      
      Now that Ville cleaned our vblank handling with an explicit
      drm_vblank_off/on braket when disabling/enabling crtcs. So this seems
      to be unnecessary now. The most important side effect was that due to
      the delayed vblank disabling we have been pretty much guaranteed to
      receive a vblank interrupt soonish after a crtc was enabled.
      
      Note that our vblank handling across modeset is still fairly decent
      fubar - we don't actually handle vblank counter all to well.
      drm_update_vblank_count will make sure that the frame counter always
      rolls forward, but userspace isn't really all to ready to cope with
      the big jumps this causes.
      
      This isn't a big mostly because the hardware retains the frame
      counter. But with runtime pm and also across suspend/resume we fall
      over.
      
      Fixing this is a lot more involved and also needs som i-g-ts. So
      material for another patch series.
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      add1d008
    • V
      drm/i915: Move buffer pinning and ring selection to intel_crtc_page_flip() · 4fa62c89
      Ville Syrjälä 提交于
      All of the .queue_flip() callbacks duplicate the same code to pin the
      buffers and calculate the gtt_offset. Move that code to
      intel_crtc_page_flip(). In order to do that we must also move the ring
      selection logic there.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4fa62c89
    • V
      drm/i915: Drop the excessive vblank waits from modeset codepaths · 6304cd91
      Ville Syrjälä 提交于
      Now that we've plugged the mmio vs. ring flip race, we shouldn't need
      these vblank waits in the modeset codepaths anymore. So get rid of
      them.
      
      v2: gen2 needs to wait for planes to turn off before disabling pipe
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6304cd91
    • V
      drm/i915: Wait for vblank in hsw_enable_ips() · cea165c3
      Ville Syrjälä 提交于
      Now that the vblank wait is gone from intel_enable_primary_plane(),
      hsw_enable_ips() needs to do the vblank wait itself.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      cea165c3
    • V
      drm/i915: Fix mmio vs. CS flip race on ILK+ · 75f7f3ec
      Ville Syrjälä 提交于
      Starting from ILK, mmio flips also cause a flip done interrupt to be
      signalled. This means if we first do a set_base and follow it
      immediately with the CS flip, we might mistake the flip done interrupt
      caused by the set_base as the flip done interrupt caused by the CS
      flip.
      
      The hardware has a flip counter which increments every time a mmio or
      CS flip is issued. It basically counts the number of DSPSURF register
      writes. This means we can sample the counter before we put the CS
      flip into the ring, and then when we get a flip done interrupt we can
      check whether the CS flip has actually performed the surface address
      update, or if the interrupt was caused by a previous but yet
      unfinished mmio flip.
      
      Even with the flip counter we still have a race condition of the CS flip
      base address update happens after the mmio flip done interrupt was
      raised but not yet processed by the driver. When the interrupt is
      eventually processed, the flip counter will already indicate that the
      CS flip has been executed, but it would not actually complete until the
      next start of vblank. We can use the DSPSURFLIVE register to check
      whether the hardware is actually scanning out of the buffer we expect,
      or if we managed hit this race window.
      
      This covers all the cases where the CS flip actually changes the base
      address. If the base address remains unchanged, we might still complete
      the CS flip before it has actually completed. But since the address
      didn't change anyway, the premature flip completion can't result in
      userspace overwriting data that's still being scanned out.
      
      CTG already has the flip counter and DSPSURFLIVE registers, and
      although the flip done interrupt is still limited to CS flips alone,
      the code now also checks the flip counter on CTG as well.
      
      v2: s/dspsurf/gtt_offset/ (Chris)
      
      Testcase: igt/kms_mmio_vs_cs_flip/setcrtc_vs_cs_flip
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73027Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      [danvet: Add g4x_ prefix to flip_count_after_eq.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      75f7f3ec
    • V
      drm: Add drm_vblank_on() · f2752282
      Ville Syrjälä 提交于
      drm_vblank_off() will turn off vblank interrupts, but as long as the
      refcount is elevated drm_vblank_get() will not re-enable them. This
      is a problem is someone is holding a vblank reference while a modeset is
      happening, and the driver requires vblank interrupt to work during that
      time.
      
      Add drm_vblank_on() as a counterpart to drm_vblank_off() which will
      re-enabled vblank interrupts if the refcount is already elevated. This
      will allow drivers to choose the specific places in the modeset sequence
      at which vblank interrupts get disabled and enabled.
      
      Testcase: igt/kms_flip/*-vs-suspend
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      [danvet: Add Testcase tag for the igt I've written.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f2752282
  3. 20 5月, 2014 15 次提交
  4. 19 5月, 2014 7 次提交
  5. 16 5月, 2014 4 次提交
  6. 14 5月, 2014 2 次提交