[Intel-gfx] [PATCH igt 05/10] kms_frontbuffer_tracking: set our own size for the FBs we create

Paulo Zanoni paulo.r.zanoni at intel.com
Fri Nov 13 09:12:46 PST 2015


If we just call igt_create_fb(), the automatic size calculated by
create_bo_for_fb() may be way too big for the FBC CFB, and this will
result in SKIPs due to not enough stolen memroy. So in order to avoid
that, let's compute our own sizes.

Besides this, I want to make sure that both the untiled and X tiled -
and, in the future, Y tiled - buffers have the same size for the same
width/height/format. This will allow better control over the failure
paths exercised by our tests: when we try to flip from tiled to
untiled, we'll be sure that the change in buffer size does not cause
the wrong error path to be executed.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
 tests/kms_frontbuffer_tracking.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index ee72532..74acc73 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -479,6 +479,7 @@ static void create_fb(enum pixel_format pformat, int width, int height,
 		      uint64_t tiling, int plane, struct igt_fb *fb)
 {
 	uint32_t format;
+	unsigned int buf_size, pixel_size, stride;
 
 	switch (pformat) {
 	case FORMAT_RGB888:
@@ -508,7 +509,21 @@ static void create_fb(enum pixel_format pformat, int width, int height,
 		igt_assert(false);
 	}
 
-	igt_create_fb(drm.fd, width, height, format, tiling, fb);
+	/* We want all frontbuffers with the same width/weight/format to have
+	 * the same size regardless of tiling. Besides, the automatic size from
+	 * intel_create_fb() is too big and may lead to many SKIPs due to not
+	 * enough stolen memory. */
+	pixel_size = igt_drm_format_to_bpp(format) / 8;
+	if (plane == PLANE_CUR) {
+		stride = ALIGN(width * pixel_size, 64);
+		buf_size = stride * height;
+	} else {
+		stride = ALIGN(width * pixel_size, 512);
+		buf_size = stride * ALIGN(height, 32);
+	}
+
+	igt_create_fb_with_bo_size(drm.fd, width, height, format, tiling, fb,
+				   buf_size, stride);
 }
 
 static uint32_t pick_color(struct igt_fb *fb, enum color ecolor)
-- 
2.6.2



More information about the Intel-gfx mailing list