[igt-dev] [PATCH i-g-t 5/5] lib/igt_fb: Fix blitter limit checks

Ville Syrjala ville.syrjala at linux.intel.com
Wed Apr 17 20:35:44 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

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.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 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 794f0eef04a3..65fc94f98a69 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 and we do this check just for the
+		 * tiled fb 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,
-- 
2.21.0



More information about the igt-dev mailing list