1. 30 4月, 2019 5 次提交
    • N
      drm/amd/display: Allow commits with no planes active · bc92c065
      Nicholas Kazlauskas 提交于
      [Why]
      Many userspace applications (and IGT) seem to expect that most drivers
      can keep a CRTC active and enabled if there are no primary or overlay
      planes.
      
      DC is setup to handle this but only in the case where there are
      absolutely no planes on the CRTC - no primary, cursor, or overlay.
      
      [How]
      Add a check to reject commits that have cursor planes enabled and
      nothing else on CRTCs since we can't handle that. The new helper
      does_crtc_have_active_cursor is used for this.
      
      In atomic commit tail, we need to let DC know that there are zero
      planes enabled when doing stream updates to let it disable and blank
      pipes as appropriate.
      Signed-off-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: NDavid Francis <David.Francis@amd.com>
      Acked-by: NLeo Li <sunpeng.li@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      bc92c065
    • N
      drm/amd/display: Split enabling CRTC interrupts into two passes · b5e83f6f
      Nicholas Kazlauskas 提交于
      [Why]
      When disabling all the pipes for a CRTC the page-flip interrupt also
      gets disabled on Raven. We can't re-enable the page-flip interrupt
      unless we give DC at least one active DC plane.
      
      We currently enable interrupts after the call to dc_commit_state since
      there's currently no valid sequence that should disable all the planes
      or re-enable planes for a CRTC without first going through
      dc_commit_state.
      
      If we were to allow for a CRTC to be enabled with no primary plane this
      would not be the case - the call to dc_commit_updates_for_stream would
      enable the planes when going from zero to at least one active plane,
      but manage_dm_interrupts would have been called too early.
      
      This results in a page-flip timeout on any subsequent commits since we
      think the page-flip are now enabled when they're actually disabled.
      
      We need to enable interrupts after the call to
      dc_commit_updates_for_stream.
      
      [How]
      Split enabling interrupts into two passes. One pass before
      dc_commit_updates_for_stream and one after it.
      
      Shifting all the interrupts to be strictly below the call doesn't
      currently work even though it should in theory. We end up queuing
      off the vblank event to be handle by the flip handler before it's
      actually enabled in some cases, particularly:
      
      old_crtc_state->active = false -> new_crtc_state->active = true
      
      The framebuffer states haven't changed and we can technically still
      do a "pageflip" in this case and send back the event.
      Signed-off-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: NDavid Francis <David.Francis@amd.com>
      Acked-by: NLeo Li <sunpeng.li@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      b5e83f6f
    • N
      drm/amd/display: Fix CRC vblank refs when changing interrupts · e39575b9
      Nicholas Kazlauskas 提交于
      [Why]
      We only currently drop the vblank reference when the stream is
      being removed from the context. We should be dropping it whenever we
      disable interrupts and reaquiring it after we re-enable them.
      
      We also never get the extra reference correctly when re-enabling
      interrupts, since grabbing the reference has the following condition:
      
      if (!crtc_state->crc_enabled && enable)
              drm_crtc_vblank_get(crtc);
      
      This means that crc_enabled must be *false* in order to grab the extra
      reference.
      
      [How]
      Always drop the ref whenever we're disabling interrupts.
      
      Only disable CRC capture when the stream is being removed.
      
      Always grab the ref by setting dm_new_crtc_state->crc_enabled = false
      before the call to re-enable CRC capture.
      Signed-off-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: NDavid Francis <David.Francis@amd.com>
      Acked-by: NLeo Li <sunpeng.li@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      e39575b9
    • N
      drm/amd/display: Disable cursors before disabling planes · 8ad27806
      Nicholas Kazlauskas 提交于
      [Why]
      We can't do cursor programming after the planes have been disabled
      since there won't be any pipes - leading to lock warnings and the wrong
      cursor state being left in the registers.
      
      When we re-enable the planes after the previous cursor state will also
      remain if we don't have a cursor plane.
      
      [How]
      If we're disabling the planes then do the cursor programming first.
      If we're not disabling the planes then do the cursor programming after.
      
      Introduce the amdgpu_dm_commit_cursors helper to avoid code duplication
      for both of these cases.
      Signed-off-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: NDavid Francis <David.Francis@amd.com>
      Acked-by: NLeo Li <sunpeng.li@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      8ad27806
    • N
      drm/amd/display: Refactor CRTC interrupt toggling logic · d6ef9b41
      Nicholas Kazlauskas 提交于
      [Why]
      The vblank and pageflip interrupts should only be enabled for a CRTC
      that's enabled and has active planes.
      
      The current logic takes care of this, but isn't setup to handle the case
      where the active plane count goes to zero but the stream remains
      enabled.
      
      We currently block this case since we don't allow commits that enable a
      CRTC with no active planes, but shouldn't be any reason we can't support
      this from a hardware perspective and many userspace applications expect
      to be able to do it (like IGT).
      
      [How]
      The count_crtc_active_planes function fills in the number of
      "active_planes" on the dm_crtc_state. This should be the same as
      DC's plane_count on the stream_status but easier to access since we
      don't need to lock the private atomic state with the DC context.
      
      Add the "interrupts_enabled" flag to the dm_crtc_state and set it based
      on whether the stream exists and if there are active planes on the
      stream.
      
      Update the disable and enable logic to make use of this new flag.
      
      There shouldn't be any functional change (yet) with this patch.
      Signed-off-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: NDavid Francis <David.Francis@amd.com>
      Acked-by: NLeo Li <sunpeng.li@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      d6ef9b41
  2. 24 4月, 2019 2 次提交
  3. 20 4月, 2019 1 次提交
  4. 15 4月, 2019 13 次提交
  5. 11 4月, 2019 4 次提交
  6. 04 4月, 2019 1 次提交
  7. 03 4月, 2019 5 次提交
    • M
      drm/amd/display: Make pageflip event delivery compatible with VRR. · 71bbe51a
      Mario Kleiner 提交于
      We want vblank counts and timestamps of flip completion as sent
      in pageflip completion events to be consistent with the vblank
      count and timestamp of the vblank of flip completion, like in non
      VRR mode.
      
      In VRR mode, drm_update_vblank_count() - and thereby vblank
      count and timestamp updates - must be delayed until after the
      end of front-porch of each vblank, as it is only safe to
      calculate vblank timestamps outside of the front-porch, when
      we actually know when the vblank will end or has ended.
      
      The function drm_update_vblank_count() which updates timestamps
      and counts gets called by drm_crtc_accurate_vblank_count() or by
      drm_crtc_handle_vblank().
      
      Therefore we must make sure that pageflip events for a completed
      flip are only sent out after drm_crtc_accurate_vblank_count() or
      drm_crtc_handle_vblank() is executed, after end of front-porch
      for the vblank of flip completion.
      
      Two cases:
      
      a) Pageflip irq handler executes inside front-porch:
         In this case we must defer sending pageflip events until
         drm_crtc_handle_vblank() executes after end of front-porch,
         and thereby calculates proper vblank count and timestamp.
         Iow. the pflip irq handler must just arm a pageflip event
         to be sent out by drm_crtc_handle_vblank() later on.
      
      b) Pageflip irq handler executes after end of front-porch, e.g.,
         after flip completion in back-porch or due to a massively
         delayed handler invocation into the active scanout of the new
         frame. In this case we can call drm_crtc_accurate_vblank_count()
         to safely force calculation of a proper vblank count and
         timestamp, and must send the pageflip completion event
         ourselves from the pageflip irq handler.
      
         This is the same behaviour as needed for standard fixed refresh
         rate mode.
      
      To decide from within pageflip handler if we are in case a) or b),
      we check the current scanout position against the boundary of
      front-porch. In non-VRR mode we just do what we did in the past.
      Signed-off-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Reviewed-by: NNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      71bbe51a
    • M
      drm/amd/display: In VRR mode, do DRM core vblank handling at end of vblank. (v2) · d2574c33
      Mario Kleiner 提交于
      In VRR mode, proper vblank/pageflip timestamps can only be computed
      after the display scanout position has left front-porch. Therefore
      delay calls to drm_crtc_handle_vblank(), and thereby calls to
      drm_update_vblank_count() and pageflip event delivery, to after the
      end of front-porch when in VRR mode.
      
      We add a new vupdate irq, which triggers at the end of the vupdate
      interval, ie. at the end of vblank, and calls the core vblank handler
      function. The new irq handler is not executed in standard non-VRR
      mode, so vblank handling for fixed refresh rate mode is identical
      to the past implementation.
      
      v2: Implement feedback by Nicholas and Paul Menzel.
      Signed-off-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Acked-by: NHarry Wentland <harry.wentland@amd.com>
      Reviewed-by: NNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      d2574c33
    • M
      drm/amd/display: Rework vrr flip throttling for late vblank irq. · fdd1fe57
      Mario Kleiner 提交于
      For throttling to work correctly, we always need a baseline vblank
      count last_flip_vblank that increments at start of front-porch.
      
      This is the case for drm_crtc_vblank_count() in non-VRR mode, where
      the vblank irq fires at start of front-porch and triggers DRM core
      vblank handling, but it is no longer the case in VRR mode, where
      core vblank handling is done later, after end of front-porch.
      
      Therefore drm_crtc_vblank_count() is no longer useful for this.
      We also can't use drm_crtc_accurate_vblank_count(), as that would
      screw up vblank timestamps in VRR mode when called in front-porch.
      
      To solve this, use the cooked hardware vblank counter returned by
      amdgpu_get_vblank_counter_kms() instead, as that one is cooked to
      always increment at start of front-porch, independent of when
      vblank related irq's fire.
      
      This patch allows vblank irq handling to happen anywhere within
      vblank of even after it, without a negative impact on flip
      throttling, so followup patches can shift the vblank core
      handling trigger point wherever they need it.
      Signed-off-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Reviewed-by: NNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      fdd1fe57
    • M
      drm/amd/display: Prevent vblank irq disable while VRR is active. (v3) · 66b0c973
      Mario Kleiner 提交于
      During VRR mode we can not allow vblank irq dis-/enable
      transitions, as an enable after a disable can happen at
      an arbitrary time during the video refresh cycle, e.g.,
      with a high likelyhood inside vblank front-porch. An
      enable during front-porch would cause vblank timestamp
      updates/calculations which are completely bogus, given
      the code can't know when the vblank will end as long
      as we are in front-porch with no page flip completed.
      
      Hold a permanent vblank reference on the crtc while
      in active VRR mode to prevent a vblank disable, and
      drop the reference again when switching back to fixed
      refresh rate non-VRR mode.
      
      v2: Make sure transition is also handled if vrr is
          disabled and stream gets disabled in the same
          atomic commit by moving the call to the transition
          function outside of plane commit.
          Suggested by Nicholas.
      
      v3: Trivial rebase onto previous patch.
      Signed-off-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Reviewed-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      66b0c973
    • M
      drm/amd/display: Update VRR state earlier in atomic_commit_tail. · e854194c
      Mario Kleiner 提交于
      We need the VRR active/inactive state info earlier in
      the commit sequence, so VRR related setup functions like
      amdgpu_dm_handle_vrr_transition() know the final VRR state
      when they need to do their hw setup work.
      
      Split update_freesync_state_on_stream() into an early part,
      that can run at the beginning of commit tail before the
      vrr transition handling, and a late part that must run after
      vrr transition handling inside the commit planes code for
      enabled crtc's.
      
      Suggested by Nicholas Kazlauskas.
      Signed-off-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Reviewed-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      e854194c
  8. 21 3月, 2019 6 次提交
  9. 20 3月, 2019 3 次提交