1. 07 Apr, 2022 1 commit
  2. 06 Apr, 2022 3 commits
  3. 05 Apr, 2022 8 commits
  4. 30 Mar, 2022 1 commit
  5. 29 Mar, 2022 3 commits
  6. 28 Mar, 2022 1 commit
  7. 25 Mar, 2022 2 commits
  8. 22 Mar, 2022 20 commits
  9. 21 Mar, 2022 1 commit
    • Vivek Kasireddy's avatar
      drm/i915/gem: Don't evict unmappable VMAs when pinning with PIN_MAPPABLE (v2) · 230523ba
      Vivek Kasireddy authored
      On platforms capable of allowing 8K (7680 x 4320) modes, pinning 2 or
      more framebuffers/scanout buffers results in only one that is mappable/
      fenceable. Therefore, pageflipping between these 2 FBs where only one
      is mappable/fenceable creates latencies large enough to miss alternate
      vblanks thereby producing less optimal framerate.
      
      This mainly happens because when i915_gem_object_pin_to_display_plane()
      is called to pin one of the FB objs, the associated vma is identified
      as misplaced -- because there is no space for it in the aperture --
      and therefore i915_vma_unbind() is called which unbinds and evicts it.
      This misplaced vma gets subseqently pinned only when
      i915_gem_object_ggtt_pin_ww() is called without PIN_MAPPABLE. This whole
      thing results in a latency of ~10ms and happens every other repaint cycle.
      Therefore, to fix this issue, we just ensure that the misplaced VMA
      does not get evicted when we try to pin it with PIN_MAPPABLE -- by
      returning early if the mappable/fenceable flag is not set.
      
      Testcase:
      Running Weston and weston-simple-egl on an Alderlake_S (ADLS) platform
      with a 8K@60 mode results in only ~40 FPS (compared to ~59 FPS with
      this patch). Since upstream Weston submits a frame ~7ms before the
      next vblank, the latencies seen between atomic commit and flip event
      are 7, 24 (7 + 16.66), 7, 24..... suggesting that it misses the
      vblank every other frame.
      
      Here is the ftrace snippet that shows the source of the ~10ms latency:
                    i915_gem_object_pin_to_display_plane() {
      0.102 us   |    i915_gem_object_set_cache_level();
                      i915_gem_object_ggtt_pin_ww() {
      0.390 us   |      i915_vma_instance();
      0.178 us   |      i915_vma_misplaced();
                        i915_vma_unbind() {
                        __i915_active_wait() {
      0.082 us   |        i915_active_acquire_if_busy();
      0.475 us   |      }
                        intel_runtime_pm_get() {
      0.087 us   |        intel_runtime_pm_acquire();
      0.259 us   |      }
                        __i915_active_wait() {
      0.085 us   |        i915_active_acquire_if_busy();
      0.240 us   |      }
                        __i915_vma_evict() {
                          ggtt_unbind_vma() {
                            gen8_ggtt_clear_range() {
      10507.255 us |        }
      10507.689 us |      }
      10508.516 us |   }
      
      v2:
      - Expand the code comments to describe the ping-pong issue.
      
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220321005431.1113890-1-vivek.kasireddy@intel.com
      230523ba