public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t] igt/kms_rotation_crc: exercise invalid rotations
Date: Wed,  9 Mar 2016 15:05:24 +0000	[thread overview]
Message-ID: <1457535924-17332-1-git-send-email-matthew.auld@intel.com> (raw)

Add expect-to-fail tests for invalid rotations on each of the plane types.

Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 tests/kms_rotation_crc.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f94f8f1..a0a5a0f 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -479,6 +479,68 @@ err_commit:
 	igt_assert(ret == 0);
 }
 
+static void test_plane_rotation_invalid(data_t *data, enum igt_plane plane_type)
+{
+	igt_display_t *display = &data->display;
+	uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
+	uint32_t format = DRM_FORMAT_XRGB8888;
+	int bpp = igt_drm_format_to_bpp(format);
+	enum igt_commit_style commit = COMMIT_LEGACY;
+	int fd = data->gfx_fd;
+	igt_output_t *output = &display->outputs[0];
+	igt_plane_t *plane;
+	drmModeModeInfo *mode;
+	unsigned int stride, size, w, h;
+	uint32_t gem_handle;
+	int ret;
+
+	igt_require(output != NULL && output->valid == true);
+
+	plane = igt_output_get_plane(output, plane_type);
+	igt_require(igt_plane_supports_rotation(plane));
+
+	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+		igt_require(data->display.has_universal_planes);
+		commit = COMMIT_UNIVERSAL;
+	}
+
+	mode = igt_output_get_mode(output);
+	w = mode->hdisplay;
+	h = mode->vdisplay;
+
+	for (stride = 512; stride < (w * bpp / 8); stride *= 2)
+		;
+	for (size = 1024*1024; size < stride * h; size *= 2)
+		;
+
+	gem_handle = gem_create(fd, size);
+	ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
+	igt_assert(ret == 0);
+
+	do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
+		  format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS,
+		  &data->fb.fb_id));
+	data->fb.width = w;
+	data->fb.height = h;
+	data->fb.gem_handle = gem_handle;
+
+	igt_plane_set_fb(plane, NULL);
+	igt_display_commit(display);
+
+	igt_plane_set_rotation(plane, data->rotation);
+	igt_plane_set_fb(plane, &data->fb);
+
+	drmModeObjectSetProperty(fd, plane->drm_plane->plane_id,
+				 DRM_MODE_OBJECT_PLANE,
+				 plane->rotation_property,
+				 plane->rotation);
+	ret = igt_display_try_commit2(display, commit);
+
+	kmstest_restore_vt_mode();
+	igt_remove_fb(fd, &data->fb);
+	igt_assert_eq(ret, -EINVAL);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -579,6 +641,40 @@ igt_main
 		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY);
 	}
 
+	igt_subtest_f("primary-rotation-90-invalid") {
+		igt_require(gen < 9);
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation_invalid(&data, IGT_PLANE_PRIMARY);
+	}
+
+	igt_subtest_f("primary-rotation-270-invalid") {
+		igt_require(gen < 9);
+		data.rotation = IGT_ROTATION_270;
+		test_plane_rotation_invalid(&data, IGT_PLANE_PRIMARY);
+	}
+
+	igt_subtest_f("sprite-rotation-90-invalid") {
+		igt_require(gen < 9);
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation_invalid(&data, IGT_PLANE_2);
+	}
+
+	igt_subtest_f("sprite-rotation-270-invalid") {
+		igt_require(gen < 9);
+		data.rotation = IGT_ROTATION_270;
+		test_plane_rotation_invalid(&data, IGT_PLANE_2);
+	}
+
+	igt_subtest_f("cursor-rotation-90-invalid") {
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation_invalid(&data, IGT_PLANE_CURSOR);
+	}
+
+	igt_subtest_f("cursor-rotation-270-invalid") {
+		data.rotation = IGT_ROTATION_270;
+		test_plane_rotation_invalid(&data, IGT_PLANE_CURSOR);
+	}
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2016-03-09 15:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 15:05 Matthew Auld [this message]
2016-03-09 15:25 ` [PATCH i-g-t] igt/kms_rotation_crc: exercise invalid rotations Ville Syrjälä
2016-03-10  9:03   ` Matthew Auld
2016-03-10 10:38     ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457535924-17332-1-git-send-email-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox