Skip to contentSkip to conversation

lib/kmstest: Fix up tiled buffer creation

PATCH New Daniel Vetter 1 participant 1 message Apr 13, 2014 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/kmstest: Fix up tiled buffer creation

When extracting a raw __gem_set_tiling helper I've fumbled this in

commit 590f6101402b51bca54f69c002380bda967484ea

Author: Daniel Vetter <[email protected]>
Date:   Wed Oct 9 20:50:50 2013 +0200

lib/drmtest: extract rawer __gem_set_tiling

Fix things up so that we properly propaget the error again.

Now to make this all properly work we also need to make kms_flip a notch more robust against such failures ...

This only blows up on gen2/3 with the pan tests which want a too wide framebuffer for tiling.

---
 lib/igt_fb.c     | 6 +++---
 lib/igt_kms.c    | 1 -
 tests/kms_flip.c | 9 ++++++---
 3 files changed, 9 insertions(+), 7 deletions(-)
lib/igt_fb.c +3 -3
index ef486f970f03..29a12c6cc640 100644
@@ -79,7 +79,7 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp,
 			    unsigned *size_ret, unsigned *stride_ret)
 {
 	uint32_t gem_handle;
-	int size;
+	int size, ret = 0;
 	unsigned stride;
 
 	if (tiled) {
@@ -109,13 +109,13 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp,
 	gem_handle = gem_create(fd, size);
 
 	if (tiled)
-		gem_set_tiling(fd, gem_handle, I915_TILING_X, stride);
+		ret = __gem_set_tiling(fd, gem_handle, I915_TILING_X, stride);
 
 	*stride_ret = stride;
 	*size_ret = size;
 	*gem_handle_ret = gem_handle;
 
-	return 0;
+	return ret;
 }
 
 /**
lib/igt_kms.c +0 -1
index 9dee855c8053..fffad9f60671 100644
@@ -56,7 +56,6 @@
  * Note that this library's header pulls in the [i-g-t framebuffer](intel-gpu-tools-i-g-t-framebuffer.html)
  * library as a dependency.
  */
-
 const char *kmstest_pipe_str(int pipe)
 {
 	const char *str[] = { "A", "B", "C" };
tests/kms_flip.c +6 -3
index 24bbc0ba5336..c2f0d2ee9c67 100644
@@ -1277,11 +1277,13 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 					 true, &o->fb_info[2]);
 	igt_assert(o->fb_ids[0]);
 	igt_assert(o->fb_ids[1]);
-	igt_assert(o->fb_ids[2]);
+	if (o->flags & TEST_FB_BAD_TILING)
+		igt_require(o->fb_ids[2]);
 
 	paint_flip_mode(&o->fb_info[0], false);
 	paint_flip_mode(&o->fb_info[1], true);
-	paint_flip_mode(&o->fb_info[2], true);
+	if (o->fb_ids[2])
+		paint_flip_mode(&o->fb_info[2], true);
 
 	if (o->flags & TEST_FB_BAD_TILING)
 		set_y_tiling(o, 2);
@@ -1329,7 +1331,8 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	igt_info("\n%s: PASSED\n\n", test_name);
 
 out:
-	igt_remove_fb(drm_fd, &o->fb_info[2]);
+	if (o->fb_ids[2])
+		igt_remove_fb(drm_fd, &o->fb_info[2]);
 	igt_remove_fb(drm_fd, &o->fb_info[1]);
 	igt_remove_fb(drm_fd, &o->fb_info[0]);
 
Signature · 1 line
1.8.3.1