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

Ville Syrjala ville.syrjala at linux.intel.com
Tue Sep 11 14:29:23 UTC 2018


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

The blitter stride is limited to <32k. Fall back to gtt mmap if we're
about to exceed that.

This won't work for Yf as the fence doesn't know about Yf. So for that
case we'd need to use cpu mmap and (de)tile manually. For now just
pretend that there is no problem.

v2: Throw in some warnings for gtt mmap vs. yf tiling (Chris)

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk> #v1
---
 lib/igt_fb.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 1ba1aa7c19cf..741f13fa65cf 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -402,6 +402,9 @@ static int create_bo_for_fb(int fd, int width, int height,
 			bo = gem_create(fd, size);
 			gem_set_tiling(fd, bo, igt_fb_mod_to_tiling(tiling), stride);
 
+			igt_warn_on_f(tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED,
+				      "GTT mmap does not support Yf tiling\n");
+
 			gem_set_domain(fd, bo,
 				       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 
@@ -1344,6 +1347,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 {
 	void *ptr;
 
+	igt_warn_on_f(fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED,
+		      "GTT mmap does not support Yf tiling\n");
+
 	gem_set_domain(fd, fb->gem_handle,
 		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 
@@ -1791,10 +1797,13 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	blit->rgb24.map = mmap(NULL, blit->rgb24.size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 	igt_assert(blit->rgb24.map != MAP_FAILED);
 
-	if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
+	if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+	     fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
+	    fb->stride < 32768) {
 		setup_linear_mapping(fd, fb, &blit->linear);
 	} else {
+		igt_warn_on_f(fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED,
+			      "GTT mmap does not support Yf tiling\n");
 		blit->linear.handle = 0;
 		gem_set_domain(fd, fb->gem_handle,
 			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
@@ -1849,8 +1858,9 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 	if (fb->cairo_surface == NULL) {
 		if (igt_format_is_yuv(fb->drm_format))
 			create_cairo_surface__convert(fd, fb);
-		else if (fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-		    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+		else if ((fb->tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
+			  fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) &&
+			 fb->stride < 32768)
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
-- 
2.16.4



More information about the igt-dev mailing list