Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: Don't use blitter for large buffers

Ville Syrjälä
2019-04-03T15:24:44Z

On Tue, Apr 02, 2019 at 03:41:43PM -0700, Dhinakaran Pandiyan wrote:
> On Thu, 2019-03-28 at 18:25 +0000, Chris Wilson wrote:
> > Quoting Ville Syrjala (2019-03-28 17:54:49)
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > >
> > > The blitter stride is limited to <32k. Fall back to gtt mmap or
> > > rendercopy if we're about to exceed that.
> > >
> > > Not quite sure why we're not just using gtt mmap for Y tiling
> > > always. But let's keep it like that for now.
> > >
> > > v2: Use rendercopy as the fallback for Yf
> > >
> > > Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > > lib/igt_fb.c | 25 ++++++++++++++++++-------
> > > 1 file changed, 18 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > > index fcd7c4c5d187..8b6adf55a338 100644
> > > --- a/lib/igt_fb.c
> > > +++ b/lib/igt_fb.c
> > > @@ -1502,6 +1502,20 @@ struct fb_blit_upload {
> > > struct intel_batchbuffer *batch;
> > > };
> > >
> > > +static bool use_rendercopy(const struct igt_fb *fb)
> > > +{
> > > + return is_ccs_modifier(fb->modifier) ||
> > > + (fb->modifier == I915_FORMAT_MOD_Yf_TILED &&
> > > + fb->strides[0] >= 32768);
> >
> > And probably wise to assert <= 256k.
> Is that a hardware limitation for the render engine?

I think the limits are:
gen2/3: 8k
gen4+: 128k
gen7+: 256k

I guess a 256k check here would make sense since we're only
interested in ccs and yf, and those are gen9+ only. Or maybe
I should just toss some asserts into the rendercopy functions
themselves.

>
> >
> > > +
> > > +static bool use_blitter(const struct igt_fb *fb)
> > > +{
> > > + return (fb->modifier == I915_FORMAT_MOD_Y_TILED ||
> > > + fb->modifier == I915_FORMAT_MOD_Yf_TILED) &&
> > > + fb->strides[0] < 32768;
> >
> > 32k dwords is the limit for tiled blits (on gen4+). I presume strides[]
> > is in bytes.
>
> I see conflicting limits in bspec for this, the Data Size Limitations page says
> "up to 32,768 bytes per scan line" whereas the docs for XY_SRC_COPY_BLT claims
> 32k dwords.

I always found the docs confusing when it comes to the blitter
stride. But the code we have works with the /4 for tiled so it
must be right :) I'll respin with this.

--
Ville Syrjälä
Intel