summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2015-07-10 17:53:25 -0300
committerPaulo Zanoni <paulo.r.zanoni@intel.com>2015-07-14 13:04:23 -0300
commitcb3861a9e3f1bc12765160345bb0dd1d543f5086 (patch)
treeef5bc94ff112854878b28779145381e644b3756d
parent4deb562659edc1b4d53024b6ef6e183b4f94f768 (diff)
kms_frontbuffer_tracking: implement badstride test
Test strides that are either completely invalid or just result in disabled FBC. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
-rw-r--r--tests/kms_frontbuffer_tracking.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 2c1d7296..a206c2f6 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -2248,6 +2248,71 @@ static void modesetfrombusy_subtest(const struct test_mode *t)
igt_remove_fb(drm.fd, &fb2);
}
+static void try_invalid_strides(void)
+{
+ uint32_t gem_handle;
+ int rc;
+
+ /* Sizes that the Kernel shouldn't even allow for tiled */
+ gem_handle = gem_create(drm.fd, 2048);
+
+ /* Smaller than 512, yet still 64-byte aligned. */
+ rc = __gem_set_tiling(drm.fd, gem_handle, I915_TILING_X, 448);
+ igt_assert(rc == -EINVAL);
+
+ /* Bigger than 512, but not 64-byte aligned. */
+ rc = __gem_set_tiling(drm.fd, gem_handle, I915_TILING_X, 1022);
+ igt_assert(rc == -EINVAL);
+
+ /* Just make sure something actually works. */
+ rc = __gem_set_tiling(drm.fd, gem_handle, I915_TILING_X, 1024);
+ igt_assert(rc == 0);
+
+ gem_close(drm.fd, gem_handle);
+}
+
+/**
+ * badstride - try to use buffers with strides that are not supported
+ *
+ * METHOD
+ * First we try to create buffers with strides that are not allowed for tiled
+ * surfaces and assert the Kernel rejects them. Then we create buffers with
+ * strides that are allowed by the Kernel, but that are incompatible with FBC
+ * and we assert that FBC stays disabled after we set a mode on those buffers.
+ *
+ * EXPECTED RESULTS
+ * The invalid strides are rejected, and the valid strides that are
+ * incompatible with FBC result in FBC disabled.
+ *
+ * FAILURES
+ * There are two possible places where the Kernel can be broken: either the
+ * code that checks valid strides for tiled buffers or the code that checks
+ * the valid strides for FBC.
+ */
+static void badstride_subtest(const struct test_mode *t)
+{
+ struct igt_fb wide_fb;
+ struct modeset_params *params = pick_params(t);
+
+ try_invalid_strides();
+
+ prepare_subtest(t, &pattern4);
+
+ igt_create_fb(drm.fd, params->fb.fb->width + 4096,
+ params->fb.fb->height, DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_X_TILED, &wide_fb);
+ igt_assert(wide_fb.stride > 16384);
+
+ igt_draw_fill_fb(drm.fd, &wide_fb, 0xFF);
+
+ params->fb.fb = &wide_fb;
+ set_mode_for_params(params);
+
+ do_assertions(ASSERT_FBC_DISABLED);
+
+ igt_remove_fb(drm.fd, &wide_fb);
+}
+
static int opt_handler(int option, int option_index, void *data)
{
switch (option) {
@@ -2564,6 +2629,10 @@ int main(int argc, char *argv[])
igt_subtest_f("%s-modesetfrombusy", feature_str(t.feature))
modesetfrombusy_subtest(&t);
+
+ if (t.feature & FEATURE_FBC)
+ igt_subtest_f("%s-badstride", feature_str(t.feature))
+ badstride_subtest(&t);
TEST_MODE_ITER_END
/*