From 0dc1d6e4d4305a62c64242ec65709e44f5036cf4 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Wed, 17 Apr 2019 21:54:05 +0300 Subject: lib/igt_fb: Fix blitter limit checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The earlier approach of checking the higher tiled stride limit has backfired. All out blits are between tiled and linear, but we only ever check this for the tiled fb. Thus we are taking the blitter path even though the linear fb exceeds the blitter limits. So let's just check the limits as if we are operating on linear fbs. And let's toss in some width/height checks, and let's do the checks for all the color planes as well. v2: Reword the comment a bit to hopefully make it legible (Chris) Signed-off-by: Ville Syrjälä Reviewed-by: Chris Wilson --- lib/igt_fb.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 292c19d2..8664d1af 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1580,29 +1580,37 @@ struct fb_blit_upload { struct intel_batchbuffer *batch; }; -static int max_blitter_stride(int fd, uint64_t modifier) +static bool blitter_ok(const struct igt_fb *fb) { - int stride = 32768; - - if (intel_gen(intel_get_drm_devid(fd)) >= 4 && - modifier != DRM_FORMAT_MOD_NONE) - stride *= 4; + for (int i = 0; i < fb->num_planes; i++) { + /* + * gen4+ stride limit is 4x this with tiling, + * but since our blits are always between tiled + * and linear surfaces (and we do this check just + * for the tiled surface) we must use the lower + * linear stride limit here. + */ + if (fb->plane_width[i] > 32767 || + fb->plane_height[i] > 32767 || + fb->strides[i] > 32767) + return false; + } - return stride; + return true; } 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)); + !blitter_ok(fb)); } 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); + blitter_ok(fb); } static void init_buf(struct fb_blit_upload *blit, -- cgit v1.2.3