1. 24 8月, 2016 3 次提交
  2. 23 8月, 2016 5 次提交
    • L
      drm/i915/skl: Update plane watermarks atomically during plane updates · 62e0fb88
      Lyude 提交于
      Thanks to Ville for suggesting this as a potential solution to pipe
      underruns on Skylake.
      
      On Skylake all of the registers for configuring planes, including the
      registers for configuring their watermarks, are double buffered. New
      values written to them won't take effect until said registers are
      "armed", which is done by writing to the PLANE_SURF (or in the case of
      cursor planes, the CURBASE register) register.
      
      With this in mind, up until now we've been updating watermarks on skl
      like this:
      
        non-modeset {
         - calculate (during atomic check phase)
         - finish_atomic_commit:
           - intel_pre_plane_update:
              - intel_update_watermarks()
           - {vblank happens; new watermarks + old plane values => underrun }
           - drm_atomic_helper_commit_planes_on_crtc:
              - start vblank evasion
              - write new plane registers
              - end vblank evasion
        }
      
        or
      
        modeset {
         - calculate (during atomic check phase)
         - finish_atomic_commit:
           - crtc_enable:
              - intel_update_watermarks()
           - {vblank happens; new watermarks + old plane values => underrun }
           - drm_atomic_helper_commit_planes_on_crtc:
              - start vblank evasion
              - write new plane registers
              - end vblank evasion
        }
      
      Now we update watermarks atomically like this:
      
        non-modeset {
         - calculate (during atomic check phase)
         - finish_atomic_commit:
           - intel_pre_plane_update:
              - intel_update_watermarks() (wm values aren't written yet)
           - drm_atomic_helper_commit_planes_on_crtc:
              - start vblank evasion
              - write new plane registers
              - write new wm values
              - end vblank evasion
        }
      
        modeset {
         - calculate (during atomic check phase)
         - finish_atomic_commit:
           - crtc_enable:
              - intel_update_watermarks() (actual wm values aren't written
                yet)
           - drm_atomic_helper_commit_planes_on_crtc:
              - start vblank evasion
              - write new plane registers
      	- write new wm values
              - end vblank evasion
        }
      
      So this patch moves all of the watermark writes into the right place;
      inside of the vblank evasion where we update all of the registers for
      each plane. While this patch doesn't fix everything, it does allow us to
      update the watermark values in the way the hardware expects us to.
      
      Changes since original patch series:
       - Remove mutex_lock/mutex_unlock since they don't do anything and we're
         not touching global state
       - Move skl_write_cursor_wm/skl_write_plane_wm functions into
         intel_pm.c, make externally visible
       - Add skl_write_plane_wm calls to skl_update_plane
       - Fix conditional for for loop in skl_write_plane_wm (level < max_level
         should be level <= max_level)
       - Make diagram in commit more accurate to what's actually happening
       - Add Fixes:
      
      Changes since v1:
       - Use IS_GEN9() instead of IS_SKYLAKE() since these fixes apply to more
         then just Skylake
       - Update description to make it clear this patch doesn't fix everything
       - Check if pipes were actually changed before writing watermarks
      
      Changes since v2:
       - Write PIPE_WM_LINETIME during vblank evasion
      
      Changes since v3:
       - Rebase against new SAGV patch changes
      
      Changes since v4:
       - Add a parameter to choose what skl_wm_values struct to use when
         writing new plane watermarks
      
      Changes since v5:
       - Remove cursor ddb entry write in skl_write_cursor_wm(), defer until
         patch 6
       - Write WM_LINETIME in intel_begin_crtc_commit()
      
      Changes since v6:
       - Remove redundant dirty_pipes check in skl_write_plane_wm (we check
         this in all places where we call this function, and it was supposed
         to have been removed earlier anyway)
       - In i9xx_update_cursor(), use dev_priv->info.gen >= 9 instead of
         IS_GEN9(dev_priv). We do this everywhere else and I'd imagine this
         needs to be done for gen10 as well
      
      Changes since v7:
       - Fix rebase fail (unused variable obj)
       - Make struct skl_wm_values *wm const
       - Fix indenting
       - Use INTEL_GEN() instead of dev_priv->info.gen
      
      Changes since v8:
       - Don't forget calls to skl_write_plane_wm() when disabling planes
       - Use INTEL_GEN(), not INTEL_INFO()->gen in intel_begin_crtc_commit()
      
      Fixes: 2d41c0b5 ("drm/i915/skl: SKL Watermark Computation")
      Signed-off-by: NLyude <cpaul@redhat.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Cc: stable@vger.kernel.org
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1471884608-10671-1-git-send-email-cpaul@redhat.com
      Link: http://patchwork.freedesktop.org/patch/msgid/1471884608-10671-1-git-send-email-cpaul@redhat.com
      62e0fb88
    • M
      0a478c27
    • M
      drm/i915: Pass crtc_state and connector_state to encoder functions · fd6bbda9
      Maarten Lankhorst 提交于
      This is mostly code churn, with exception of a few places:
      - intel_display.c has changes in intel_sanitize_encoder
      - intel_ddi.c has intel_ddi_fdi_disable calling intel_ddi_post_disable,
        and required a function change. Also affects intel_display.c
      - intel_dp_mst.c passes a NULL crtc_state and conn_state to
        intel_ddi_post_disable for shutting down the real encoder.
      
        If we would pass conn_state, then conn_state->connector !=
        intel_dig_port->connector and conn_state->best_encoder !=
        to_intel_encoder(intel_dig_port).
      
        We also shouldn't pass crtc_state, because in that case the
        disabling sequence may potentially be different depending on
        which crtc is disabled last. Nice way to introduce bugs.
      
      No other functional changes are done, diff stat is already huge.
      Each encoder type will need to be fixed to use the atomic states
      separately.
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470755054-32699-6-git-send-email-maarten.lankhorst@linux.intel.comReviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      fd6bbda9
    • M
      drm/i915: Walk over encoders in crtc enable/disable using atomic state. · fb1c98b1
      Maarten Lankhorst 提交于
      This cleans up another possible use of the connector list,
      encoder->crtc is legacy state and should not be used.
      
      With the atomic state as argument it's easy to find the encoder from
      the connector it belongs to.
      
      intel_opregion_notify_encoder is a noop for !HAS_DDI, so it's harmless
      to unconditionally include it in encoder enable/disable.
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470755054-32699-5-git-send-email-maarten.lankhorst@linux.intel.comReviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      fb1c98b1
    • M
      drm/i915: Pass atomic state to crtc enable/disable functions · 4a806558
      Maarten Lankhorst 提交于
      This is required for supporting nonblocking modesets. Iterating over
      the connector list will no longer be allowed when we don't hold
      connection_mutex, so we have to use the atomic state.
      
      Fix disable_noatomic by populating the minimal state required to
      disable a connector.
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470755054-32699-3-git-send-email-maarten.lankhorst@linux.intel.comReviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4a806558
  3. 22 8月, 2016 3 次提交
    • D
      drm/i915: pdev cleanup · 52a05c30
      David Weinehall 提交于
      In an effort to simplify things for a future push of dev_priv instead
      of dev wherever possible, always take pdev via dev_priv where
      feasible, eliminating the direct access from dev. Right now this
      only eliminates a few cases of dev, but it also obviates that we pass
      dev into a lot of functions where dev_priv would be the more obvious
      choice.
      
      v2: Fixed one more place missing in the previous patch set
      Signed-off-by: NDavid Weinehall <david.weinehall@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160822103245.24069-5-david.weinehall@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      52a05c30
    • L
      drm/i915/skl: Add support for the SAGV, fix underrun hangs · 656d1b89
      Lyude 提交于
      Since the watermark calculations for Skylake are still broken, we're apt
      to hitting underruns very easily under multi-monitor configurations.
      While it would be lovely if this was fixed, it's not. Another problem
      that's been coming from this however, is the mysterious issue of
      underruns causing full system hangs. An easy way to reproduce this with
      a skylake system:
      
      - Get a laptop with a skylake GPU, and hook up two external monitors to
        it
      - Move the cursor from the built-in LCD to one of the external displays
        as quickly as you can
      - You'll get a few pipe underruns, and eventually the entire system will
        just freeze.
      
      After doing a lot of investigation and reading through the bspec, I
      found the existence of the SAGV, which is responsible for adjusting the
      system agent voltage and clock frequencies depending on how much power
      we need. According to the bspec:
      
      "The display engine access to system memory is blocked during the
       adjustment time. SAGV defaults to enabled. Software must use the
       GT-driver pcode mailbox to disable SAGV when the display engine is not
       able to tolerate the blocking time."
      
      The rest of the bspec goes on to explain that software can simply leave
      the SAGV enabled, and disable it when we use interlaced pipes/have more
      then one pipe active.
      
      Sure enough, with this patchset the system hangs resulting from pipe
      underruns on Skylake have completely vanished on my T460s. Additionally,
      the bspec mentions turning off the SAGV	with more then one pipe enabled
      as a workaround for display underruns. While this patch doesn't entirely
      fix that, it looks like it does improve the situation a little bit so
      it's likely this is going to be required to make watermarks on Skylake
      fully functional.
      
      This will still need additional work in the future: we shouldn't be
      enabling the SAGV if any of the currently enabled planes can't enable WM
      levels that introduce latencies >= 30 µs.
      
      Changes since v11:
       - Add skl_can_enable_sagv()
       - Make sure we don't enable SAGV when not all planes can enable
         watermarks >= the SAGV engine block time. I was originally going to
         save this for later, but I recently managed to run into a machine
         that was having problems with a single pipe configuration + SAGV.
       - Make comparisons to I915_SKL_SAGV_NOT_CONTROLLED explicit
       - Change I915_SAGV_DYNAMIC_FREQ to I915_SAGV_ENABLE
       - Move printks outside of mutexes
       - Don't print error messages twice
      Changes since v10:
       - Apparently sandybridge_pcode_read actually writes values and reads
         them back, despite it's misleading function name. This means we've
         been doing this mostly wrong and have been writing garbage to the
         SAGV control. Because of this, we no longer attempt to read the SAGV
         status during initialization (since there are no helpers for this).
       - mlankhorst noticed that this patch was breaking on some very early
         pre-release Skylake machines, which apparently don't allow you to
         disable the SAGV. To prevent machines from failing tests due to SAGV
         errors, if the first time we try to control the SAGV results in the
         mailbox indicating an invalid command, we just disable future attempts
         to control the SAGV state by setting dev_priv->skl_sagv_status to
         I915_SKL_SAGV_NOT_CONTROLLED and make a note of it in dmesg.
       - Move mutex_unlock() a little higher in skl_enable_sagv(). This
         doesn't actually fix anything, but lets us release the lock a little
         sooner since we're finished with it.
      Changes since v9:
       - Only enable/disable sagv on Skylake
      Changes since v8:
       - Add intel_state->modeset guard to the conditional for
         skl_enable_sagv()
      Changes since v7:
       - Remove GEN9_SAGV_LOW_FREQ, replace with GEN9_SAGV_IS_ENABLED (that's
         all we use it for anyway)
       - Use GEN9_SAGV_IS_ENABLED instead of 0x1 for clarification
       - Fix a styling error that snuck past me
      Changes since v6:
       - Protect skl_enable_sagv() with intel_state->modeset conditional in
         intel_atomic_commit_tail()
      Changes since v5:
       - Don't use is_power_of_2. Makes things confusing
       - Don't use the old state to figure out whether or not to
         enable/disable the sagv, use the new one
       - Split the loop in skl_disable_sagv into it's own function
       - Move skl_sagv_enable/disable() calls into intel_atomic_commit_tail()
      Changes since v4:
       - Use is_power_of_2 against active_crtcs to check whether we have > 1
         pipe enabled
       - Fix skl_sagv_get_hw_state(): (temp & 0x1) indicates disabled, 0x0
         enabled
       - Call skl_sagv_enable/disable() from pre/post-plane updates
      Changes since v3:
       - Use time_before() to compare timeout to jiffies
      Changes since v2:
       - Really apply minor style nitpicks to patch this time
      Changes since v1:
       - Added comments about this probably being one of the requirements to
         fixing Skylake's watermark issues
       - Minor style nitpicks from Matt Roper
       - Disable these functions on Broxton, since it doesn't have an SAGV
      Signed-off-by: NLyude <cpaul@redhat.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1471463761-26796-3-git-send-email-cpaul@redhat.com
      [mlankhorst: ENOSYS -> ENXIO, whitespace fixes]
      656d1b89
    • P
      drm/i915: Call intel_fbc_pre_update() after pinning the new pageflip · 1f061316
      Paulo Zanoni 提交于
      intel_fbc_pre_update() depends upon the new state being already pinned
      in place in the Global GTT (primarily for both fencing which wants both
      an offset and a fence register, if assigned). This requires the call to
      intel_fbc_pre_update() be after intel_pin_and_fence_fb() - but commit
      e8216e50 ("drm/i915/fbc: call intel_fbc_pre_update earlier during
      page flips") moved the code way too much up in its attempt to call it
      before the page flip.
      
      v2 (from Paulo):
       - Point the original bad commit.
       - Add a comment to maybe prevent further regressions.
      
      Fixes: e8216e50 ("drm/i915/fbc: call intel_fbc_pre_update earlier...")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
      Cc: drm-intel-fixes@lists.freedesktop.org
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: http://patchwork.freedesktop.org/patch/msgid/1471462904-842-1-git-send-email-paulo.r.zanoni@intel.com
      Cc: stable@vger.kernel.org
      1f061316
  4. 19 8月, 2016 2 次提交
  5. 15 8月, 2016 3 次提交
  6. 11 8月, 2016 11 次提交
  7. 10 8月, 2016 2 次提交
  8. 09 8月, 2016 4 次提交
  9. 06 8月, 2016 6 次提交
  10. 05 8月, 2016 1 次提交