public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Kasireddy, Vivek" <vivek.kasireddy@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	"Navare, Manasi D" <manasi.d.navare@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gem: Don't try to map and fence 8K/bigjoiner scanout buffers
Date: Wed, 27 Oct 2021 11:27:20 +0300	[thread overview]
Message-ID: <YXkNaOxG2r+y3dzj@intel.com> (raw)
In-Reply-To: <f35abfc540b9475b9f31121653586bed@intel.com>

On Wed, Oct 27, 2021 at 06:41:25AM +0000, Kasireddy, Vivek wrote:
> Hi Ville,
> 
> > 
> > On Mon, Oct 25, 2021 at 11:38:11PM -0700, Vivek Kasireddy wrote:
> > > 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 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 the mappable flag. This
> > > results in a latency of ~10ms and happens every other vblank/repaint cycle.
> > >
> > > Testcase:
> > > Running Weston and weston-simple-egl on an Alderlake_S (ADLS) platform
> > > with a 8K@60 mode results in only ~40 FPS. Since upstream Weston submits
> > > a frame ~7ms before the next vblank, the latencies seen between atomic
> > > commit and flip event is 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 |   }
> > >
> > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > > Cc: Manasi Navare <manasi.d.navare@intel.com>
> > > Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_fb_pin.c  | 11 +++++++++--
> > >  drivers/gpu/drm/i915/display/intel_overlay.c | 11 ++++++++---
> > >  drivers/gpu/drm/i915/gem/i915_gem_domain.c   |  6 ++++--
> > >  drivers/gpu/drm/i915/gem/i915_gem_object.h   |  3 ++-
> > >  4 files changed, 23 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > > index 3f77f3013584..53c156d9a9f9 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > > @@ -144,7 +144,7 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
> > >
> > >  	if (!ret) {
> > >  		vma = i915_gem_object_pin_to_display_plane(obj, &ww, alignment,
> > > -							   view, pinctl);
> > > +							   view, pinctl, uses_fence);
> > >  		if (IS_ERR(vma)) {
> > >  			ret = PTR_ERR(vma);
> > >  			goto err_unpin;
> > > @@ -218,9 +218,16 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state)
> > >  		INTEL_INFO(dev_priv)->display.cursor_needs_physical;
> > >
> > >  	if (!intel_fb_uses_dpt(fb)) {
> > > +		struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc);
> > > +		struct intel_crtc_state *crtc_state =
> > > +					to_intel_crtc_state(crtc->base.state);
> > > +		bool uses_fence = intel_plane_uses_fence(plane_state);
> > > +		bool is_bigjoiner = crtc_state->bigjoiner ||
> > > +				    crtc_state->bigjoiner_slave;
> > 
> > Bigjoiner is just an implementation detail. It is not the cause of any
> > of this.
> [Kasireddy, Vivek] Right, bigjoiner/8K is just exposing the underlying issue; which is
> that sometimes, large objects/scanout buffers that fail range overflow checks and thus
> are not mappable/fenceable keep getting evicted and reinserted leading to latencies. 
> I guess I could mark an object/vma as permanently un-mappable/un-fenceable and try
> not to map it subsequently but this would result in one scanout buffer that is mappable
> but others that are not. Would this be acceptable -- assuming we are pageflipping
> between multiple FBs?
> Any ideas on solving this issue cleanly?

We might just consider skipping PIN_MAPPABLE if the vma is too big.
What the specific defition of "too big" would be I'm not sure.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2021-10-27  8:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26  6:38 [Intel-gfx] [PATCH] drm/i915/gem: Don't try to map and fence 8K/bigjoiner scanout buffers Vivek Kasireddy
2021-10-26  7:52 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-10-26  9:07 ` [Intel-gfx] [PATCH] " Ville Syrjälä
2021-10-27  6:41   ` Kasireddy, Vivek
2021-10-27  8:27     ` Ville Syrjälä [this message]
2021-10-28  8:04       ` [Intel-gfx] [PATCH] drm/i915/gem: Don't try to map and fence large " Vivek Kasireddy
2021-10-28 12:53         ` Ville Syrjälä
2021-10-29  7:43           ` [Intel-gfx] [PATCH] drm/i915/gem: Don't try to map and fence large scanout buffers (v3) Vivek Kasireddy
2021-11-01 10:13             ` Tvrtko Ursulin
2021-11-01 20:52               ` Kasireddy, Vivek
2021-11-01 10:21             ` Ville Syrjälä
2021-11-01 21:27               ` Kasireddy, Vivek
2021-11-02 14:34                 ` Ville Syrjälä
2021-11-03  0:04                   ` [Intel-gfx] [PATCH] drm/i915/gem: Don't try to map and fence large scanout buffers (v4) Vivek Kasireddy
2021-11-15 19:32                     ` Kasireddy, Vivek
2021-10-26  9:33 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/gem: Don't try to map and fence 8K/bigjoiner scanout buffers Patchwork
2021-10-28 14:14 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: Don't try to map and fence 8K/bigjoiner scanout buffers (rev2) Patchwork
2021-10-29 10:36 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: Don't try to map and fence 8K/bigjoiner scanout buffers (rev3) Patchwork
2021-10-29 11:08 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-10-29 18:21 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-11-03  1:12 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gem: Don't try to map and fence 8K/bigjoiner scanout buffers (rev4) Patchwork
2021-11-03  2:39 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YXkNaOxG2r+y3dzj@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=manasi.d.navare@intel.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=vivek.kasireddy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox