diff mbox

[igt,3/6] kms_frontbuffer_tracking: standardize the used FB sizes

Message ID 1453814944-15373-3-git-send-email-paulo.r.zanoni@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zanoni, Paulo R Jan. 26, 2016, 1:29 p.m. UTC
We want to make sure that both tiled and untiled 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 we won't execute the error
path that checks for buffer sizes.

v2: Use the new igt_calc_fb_size() instead of implementing our own
size calculation (Daniel).
v3: We can now use igt_drm_format_to_bpp() (Daniel).

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 tests/kms_frontbuffer_tracking.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index c819019..64f880c 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -483,6 +483,9 @@  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 size, stride;
+	int bpp;
+	uint64_t tiling_for_size;
 
 	switch (pformat) {
 	case FORMAT_RGB888:
@@ -512,7 +515,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/height/format to have
+	 * the same size regardless of tiling since we want to properly exercise
+	 * the Kernel's specific tiling-checking code paths without accidentally
+	 * hitting size-checking ones first. */
+	bpp = igt_drm_format_to_bpp(format);
+	if (plane == PLANE_CUR)
+		tiling_for_size = LOCAL_DRM_FORMAT_MOD_NONE;
+	else
+		tiling_for_size = LOCAL_I915_FORMAT_MOD_X_TILED;
+
+	igt_calc_fb_size(drm.fd, width, height, bpp, tiling_for_size, &size,
+			 &stride);
+
+	igt_create_fb_with_bo_size(drm.fd, width, height, format, tiling, fb,
+				   size, stride);
 }
 
 static uint32_t pick_color(struct igt_fb *fb, enum color ecolor)