Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations
@ 2016-03-16 17:04 Matthew Auld
  2016-03-16 17:04 ` [PATCH i-g-t 2/2] tests/kms_rotation_crc: add 90/270 X-tiled tests Matthew Auld
  2016-03-22 14:18 ` [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations Matthew Auld
  0 siblings, 2 replies; 3+ messages in thread
From: Matthew Auld @ 2016-03-16 17:04 UTC (permalink / raw)
  To: intel-gfx

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

v2:
(Ville Syrjälä)
    - use igt_create_fb
    - y-tiled will be rejected by gen < 9
    - don't hardcode all the plane rotation failure combinations
v3:
    - use valid pixel format for cursor plane

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

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f94f8f1..bd9ab7b 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -479,6 +479,74 @@ err_commit:
 	igt_assert(ret == 0);
 }
 
+static void exhaust_invalid_plane_rotations(data_t *data, enum igt_plane plane_type)
+{
+	igt_display_t *display = &data->display;
+	int fd = data->gfx_fd, fb_id;
+	uint64_t tiling;
+	uint32_t pixel_format = DRM_FORMAT_XRGB8888;
+	enum igt_commit_style commit = COMMIT_LEGACY;
+	igt_output_t *output = &display->outputs[0];
+	igt_plane_t *plane;
+	drmModeModeInfo *mode;
+	drmModePropertyPtr prop;
+	uint64_t supported_plane_rotations = 0, rotation = IGT_ROTATION_0;
+	int ret, i;
+
+	if (intel_gen(intel_get_drm_devid(fd)) >= 9)
+		tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+	else
+		tiling = LOCAL_I915_FORMAT_MOD_X_TILED;
+
+	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+		igt_require(data->display.has_universal_planes);
+		commit = COMMIT_UNIVERSAL;
+	}
+
+	if (plane_type == IGT_PLANE_CURSOR)
+		pixel_format = DRM_FORMAT_ARGB8888;
+
+	igt_require(output != NULL && output->valid == true);
+
+	plane = igt_output_get_plane(output, plane_type);
+	igt_require(igt_plane_supports_rotation(plane));
+
+	mode = igt_output_get_mode(output);
+
+	fb_id = igt_create_fb(fd, mode->hdisplay, mode->vdisplay, pixel_format,
+			      tiling, &data->fb);
+	igt_assert(fb_id);
+
+	igt_plane_set_fb(plane, NULL);
+	igt_display_commit(display);
+
+	igt_plane_set_fb(plane, &data->fb);
+
+	kmstest_get_property(fd, plane->drm_plane->plane_id, DRM_MODE_OBJECT_PLANE,
+			     "rotation", NULL, NULL, &prop);
+
+	for (i = 0; i < prop->count_enums; ++i)
+		supported_plane_rotations |= (1ULL << prop->enums[i].value);
+
+	for (i = 1; i <= 4; i++) {
+		if (!(rotation & supported_plane_rotations)) {
+			igt_plane_set_rotation(plane, rotation);
+
+			ret = igt_display_try_commit2(display, commit);
+			if (ret != -EINVAL)
+				goto err_commit;
+
+		}
+		rotation <<= 1;
+	}
+
+err_commit:
+	igt_remove_fb(fd, &data->fb);
+	kmstest_restore_vt_mode();
+
+	igt_assert_eq(ret, -EINVAL);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -579,6 +647,18 @@ igt_main
 		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY);
 	}
 
+	igt_subtest_f("primary-rotations-invalid") {
+		exhaust_invalid_plane_rotations(&data, IGT_PLANE_PRIMARY);
+	}
+
+	igt_subtest_f("sprite-rotations-invalid") {
+		exhaust_invalid_plane_rotations(&data, IGT_PLANE_2);
+	}
+
+	igt_subtest_f("cursor-rotations-invalid") {
+		exhaust_invalid_plane_rotations(&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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH i-g-t 2/2] tests/kms_rotation_crc: add 90/270 X-tiled tests
  2016-03-16 17:04 [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations Matthew Auld
@ 2016-03-16 17:04 ` Matthew Auld
  2016-03-22 14:18 ` [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations Matthew Auld
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Auld @ 2016-03-16 17:04 UTC (permalink / raw)
  To: intel-gfx

As suggested by Ville Syrjälä, add expect-to-fail tests for X-tiled
90/270 rotations on gen >= 9

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

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index bd9ab7b..eb08543 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -547,6 +547,48 @@ err_commit:
 	igt_assert_eq(ret, -EINVAL);
 }
 
+static void test_plane_rotation_xtiled_invalid(data_t *data, enum igt_plane plane_type)
+{
+	igt_display_t *display = &data->display;
+	int fd = data->gfx_fd, fb_id;
+	uint64_t tiling = LOCAL_I915_FORMAT_MOD_X_TILED;
+	uint32_t pixel_format = DRM_FORMAT_XRGB8888;
+	enum igt_commit_style commit = COMMIT_LEGACY;
+	igt_output_t *output = &display->outputs[0];
+	igt_plane_t *plane;
+	drmModeModeInfo *mode;
+	int ret;
+
+	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+		igt_require(data->display.has_universal_planes);
+		commit = COMMIT_UNIVERSAL;
+	}
+
+	igt_require(output != NULL && output->valid == true);
+
+	plane = igt_output_get_plane(output, plane_type);
+	igt_require(igt_plane_supports_rotation(plane));
+
+	mode = igt_output_get_mode(output);
+
+	fb_id = igt_create_fb(fd, mode->hdisplay, mode->vdisplay, pixel_format,
+			      tiling, &data->fb);
+	igt_assert(fb_id);
+
+	igt_plane_set_fb(plane, NULL);
+	igt_display_commit(display);
+
+	igt_plane_set_fb(plane, &data->fb);
+
+	igt_plane_set_rotation(plane, data->rotation);
+	ret = igt_display_try_commit2(display, commit);
+
+	igt_remove_fb(fd, &data->fb);
+	kmstest_restore_vt_mode();
+
+	igt_assert_eq(ret, -EINVAL);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -642,6 +684,18 @@ igt_main
 		test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY);
 	}
 
+	igt_subtest_f("primary-rotation-90-X-tiled-invalid") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation_xtiled_invalid(&data, IGT_PLANE_PRIMARY);
+	}
+
+	igt_subtest_f("primary-rotation-270-X-tiled-invalid") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_270;
+		test_plane_rotation_xtiled_invalid(&data, IGT_PLANE_PRIMARY);
+	}
+
 	igt_subtest_f("exhaust-fences") {
 		igt_require(gen >= 9);
 		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY);
-- 
2.4.3

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations
  2016-03-16 17:04 [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations Matthew Auld
  2016-03-16 17:04 ` [PATCH i-g-t 2/2] tests/kms_rotation_crc: add 90/270 X-tiled tests Matthew Auld
@ 2016-03-22 14:18 ` Matthew Auld
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Auld @ 2016-03-22 14:18 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

Hi Ville,

Is this what you had in mind for patches 1-2?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-22 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16 17:04 [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations Matthew Auld
2016-03-16 17:04 ` [PATCH i-g-t 2/2] tests/kms_rotation_crc: add 90/270 X-tiled tests Matthew Auld
2016-03-22 14:18 ` [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations Matthew Auld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox