1. 06 May, 2014 5 commits
    • Ville Syrjälä's avatar
      drm/i915: Merge LP1+ watermarks in safer way · d52fea5b
      Ville Syrjälä authored
      On ILK when we disable a particular watermark level, we must
      maintain the actual watermark values for that level for some time
      (until the next vblank possibly). Otherwise we risk underruns.
      
      In order to achieve that result we must merge the LP1+ watermarks a
      bit differently since we must also merge levels that are to be
      disabled. We must also make sure we don't overflow the fields in the
      watermark registers in case the calculated watermarks come out too
      big to fit.
      
      As early as possbile we mark all computed watermark levels as
      disabled if they would exceed the register maximums. We make sure
      to leave the actual watermarks for such levels zeroed out. Then during
      merging, we take the maxium values for every level, regardless if
      they're disabled or not. That may seem a bit pointless since at the
      moment all the watermark levels we merge should have their values
      zeroed if the level is already disabled. However soon we will be
      dealing with intermediate watermarks that, in addition to the new
      watermark values, also contain the previous watermark values, and so
      levels that are disabled may no longer be zeroed out.
      
      v2: Split the patch in two (Paulo)
          Use if() instead of & when merging ->enable (Paulo)
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      [danvet: Fix commit message as noted by Paulo.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      d52fea5b
    • Ville Syrjälä's avatar
      drm/i915: Make sure computed watermarks never overflow the registers · a3cb4048
      Ville Syrjälä authored
      When we calculate the watermarks for a pipe make sure we leave any
      level fully zeroed out if it would exceed any of the maximum values
      that fit in the registers.
      
      This will be important later when we start to use also disabled
      watermark levels during LP1+ merging.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      a3cb4048
    • Ville Syrjälä's avatar
      drm/i915: Add pipe update trace points · 25ef284a
      Ville Syrjälä authored
      Add trace points for observing the atomic pipe update mechanism.
      
      v2: Rebased due to earlier changes
      v3: Pass intel_crtc instead of drm_crtc (Daniel)
      v4: Pass frame counter from the caller to evaded/end since
          the caller now always has that ready
      Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Reviewed-by: default avatarSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: default avatarAkash Goel <akash.goels@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      25ef284a
    • Ville Syrjälä's avatar
      drm/i915: Perform primary enable/disable atomically with sprite updates · 5b633d6b
      Ville Syrjälä authored
      Move the primary plane enable/disable to occur atomically with the
      sprite update that caused the primary plane visibility to change.
      
      FBC and IPS enable/disable is left to happen well before or after
      the primary plane change.
      
      v2: Pass intel_crtc instead of drm_crtc (Daniel)
      Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Reviewed-by: default avatarSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: default avatarAkash Goel <akash.goels@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      5b633d6b
    • Ville Syrjälä's avatar
      drm/i915: Make sprite updates atomic · 8d7849db
      Ville Syrjälä authored
      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
      v5: Refactor intel_pipe_handle_vblank() vs. drm_handle_vblank() (Chris)
          Check for min/max scanline <= 0 (Chris)
          Don't call intel_pipe_update_end() if start failed totally (Chris)
          Check that the vblank counters match on both sides of the critical
          section (Chris)
      v6: Fix atomic update for interlaced modes
      v7: Reorder code for better readability (Chris)
      v8: Drop preempt_check_resched(). It's not available to modules
          anymore and isn't even needed unless we ourselves cause
          a wakeup needing reschedule while interrupts are off
      Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Reviewed-by: default avatarSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: default avatarAkash Goel <akash.goels@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      8d7849db
  2. 05 May, 2014 35 commits