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

Ville Syrjala ville.syrjala at linux.intel.com
Thu Mar 28 17:54:49 UTC 2019


From: Ville Syrjälä <ville.syrjala at 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 at intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala at 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);
+}
+
+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;
+}
+
 static void init_buf(struct fb_blit_upload *blit,
 		     struct igt_buf *buf,
 		     const struct igt_fb *fb,
@@ -2511,7 +2525,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	blit->base.fd = fd;
 	blit->base.fb = fb;
 
-	if (is_ccs_modifier(fb->modifier)) {
+	if (use_rendercopy(fb)) {
 		blit->base.bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		blit->base.batch = intel_batchbuffer_alloc(blit->base.bufmgr,
 						   intel_get_drm_devid(fd));
@@ -2523,9 +2537,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 							     &blit->shadow_fb);
 	igt_assert(blit->shadow_ptr);
 
-	if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED ||
-	    is_ccs_modifier(fb->modifier)) {
+	if (use_rendercopy(fb) || use_blitter(fb)) {
 		setup_linear_mapping(&blit->base);
 	} else {
 		blit->base.linear.fb = *fb;
@@ -2605,10 +2617,9 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 		    ((f->cairo_id == CAIRO_FORMAT_INVALID) &&
 		     (f->pixman_id != PIXMAN_invalid)))
 			create_cairo_surface__convert(fd, fb);
-		else if (is_ccs_modifier(fb->modifier))
+		else if (use_rendercopy(fb))
 			create_cairo_surface__rendercopy(fd, fb);
-		else if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-			 fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+		else if (use_blitter(fb))
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
-- 
2.19.2



More information about the igt-dev mailing list