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

Chris Wilson
2019-04-08T17:19:36Z

Quoting Ville Syrjala (2019-04-08 18:13:06)
> 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
> v3: Deal with gen4+ tiled stride correctly (Chris)
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> lib/igt_fb.c | 36 +++++++++++++++++++++++++++++-------
> 1 file changed, 29 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 6adf422228e8..d2f756dba2e9 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1576,6 +1576,31 @@ struct fb_blit_upload {
> struct intel_batchbuffer *batch;
> };
>
> +static int max_blitter_stride(int fd, uint64_t modifier)
> +{
> + int stride = 32768;
> +
> + if (intel_gen(intel_get_drm_devid(fd)) >= 4 &&
> + modifier != DRM_FORMAT_MOD_NONE)

* fingers crossed that the modifier is the single truth

> + stride *= 4;
> +
> + return stride;
> +}
> +
> +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] >= max_blitter_stride(fb->fd, fb->modifier));
> +}
> +
> +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] < max_blitter_stride(fb->fd, fb->modifier);

max_blitter_stride() looks correctly used.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris