All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
@ 2017-10-20 23:29 Anusha Srivatsa
  2017-10-20 23:48 ` ✗ Fi.CI.BAT: warning for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Anusha Srivatsa @ 2017-10-20 23:29 UTC (permalink / raw)
  To: intel-gfx; +Cc: Joseph Garvey

From: Joseph Garvey <joseph1.garvey@intel.com>

Test that horizontal flip works with supported rotations. Includes
a fix for the unrotated fb which was not being positioned correctly
with portrait and landscape rectangles.

v2:(from Anusha)
- Change 180 degree rotation to follow the rest, use
igt_swap(), make flip variable a bool. Format the
patch correctly (Ville, Petri Latvala)

v3: (From Anusha)
- Correct the name of subtests in order to avoid duplication
of names (Arek)

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 lib/igt_kms.c            |   2 +-
 lib/igt_kms.h            |   5 ++
 tests/kms_rotation_crc.c | 198 +++++++++++++++++++++++++++++++++++++----------
 3 files changed, 164 insertions(+), 41 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a572fc6..3034e44 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
 
 static const char *rotation_name(igt_rotation_t rotation)
 {
-	switch (rotation) {
+	switch (rotation & IGT_ROTATION_MASK) {
 	case IGT_ROTATION_0:
 		return "0°";
 	case IGT_ROTATION_90:
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8dc118c..b83a828 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -281,8 +281,13 @@ typedef enum {
 	IGT_ROTATION_90  = 1 << 1,
 	IGT_ROTATION_180 = 1 << 2,
 	IGT_ROTATION_270 = 1 << 3,
+	IGT_REFLECT_X    = 1 << 4,
+	IGT_REFLECT_Y    = 1 << 5,
 } igt_rotation_t;
 
+#define IGT_ROTATION_MASK \
+	(IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
+
 typedef struct {
 	/*< private >*/
 	igt_pipe_t *pipe;
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5aec8fa..9e13667 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -32,6 +32,7 @@ typedef struct {
 	igt_display_t display;
 	struct igt_fb fb;
 	struct igt_fb fb_reference;
+	struct igt_fb fb_unrotated;
 	struct igt_fb fb_modeset;
 	struct igt_fb fb_flip;
 	igt_crc_t ref_crc;
@@ -43,8 +44,59 @@ typedef struct {
 	uint32_t override_fmt;
 	uint64_t override_tiling;
 	bool flips;
+	int devid;
 } data_t;
 
+typedef struct {
+	float r;
+	float g;
+	float b;
+} rgb_color_t;
+
+static void set_color(rgb_color_t *color, float r, float g, float b)
+{
+	color->r = r;
+	color->g = g;
+	color->b = b;
+}
+
+static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
+			  rgb_color_t *bl, igt_rotation_t rotation)
+{
+	rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
+
+	if (rotation & IGT_REFLECT_X) {
+		igt_swap(*tl, *tr);
+		igt_swap(*bl, *br);
+	}
+
+	if (rotation & IGT_ROTATION_90) {
+		bl_tmp = *bl;
+		br_tmp = *br;
+		tl_tmp = *tl;
+		tr_tmp = *tr;
+		*tl = tr_tmp;
+		*bl = tl_tmp;
+		*tr = br_tmp;
+		*br = bl_tmp;
+	} else if (rotation & IGT_ROTATION_180) {
+		igt_swap(*tl, *br);
+		igt_swap(*tr, *bl);
+	} else if (rotation & IGT_ROTATION_270) {
+		bl_tmp = *bl;
+		br_tmp = *br;
+		tl_tmp = *tl;
+		tr_tmp = *tr;
+		*tl = bl_tmp;
+		*bl = br_tmp;
+		*tr = tl_tmp;
+		*br = tr_tmp;
+	}
+}
+
+#define RGB_COLOR(color) \
+	color.r, color.g, color.b
+
 static void
 paint_squares(data_t *data, igt_rotation_t rotation,
 	      struct igt_fb *fb, float o)
@@ -52,35 +104,21 @@ paint_squares(data_t *data, igt_rotation_t rotation,
 	cairo_t *cr;
 	unsigned int w = fb->width;
 	unsigned int h = fb->height;
+	rgb_color_t tl, tr, bl, br;
 
 	cr = igt_get_cairo_ctx(data->gfx_fd, fb);
 
-	if (rotation == IGT_ROTATION_180) {
-		cairo_translate(cr, w, h);
-		cairo_rotate(cr, M_PI);
-	}
+	set_color(&tl, o, 0.0f, 0.0f);
+	set_color(&tr, 0.0f, o, 0.0f);
+	set_color(&br, o, o, o);
+	set_color(&bl, 0.0f, 0.0f, o);
 
-	if (rotation == IGT_ROTATION_90) {
-		/* Paint 4 squares with width == height in Green, White,
-		Blue, Red Clockwise order to look like 270 degree rotated*/
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
-	} else if (rotation == IGT_ROTATION_270) {
-		/* Paint 4 squares with width == height in Blue, Red,
-		Green, White Clockwise order to look like 90 degree rotated*/
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
-	} else {
-		/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
-	}
+	rotate_colors(&tl, &tr, &br, &bl, rotation);
+
+	igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
+	igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
+	igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
+	igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, RGB_COLOR(br));
 
 	cairo_destroy(cr);
 }
@@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
 
 	igt_remove_fb(data->gfx_fd, &data->fb);
 	igt_remove_fb(data->gfx_fd, &data->fb_reference);
+	igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
 
 	if (data->fb_flip.fb_id)
 		igt_remove_fb(data->gfx_fd, &data->fb_flip);
@@ -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	 * For 90/270, we will use create smaller fb so that the rotated
 	 * frame can fit in
 	 */
-	if (data->rotation == IGT_ROTATION_90 ||
-	    data->rotation == IGT_ROTATION_270) {
+	if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
 		tiling = data->override_tiling ?: LOCAL_I915_FORMAT_MOD_Y_TILED;
 
 		igt_swap(w, h);
 	}
 
-	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
-
-	igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
 	/*
 	 * Create a reference software rotated flip framebuffer.
 	 */
@@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
 	/*
+	 * Prepare the non-rotated reference fb.
+	 */
+	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data->fb_unrotated);
+	paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
+	igt_plane_set_fb(plane, &data->fb_unrotated);
+	igt_plane_set_rotation(plane, IGT_ROTATION_0);
+	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+		igt_plane_set_position(plane, data->pos_x, data->pos_y);
+	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
+
+	/*
 	 * Prepare the plane with an non-rotated fb let the hw rotate it.
 	 */
+	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
 	paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
 	igt_plane_set_fb(plane, &data->fb);
 
@@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
 	igt_assert(drmHandleEvent(fd, &evctx) == 0);
 }
 
-static void test_plane_rotation(data_t *data, int plane_type)
+static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
@@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int plane_type)
 		igt_plane_t *plane;
 		int i;
 
+		if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
+			continue;
+
 		igt_output_set_pipe(output, pipe);
 
 		plane = igt_output_get_plane_type(output, plane_type);
@@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int plane_type)
 			igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
 			prepare_fbs(data, output, plane, i);
 
-			igt_display_commit2(display, commit);
-
 			igt_plane_set_rotation(plane, data->rotation);
-			if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
+			if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
 				igt_plane_set_size(plane, data->fb.height, data->fb.width);
 
 			ret = igt_display_try_commit2(display, commit);
-			if (data->override_fmt || data->override_tiling) {
+			if (test_bad_format && (data->override_fmt || data->override_tiling)) {
 				igt_assert_eq(ret, -EINVAL);
 				continue;
 			}
@@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int plane_type)
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
+static inline void test_bad_plane_rotation(data_t *data, int plane_type)
+{
+	__test_plane_rotation(data, plane_type, true);
+}
+
+static inline void test_plane_rotation(data_t *data, int plane_type)
+{
+	__test_plane_rotation(data, plane_type, false);
+}
+
 static void test_plane_rotation_ytiled_obj(data_t *data,
 					   igt_output_t *output,
 					   int plane_type)
@@ -613,6 +670,8 @@ static const char *plane_test_str(unsigned plane)
 static const char *rot_test_str(igt_rotation_t rot)
 {
 	switch (rot) {
+	case IGT_ROTATION_0:
+		return "0";
 	case IGT_ROTATION_90:
 		return "90";
 	case IGT_ROTATION_180:
@@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
 	}
 }
 
+static const char *tiling_test_str(uint64_t tiling)
+{
+	switch (tiling) {
+	case LOCAL_I915_FORMAT_MOD_X_TILED:
+		return "x-tiled";
+	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+		return "y-tiled";
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+		return "yf-tiled";
+	default:
+		igt_assert(0);
+	}
+}
+
 static const char *flip_test_str(unsigned flips)
 {
 	if (flips)
@@ -637,7 +710,7 @@ igt_main
 	struct rot_subtest {
 		unsigned plane;
 		igt_rotation_t rot;
-		unsigned flips;
+		bool flips;
 	} *subtest, subtests[] = {
 		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
 		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
@@ -654,6 +727,35 @@ igt_main
 		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
 		{ 0, 0, 0}
 	};
+
+	struct reflect_x {
+		uint64_t tiling;
+		igt_rotation_t rot;
+		bool flips;
+	} *reflect_x, reflect_x_subtests[] = {
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
+		{ 0, 0, 0 }
+	};
+
 	data_t data = {};
 	int gen = 0;
 
@@ -661,7 +763,8 @@ igt_main
 
 	igt_fixture {
 		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
-		gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
+		data.devid = intel_get_drm_devid(data.gfx_fd);
+		gen = intel_gen(data.devid);
 
 		kmstest_set_vt_graphics_mode();
 
@@ -698,7 +801,7 @@ igt_main
 		data.pos_y = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_fmt = DRM_FORMAT_RGB565;
-		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("bad-tiling") {
@@ -706,7 +809,7 @@ igt_main
 		data.override_fmt = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
-		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("primary-rotation-90-Y-tiled") {
@@ -729,6 +832,21 @@ igt_main
 		igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 	}
 
+	for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
+		igt_subtest_f("primary-%s-reflect-x-%s%s",
+			      tiling_test_str(reflect_x->tiling),
+			      rot_test_str(reflect_x->rot),
+			      flip_test_str(reflect_x->flips)) {
+			igt_require(gen >= 10 ||
+				    (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
+				     && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));
+			data.rotation = (IGT_REFLECT_X | reflect_x->rot);
+			data.override_tiling = reflect_x->tiling;
+			data.flips = reflect_x->flips;
+			test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		}
+	}
+
 	igt_subtest_f("exhaust-fences") {
 		enum pipe pipe;
 		igt_output_t *output;
-- 
2.7.4

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

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

* ✗ Fi.CI.BAT: warning for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
  2017-10-20 23:29 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
@ 2017-10-20 23:48 ` Patchwork
  2017-10-24 12:12   ` Arkadiusz Hiler
  2017-10-24 14:53 ` ✓ Fi.CI.BAT: success " Patchwork
  2017-10-24 15:53 ` ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 1 reply; 15+ messages in thread
From: Patchwork @ 2017-10-20 23:48 UTC (permalink / raw)
  To: Anusha Srivatsa; +Cc: intel-gfx

== Series Details ==

Series: igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
URL   : https://patchwork.freedesktop.org/series/31407/
State : warning

== Summary ==

IGT patchset tested on top of latest successful build
9ba736aecc2a3cb34a2aeec8d417f66390e0c82b tools/intel_vbt_decode: abstract child devices printing more

with latest DRM-Tip kernel build CI_DRM_3271
0760516f3127 drm-tip: 2017y-10m-20d-18h-40m-36s UTC integration manifest

Testlist changes:
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-0
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-0-flip
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-180
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-180-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-0
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-0-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-90
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-90-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-180
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-180-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-270
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-270-flip

Test chamelium:
        Subgroup dp-hpd-fast:
                incomplete -> SKIP       (fi-bdw-gvtdvm) fdo#102332
        Subgroup dp-crc-fast:
                fail       -> PASS       (fi-kbl-7500u) fdo#102514
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-byt-j1900) fdo#101705
Test drv_module_reload:
        Subgroup basic-reload-inject:
                pass       -> DMESG-WARN (fi-skl-6770hq)

fdo#102332 https://bugs.freedesktop.org/show_bug.cgi?id=102332
fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:455s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:378s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:525s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:265s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:507s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:499s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:499s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:484s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:558s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:414s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:255s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:582s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:450s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:426s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:437s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:459s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:495s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:571s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:585s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:549s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:456s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:647s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:517s
fi-skl-6770hq    total:289  pass:268  dwarn:1   dfail:0   fail:0   skip:20  time:501s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:459s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:566s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:419s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_398/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: ✗ Fi.CI.BAT: warning for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
  2017-10-20 23:48 ` ✗ Fi.CI.BAT: warning for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2) Patchwork
@ 2017-10-24 12:12   ` Arkadiusz Hiler
  0 siblings, 0 replies; 15+ messages in thread
From: Arkadiusz Hiler @ 2017-10-24 12:12 UTC (permalink / raw)
  To: intel-gfx

On Fri, Oct 20, 2017 at 11:48:02PM +0000, Patchwork wrote:
> == Series Details ==
> 
> Series: igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
> URL   : https://patchwork.freedesktop.org/series/31407/
> State : warning
> 
> == Summary ==
> 
> IGT patchset tested on top of latest successful build
> 9ba736aecc2a3cb34a2aeec8d417f66390e0c82b tools/intel_vbt_decode: abstract child devices printing more
> 
> with latest DRM-Tip kernel build CI_DRM_3271
> 0760516f3127 drm-tip: 2017y-10m-20d-18h-40m-36s UTC integration manifest
> 
> Testlist changes:
> +igt@kms_rotation_crc@primary-x-tiled-reflect-x-0
> +igt@kms_rotation_crc@primary-x-tiled-reflect-x-0-flip
> +igt@kms_rotation_crc@primary-x-tiled-reflect-x-180
> +igt@kms_rotation_crc@primary-x-tiled-reflect-x-180-flip
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0-flip
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90-flip
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180-flip
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270
> +igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270-flip
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-0
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-0-flip
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-90
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-90-flip
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-180
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-180-flip
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-270
> +igt@kms_rotation_crc@primary-y-tiled-reflect-x-270-flip
> 
> Test chamelium:
>         Subgroup dp-hpd-fast:
>                 incomplete -> SKIP       (fi-bdw-gvtdvm) fdo#102332
>         Subgroup dp-crc-fast:
>                 fail       -> PASS       (fi-kbl-7500u) fdo#102514
> Test kms_pipe_crc_basic:
>         Subgroup suspend-read-crc-pipe-b:
>                 pass       -> DMESG-WARN (fi-byt-j1900) fdo#101705
> Test drv_module_reload:
>         Subgroup basic-reload-inject:
>                 pass       -> DMESG-WARN (fi-skl-6770hq)

Looks like a false positive from a known offender. I've scheduled a
rerun.

Cheers,
Arek

> fdo#102332 https://bugs.freedesktop.org/show_bug.cgi?id=102332
> fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
> fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705
> 
> fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
> fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:455s
> fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:378s
> fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:525s
> fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:265s
> fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:507s
> fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:499s
> fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:499s
> fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:484s
> fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:558s
> fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:414s
> fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:255s
> fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:582s
> fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:450s
> fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:426s
> fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:437s
> fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s
> fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:459s
> fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:495s
> fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:571s
> fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
> fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:585s
> fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:549s
> fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:456s
> fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:647s
> fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:517s
> fi-skl-6770hq    total:289  pass:268  dwarn:1   dfail:0   fail:0   skip:20  time:501s
> fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:459s
> fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:566s
> fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:419s
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_398/
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
  2017-10-20 23:29 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
  2017-10-20 23:48 ` ✗ Fi.CI.BAT: warning for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2) Patchwork
@ 2017-10-24 14:53 ` Patchwork
  2017-10-24 15:53 ` ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2017-10-24 14:53 UTC (permalink / raw)
  To: Anusha Srivatsa; +Cc: intel-gfx

== Series Details ==

Series: igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
URL   : https://patchwork.freedesktop.org/series/31407/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
e5f7fac9f120b0dcbf370c681b8872b8c29bf890 meson: intel_dp_compliance depends on libudev

with latest DRM-Tip kernel build CI_DRM_3276
5c82a37eff83 drm-tip: 2017y-10m-23d-18h-06m-28s UTC integration manifest

Testlist changes:
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-0
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-0-flip
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-180
+igt@kms_rotation_crc@primary-x-tiled-reflect-x-180-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-0-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-180-flip
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270
+igt@kms_rotation_crc@primary-yf-tiled-reflect-x-270-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-0
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-0-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-90
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-90-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-180
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-180-flip
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-270
+igt@kms_rotation_crc@primary-y-tiled-reflect-x-270-flip

Test chamelium:
        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:452s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:376s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:527s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:264s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:501s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:496s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:499s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:488s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:561s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:632s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:422s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:247s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:591s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:483s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:427s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:430s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:437s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:484s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:464s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:480s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:571s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:476s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:583s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:548s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:455s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:648s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:523s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:505s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:462s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:565s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:418s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_403/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
  2017-10-20 23:29 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
  2017-10-20 23:48 ` ✗ Fi.CI.BAT: warning for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2) Patchwork
  2017-10-24 14:53 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2017-10-24 15:53 ` Patchwork
  2 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2017-10-24 15:53 UTC (permalink / raw)
  To: Anusha Srivatsa; +Cc: intel-gfx

== Series Details ==

Series: igt/kms_rotation_crc: Add horizontal flip subtest. (rev2)
URL   : https://patchwork.freedesktop.org/series/31407/
State : success

== Summary ==

Test kms_busy:
        Subgroup extended-modeset-hang-oldfb-with-reset-render-B:
                dmesg-warn -> PASS       (shard-hsw) fdo#102249 +3
        Subgroup extended-modeset-hang-newfb-with-reset-render-B:
                pass       -> DMESG-WARN (shard-hsw) fdo#103038
Test drv_module_reload:
        Subgroup basic-no-display:
                pass       -> DMESG-WARN (shard-hsw) fdo#102707 +1
Test kms_flip:
        Subgroup wf_vblank-ts-check-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252

fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#103038 https://bugs.freedesktop.org/show_bug.cgi?id=103038
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw        total:2560 pass:1430 dwarn:4   dfail:0   fail:9   skip:1117 time:9104s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_403/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-12-19 21:49     ` Rodrigo Vivi
@ 2018-02-02  7:04       ` Srivatsa, Anusha
  0 siblings, 0 replies; 15+ messages in thread
From: Srivatsa, Anusha @ 2018-02-02  7:04 UTC (permalink / raw)
  To: Vivi, Rodrigo, Daniel Vetter; +Cc: intel-gfx



>-----Original Message-----
>From: Vivi, Rodrigo
>Sent: Tuesday, December 19, 2017 1:50 PM
>To: Srivatsa, Anusha <anusha.srivatsa@intel.com>
>Cc: Daniel Vetter <daniel@ffwll.ch>; Strano, Luis <luis.strano@intel.com>;
>Latvala, Petri <petri.latvala@intel.com>; Lofstedt, Marta
><marta.lofstedt@intel.com>; Saarinen, Jani <jani.saarinen@intel.com>; intel-gfx
><intel-gfx@lists.freedesktop.org>; Joseph Garvey <joseph1.garvey@intel.com>
>Subject: Re: [Intel-gfx] [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip
>subtest.
>
>On Tue, Dec 19, 2017 at 12:20:18AM +0000, Srivatsa, Anusha wrote:
>>
>>
>> >-----Original Message-----
>> >From: daniel.vetter@ffwll.ch [mailto:daniel.vetter@ffwll.ch] On
>> >Behalf Of Daniel Vetter
>> >Sent: Thursday, December 14, 2017 2:14 AM
>> >To: Srivatsa, Anusha <anusha.srivatsa@intel.com>; Strano, Luis
>> ><luis.strano@intel.com>; Latvala, Petri <petri.latvala@intel.com>;
>> >Lofstedt, Marta <marta.lofstedt@intel.com>; Saarinen, Jani
>> ><jani.saarinen@intel.com>
>> >Cc: intel-gfx <intel-gfx@lists.freedesktop.org>; Joseph Garvey
>> ><joseph1.garvey@intel.com>
>> >Subject: Re: [Intel-gfx] [PATCH i-g-t] igt/kms_rotation_crc: Add
>> >horizontal flip subtest.
>> >
>> >On Thu, Nov 23, 2017 at 12:05 AM, Anusha Srivatsa
>> ><anusha.srivatsa@intel.com>
>> >wrote:
>> >> From: Joseph Garvey <joseph1.garvey@intel.com>
>> >>
>> >> Test that horizontal flip works with supported rotations. Includes
>> >> a fix for the unrotated fb which was not being positioned correctly
>> >> with portrait and landscape rectangles.
>> >>
>> >> v2:(from Anusha)
>> >> - Change 180 degree rotation to follow the rest, use igt_swap(),
>> >> make flip variable a bool. Format the patch correctly (Ville, Petri
>> >> Latvala)
>> >>
>> >> v3: (From Anusha)
>> >> - Correct the name of subtests in order to avoid duplication of
>> >> names
>> >> (Arek)
>> >>
>> >> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
>> >> Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
>> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> >> Cc: Petri Latvala <petri.latvala@intel.com>
>> >> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
>> >
>> >I didn't see this patch fly by originally, but now Marta pointed out
>> >that this skips everywhere. We need to rework it.
>> >
>> >General principle is that in kms tests we should _not_ have any
>> >platform/feature checks encoded in the test. Instead, the testcase
>> >should check properties to figure out whether something should work or not.
>> >
>> >
>> >> ---
>> >>  lib/igt_kms.c            |   2 +-
>> >>  lib/igt_kms.h            |   5 ++
>> >>  tests/kms_rotation_crc.c | 198
>> >> +++++++++++++++++++++++++++++++++++++----------
>> >>  3 files changed, 164 insertions(+), 41 deletions(-)
>> >>
>> >> diff --git a/lib/igt_kms.c b/lib/igt_kms.c index a572fc6..3034e44
>> >> 100644
>> >> --- a/lib/igt_kms.c
>> >> +++ b/lib/igt_kms.c
>> >> @@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb,
>> >> igt_plane_t *plane,
>> >>
>> >>  static const char *rotation_name(igt_rotation_t rotation)  {
>> >> -       switch (rotation) {
>> >> +       switch (rotation & IGT_ROTATION_MASK) {
>> >>         case IGT_ROTATION_0:
>> >>                 return "0°";
>> >>         case IGT_ROTATION_90:
>> >> diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 8dc118c..b83a828
>> >> 100644
>> >> --- a/lib/igt_kms.h
>> >> +++ b/lib/igt_kms.h
>> >> @@ -281,8 +281,13 @@ typedef enum {
>> >>         IGT_ROTATION_90  = 1 << 1,
>> >>         IGT_ROTATION_180 = 1 << 2,
>> >>         IGT_ROTATION_270 = 1 << 3,
>> >> +       IGT_REFLECT_X    = 1 << 4,
>> >> +       IGT_REFLECT_Y    = 1 << 5,
>> >>  } igt_rotation_t;
>> >>
>> >> +#define IGT_ROTATION_MASK \
>> >> +       (IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 |
>> >> +IGT_ROTATION_270)
>> >> +
>> >>  typedef struct {
>> >>         /*< private >*/
>> >>         igt_pipe_t *pipe;
>> >> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
>> >> index
>> >> 5aec8fa..9e13667 100644
>> >> --- a/tests/kms_rotation_crc.c
>> >> +++ b/tests/kms_rotation_crc.c
>> >> @@ -32,6 +32,7 @@ typedef struct {
>> >>         igt_display_t display;
>> >>         struct igt_fb fb;
>> >>         struct igt_fb fb_reference;
>> >> +       struct igt_fb fb_unrotated;
>> >>         struct igt_fb fb_modeset;
>> >>         struct igt_fb fb_flip;
>> >>         igt_crc_t ref_crc;
>> >> @@ -43,8 +44,59 @@ typedef struct {
>> >>         uint32_t override_fmt;
>> >>         uint64_t override_tiling;
>> >>         bool flips;
>> >> +       int devid;
>> >>  } data_t;
>> >>
>> >> +typedef struct {
>> >> +       float r;
>> >> +       float g;
>> >> +       float b;
>> >> +} rgb_color_t;
>> >> +
>> >> +static void set_color(rgb_color_t *color, float r, float g, float
>> >> +b) {
>> >> +       color->r = r;
>> >> +       color->g = g;
>> >> +       color->b = b;
>> >> +}
>> >> +
>> >> +static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
>> >> +                         rgb_color_t *bl, igt_rotation_t rotation) {
>> >> +       rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
>> >> +
>> >> +       if (rotation & IGT_REFLECT_X) {
>> >> +               igt_swap(*tl, *tr);
>> >> +               igt_swap(*bl, *br);
>> >> +       }
>> >> +
>> >> +       if (rotation & IGT_ROTATION_90) {
>> >> +               bl_tmp = *bl;
>> >> +               br_tmp = *br;
>> >> +               tl_tmp = *tl;
>> >> +               tr_tmp = *tr;
>> >> +               *tl = tr_tmp;
>> >> +               *bl = tl_tmp;
>> >> +               *tr = br_tmp;
>> >> +               *br = bl_tmp;
>> >> +       } else if (rotation & IGT_ROTATION_180) {
>> >> +               igt_swap(*tl, *br);
>> >> +               igt_swap(*tr, *bl);
>> >> +       } else if (rotation & IGT_ROTATION_270) {
>> >> +               bl_tmp = *bl;
>> >> +               br_tmp = *br;
>> >> +               tl_tmp = *tl;
>> >> +               tr_tmp = *tr;
>> >> +               *tl = bl_tmp;
>> >> +               *bl = br_tmp;
>> >> +               *tr = tl_tmp;
>> >> +               *br = tr_tmp;
>> >> +       }
>> >> +}
>> >> +
>> >> +#define RGB_COLOR(color) \
>> >> +       color.r, color.g, color.b
>> >> +
>> >>  static void
>> >>  paint_squares(data_t *data, igt_rotation_t rotation,
>> >>               struct igt_fb *fb, float o) @@ -52,35 +104,21 @@
>> >> paint_squares(data_t *data, igt_rotation_t rotation,
>> >>         cairo_t *cr;
>> >>         unsigned int w = fb->width;
>> >>         unsigned int h = fb->height;
>> >> +       rgb_color_t tl, tr, bl, br;
>> >>
>> >>         cr = igt_get_cairo_ctx(data->gfx_fd, fb);
>> >>
>> >> -       if (rotation == IGT_ROTATION_180) {
>> >> -               cairo_translate(cr, w, h);
>> >> -               cairo_rotate(cr, M_PI);
>> >> -       }
>> >> +       set_color(&tl, o, 0.0f, 0.0f);
>> >> +       set_color(&tr, 0.0f, o, 0.0f);
>> >> +       set_color(&br, o, o, o);
>> >> +       set_color(&bl, 0.0f, 0.0f, o);
>> >>
>> >> -       if (rotation == IGT_ROTATION_90) {
>> >> -               /* Paint 4 squares with width == height in Green, White,
>> >> -               Blue, Red Clockwise order to look like 270 degree rotated*/
>> >> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
>> >> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
>> >> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
>> >> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
>> >> -       } else if (rotation == IGT_ROTATION_270) {
>> >> -               /* Paint 4 squares with width == height in Blue, Red,
>> >> -               Green, White Clockwise order to look like 90 degree rotated*/
>> >> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
>> >> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
>> >> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
>> >> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
>> >> -       } else {
>> >> -               /* Paint with 4 squares of Red, Green, White, Blue Clockwise */
>> >> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
>> >> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
>> >> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
>> >> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
>> >> -       }
>> >> +       rotate_colors(&tl, &tr, &br, &bl, rotation);
>> >> +
>> >> +       igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
>> >> +       igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
>> >> +       igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
>> >> +       igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2,
>> >> + RGB_COLOR(br));
>> >>
>> >>         cairo_destroy(cr);
>> >>  }
>> >> @@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
>> >>
>> >>         igt_remove_fb(data->gfx_fd, &data->fb);
>> >>         igt_remove_fb(data->gfx_fd, &data->fb_reference);
>> >> +       igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
>> >>
>> >>         if (data->fb_flip.fb_id)
>> >>                 igt_remove_fb(data->gfx_fd, &data->fb_flip); @@
>> >> -212,17 +251,12 @@ static void prepare_fbs(data_t *data,
>> >> igt_output_t
>> >*output,
>> >>          * For 90/270, we will use create smaller fb so that the rotated
>> >>          * frame can fit in
>> >>          */
>> >> -       if (data->rotation == IGT_ROTATION_90 ||
>> >> -           data->rotation == IGT_ROTATION_270) {
>> >> +       if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
>> >> + {
>> >>                 tiling = data->override_tiling ?:
>> >> LOCAL_I915_FORMAT_MOD_Y_TILED;
>> >>
>> >>                 igt_swap(w, h);
>> >>         }
>> >>
>> >> -       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
>> >> -
>> >> -       igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> >> -
>> >>         /*
>> >>          * Create a reference software rotated flip framebuffer.
>> >>          */
>> >> @@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data,
>> >> igt_output_t
>> >*output,
>> >>         igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>> >>
>> >>         /*
>> >> +        * Prepare the non-rotated reference fb.
>> >> +        */
>> >> +       igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
>> >> + tiling, &data-
>> >>fb_unrotated);
>> >> +       paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
>> >> +       igt_plane_set_fb(plane, &data->fb_unrotated);
>> >> +       igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> >> +       if (plane->type != DRM_PLANE_TYPE_CURSOR)
>> >> +               igt_plane_set_position(plane, data->pos_x, data->pos_y);
>> >> +       igt_display_commit2(display, display->is_atomic ?
>> >> + COMMIT_ATOMIC : COMMIT_UNIVERSAL);
>> >> +
>> >> +       /*
>> >>          * Prepare the plane with an non-rotated fb let the hw rotate it.
>> >>          */
>> >> +       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
>> >> + &data->fb);
>> >>         paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
>> >>         igt_plane_set_fb(plane, &data->fb);
>> >>
>> >> @@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
>> >>         igt_assert(drmHandleEvent(fd, &evctx) == 0);  }
>> >>
>> >> -static void test_plane_rotation(data_t *data, int plane_type)
>> >> +static void __test_plane_rotation(data_t *data, int plane_type,
>> >> +bool
>> >> +test_bad_format)
>> >>  {
>> >>         igt_display_t *display = &data->display;
>> >>         igt_output_t *output;
>> >> @@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data,
>> >> int
>> >plane_type)
>> >>                 igt_plane_t *plane;
>> >>                 int i;
>> >>
>> >> +               if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
>> >> +                       continue;
>> >
>> >This check here must be removed.
>> OK.
>> >> +
>> >>                 igt_output_set_pipe(output, pipe);
>> >>
>> >>                 plane = igt_output_get_plane_type(output,
>> >> plane_type); @@ -369,14 +418,12 @@ static void
>> >> test_plane_rotation(data_t *data, int
>> >plane_type)
>> >>                         igt_debug("Testing case %i on pipe %s\n",
>> >> i,
>> >kmstest_pipe_name(pipe));
>> >>                         prepare_fbs(data, output, plane, i);
>> >>
>> >> -                       igt_display_commit2(display, commit);
>> >> -
>> >>                         igt_plane_set_rotation(plane, data->rotation);
>> >> -                       if (data->rotation == IGT_ROTATION_90 || data->rotation ==
>> >IGT_ROTATION_270)
>> >> +                       if (data->rotation & (IGT_ROTATION_90 |
>> >> + IGT_ROTATION_270))
>> >>                                 igt_plane_set_size(plane,
>> >> data->fb.height, data->fb.width);
>> >>
>> >>                         ret = igt_display_try_commit2(display, commit);
>> >> -                       if (data->override_fmt || data->override_tiling) {
>> >> +                       if (test_bad_format && (data->override_fmt
>> >> + ||
>> >> + data->override_tiling)) {
>> >>                                 igt_assert_eq(ret, -EINVAL);
>> >>                                 continue;
>> >>                         }
>> >> @@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data,
>> >> int
>> >plane_type)
>> >>         igt_require_f(valid_tests, "no valid crtc/connector
>> >> combinations found\n");  }
>> >>
>> >> +static inline void test_bad_plane_rotation(data_t *data, int
>> >> +plane_type) {
>> >> +       __test_plane_rotation(data, plane_type, true); }
>> >> +
>> >> +static inline void test_plane_rotation(data_t *data, int
>> >> +plane_type) {
>> >> +       __test_plane_rotation(data, plane_type, false); }
>> >> +
>> >>  static void test_plane_rotation_ytiled_obj(data_t *data,
>> >>                                            igt_output_t *output,
>> >>                                            int plane_type) @@
>> >> -613,6
>> >> +670,8 @@ static const char *plane_test_str(unsigned plane)  static
>> >> const char *rot_test_str(igt_rotation_t rot)  {
>> >>         switch (rot) {
>> >> +       case IGT_ROTATION_0:
>> >> +               return "0";
>> >>         case IGT_ROTATION_90:
>> >>                 return "90";
>> >>         case IGT_ROTATION_180:
>> >> @@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
>> >>         }
>> >>  }
>> >>
>> >> +static const char *tiling_test_str(uint64_t tiling) {
>> >> +       switch (tiling) {
>> >> +       case LOCAL_I915_FORMAT_MOD_X_TILED:
>> >> +               return "x-tiled";
>> >> +       case LOCAL_I915_FORMAT_MOD_Y_TILED:
>> >> +               return "y-tiled";
>> >> +       case LOCAL_I915_FORMAT_MOD_Yf_TILED:
>> >> +               return "yf-tiled";
>> >> +       default:
>> >> +               igt_assert(0);
>> >> +       }
>> >> +}
>> >> +
>> >>  static const char *flip_test_str(unsigned flips)  {
>> >>         if (flips)
>> >> @@ -637,7 +710,7 @@ igt_main
>> >>         struct rot_subtest {
>> >>                 unsigned plane;
>> >>                 igt_rotation_t rot;
>> >> -               unsigned flips;
>> >> +               bool flips;
>> >>         } *subtest, subtests[] = {
>> >>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
>> >>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 }, @@
>> >> -654,6 +727,35 @@ igt_main
>> >>                 { DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
>> >>                 { 0, 0, 0}
>> >>         };
>> >> +
>> >> +       struct reflect_x {
>> >> +               uint64_t tiling;
>> >> +               igt_rotation_t rot;
>> >> +               bool flips;
>> >> +       } *reflect_x, reflect_x_subtests[] = {
>> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
>> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
>> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
>> >> +               { 0, 0, 0 }
>> >> +       };
>> >> +
>> >>         data_t data = {};
>> >>         int gen = 0;
>> >>
>> >> @@ -661,7 +763,8 @@ igt_main
>> >>
>> >>         igt_fixture {
>> >>                 data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
>> >> -               gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
>> >> +               data.devid = intel_get_drm_devid(data.gfx_fd);
>> >> +               gen = intel_gen(data.devid);
>> >>
>> >>                 kmstest_set_vt_graphics_mode();
>> >>
>> >> @@ -698,7 +801,7 @@ igt_main
>> >>                 data.pos_y = 0;
>> >>                 data.rotation = IGT_ROTATION_90;
>> >>                 data.override_fmt = DRM_FORMAT_RGB565;
>> >> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> >> +               test_bad_plane_rotation(&data,
>> >> + DRM_PLANE_TYPE_PRIMARY);
>> >>         }
>> >>
>> >>         igt_subtest_f("bad-tiling") { @@ -706,7 +809,7 @@ igt_main
>> >>                 data.override_fmt = 0;
>> >>                 data.rotation = IGT_ROTATION_90;
>> >>                 data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
>> >> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> >> +               test_bad_plane_rotation(&data,
>> >> + DRM_PLANE_TYPE_PRIMARY);
>> >>         }
>> >>
>> >>         igt_subtest_f("primary-rotation-90-Y-tiled") { @@ -729,6
>> >> +832,21 @@ igt_main
>> >>                 igt_require_f(valid_tests, "no valid crtc/connector
>> >> combinations
>> >found\n");
>> >>         }
>> >>
>> >> +       for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
>> >> +               igt_subtest_f("primary-%s-reflect-x-%s%s",
>> >> +                             tiling_test_str(reflect_x->tiling),
>> >> +                             rot_test_str(reflect_x->rot),
>> >> +                             flip_test_str(reflect_x->flips)) {
>> >> +                       igt_require(gen >= 10 ||
>> >> +                                   (IS_CHERRYVIEW(data.devid) &&
>> >> + reflect_x->rot ==
>> >IGT_ROTATION_0
>> >> +                                    && reflect_x->tiling ==
>> >> + LOCAL_I915_FORMAT_MOD_X_TILED));
>> >
>> >This check here also must be removed and instead we need to check
>> >whether the rotation property supports the combination of
>> >rotation/flipping that we want to test.

Daniel, Rodrigo,

Will using igt_plane_get_prop() be a good approach?
All tests are still failing with igt_plane_get_prop() used in igt_require....

Anusha 
>> >Anusha, can you pls follow up with this?
>> >
>> >Cc'ing Luis too to keep track of this.
>> Sure Daniel, Thanks a lot for your feedback.
>> Will roll up a new version of this.
>
>It is already merged so a patch to fix is needed instead of a new version.
>
>>
>> Anusha
>> >Thanks, Daniel
>> >
>> >> +                       data.rotation = (IGT_REFLECT_X | reflect_x->rot);
>> >> +                       data.override_tiling = reflect_x->tiling;
>> >> +                       data.flips = reflect_x->flips;
>> >> +                       test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> >> +               }
>> >> +       }
>> >> +
>> >>         igt_subtest_f("exhaust-fences") {
>> >>                 enum pipe pipe;
>> >>                 igt_output_t *output;
>> >> --
>> >> 2.7.4
>> >>
>> >> _______________________________________________
>> >> Intel-gfx mailing list
>> >> Intel-gfx@lists.freedesktop.org
>> >> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>> >
>> >
>> >
>> >--
>> >Daniel Vetter
>> >Software Engineer, Intel Corporation
>> >+41 (0) 79 365 57 48 - http://blog.ffwll.ch
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-12-19  0:20   ` Srivatsa, Anusha
@ 2017-12-19 21:49     ` Rodrigo Vivi
  2018-02-02  7:04       ` Srivatsa, Anusha
  0 siblings, 1 reply; 15+ messages in thread
From: Rodrigo Vivi @ 2017-12-19 21:49 UTC (permalink / raw)
  To: Srivatsa, Anusha; +Cc: Joseph Garvey, intel-gfx, Strano, Luis

On Tue, Dec 19, 2017 at 12:20:18AM +0000, Srivatsa, Anusha wrote:
> 
> 
> >-----Original Message-----
> >From: daniel.vetter@ffwll.ch [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel
> >Vetter
> >Sent: Thursday, December 14, 2017 2:14 AM
> >To: Srivatsa, Anusha <anusha.srivatsa@intel.com>; Strano, Luis
> ><luis.strano@intel.com>; Latvala, Petri <petri.latvala@intel.com>; Lofstedt,
> >Marta <marta.lofstedt@intel.com>; Saarinen, Jani <jani.saarinen@intel.com>
> >Cc: intel-gfx <intel-gfx@lists.freedesktop.org>; Joseph Garvey
> ><joseph1.garvey@intel.com>
> >Subject: Re: [Intel-gfx] [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip
> >subtest.
> >
> >On Thu, Nov 23, 2017 at 12:05 AM, Anusha Srivatsa <anusha.srivatsa@intel.com>
> >wrote:
> >> From: Joseph Garvey <joseph1.garvey@intel.com>
> >>
> >> Test that horizontal flip works with supported rotations. Includes a
> >> fix for the unrotated fb which was not being positioned correctly with
> >> portrait and landscape rectangles.
> >>
> >> v2:(from Anusha)
> >> - Change 180 degree rotation to follow the rest, use igt_swap(), make
> >> flip variable a bool. Format the patch correctly (Ville, Petri
> >> Latvala)
> >>
> >> v3: (From Anusha)
> >> - Correct the name of subtests in order to avoid duplication of names
> >> (Arek)
> >>
> >> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> >> Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> Cc: Petri Latvala <petri.latvala@intel.com>
> >> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> >
> >I didn't see this patch fly by originally, but now Marta pointed out that this skips
> >everywhere. We need to rework it.
> >
> >General principle is that in kms tests we should _not_ have any platform/feature
> >checks encoded in the test. Instead, the testcase should check properties to
> >figure out whether something should work or not.
> >
> >
> >> ---
> >>  lib/igt_kms.c            |   2 +-
> >>  lib/igt_kms.h            |   5 ++
> >>  tests/kms_rotation_crc.c | 198
> >> +++++++++++++++++++++++++++++++++++++----------
> >>  3 files changed, 164 insertions(+), 41 deletions(-)
> >>
> >> diff --git a/lib/igt_kms.c b/lib/igt_kms.c index a572fc6..3034e44
> >> 100644
> >> --- a/lib/igt_kms.c
> >> +++ b/lib/igt_kms.c
> >> @@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb,
> >> igt_plane_t *plane,
> >>
> >>  static const char *rotation_name(igt_rotation_t rotation)  {
> >> -       switch (rotation) {
> >> +       switch (rotation & IGT_ROTATION_MASK) {
> >>         case IGT_ROTATION_0:
> >>                 return "0°";
> >>         case IGT_ROTATION_90:
> >> diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 8dc118c..b83a828
> >> 100644
> >> --- a/lib/igt_kms.h
> >> +++ b/lib/igt_kms.h
> >> @@ -281,8 +281,13 @@ typedef enum {
> >>         IGT_ROTATION_90  = 1 << 1,
> >>         IGT_ROTATION_180 = 1 << 2,
> >>         IGT_ROTATION_270 = 1 << 3,
> >> +       IGT_REFLECT_X    = 1 << 4,
> >> +       IGT_REFLECT_Y    = 1 << 5,
> >>  } igt_rotation_t;
> >>
> >> +#define IGT_ROTATION_MASK \
> >> +       (IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 |
> >> +IGT_ROTATION_270)
> >> +
> >>  typedef struct {
> >>         /*< private >*/
> >>         igt_pipe_t *pipe;
> >> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index
> >> 5aec8fa..9e13667 100644
> >> --- a/tests/kms_rotation_crc.c
> >> +++ b/tests/kms_rotation_crc.c
> >> @@ -32,6 +32,7 @@ typedef struct {
> >>         igt_display_t display;
> >>         struct igt_fb fb;
> >>         struct igt_fb fb_reference;
> >> +       struct igt_fb fb_unrotated;
> >>         struct igt_fb fb_modeset;
> >>         struct igt_fb fb_flip;
> >>         igt_crc_t ref_crc;
> >> @@ -43,8 +44,59 @@ typedef struct {
> >>         uint32_t override_fmt;
> >>         uint64_t override_tiling;
> >>         bool flips;
> >> +       int devid;
> >>  } data_t;
> >>
> >> +typedef struct {
> >> +       float r;
> >> +       float g;
> >> +       float b;
> >> +} rgb_color_t;
> >> +
> >> +static void set_color(rgb_color_t *color, float r, float g, float b)
> >> +{
> >> +       color->r = r;
> >> +       color->g = g;
> >> +       color->b = b;
> >> +}
> >> +
> >> +static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
> >> +                         rgb_color_t *bl, igt_rotation_t rotation) {
> >> +       rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
> >> +
> >> +       if (rotation & IGT_REFLECT_X) {
> >> +               igt_swap(*tl, *tr);
> >> +               igt_swap(*bl, *br);
> >> +       }
> >> +
> >> +       if (rotation & IGT_ROTATION_90) {
> >> +               bl_tmp = *bl;
> >> +               br_tmp = *br;
> >> +               tl_tmp = *tl;
> >> +               tr_tmp = *tr;
> >> +               *tl = tr_tmp;
> >> +               *bl = tl_tmp;
> >> +               *tr = br_tmp;
> >> +               *br = bl_tmp;
> >> +       } else if (rotation & IGT_ROTATION_180) {
> >> +               igt_swap(*tl, *br);
> >> +               igt_swap(*tr, *bl);
> >> +       } else if (rotation & IGT_ROTATION_270) {
> >> +               bl_tmp = *bl;
> >> +               br_tmp = *br;
> >> +               tl_tmp = *tl;
> >> +               tr_tmp = *tr;
> >> +               *tl = bl_tmp;
> >> +               *bl = br_tmp;
> >> +               *tr = tl_tmp;
> >> +               *br = tr_tmp;
> >> +       }
> >> +}
> >> +
> >> +#define RGB_COLOR(color) \
> >> +       color.r, color.g, color.b
> >> +
> >>  static void
> >>  paint_squares(data_t *data, igt_rotation_t rotation,
> >>               struct igt_fb *fb, float o) @@ -52,35 +104,21 @@
> >> paint_squares(data_t *data, igt_rotation_t rotation,
> >>         cairo_t *cr;
> >>         unsigned int w = fb->width;
> >>         unsigned int h = fb->height;
> >> +       rgb_color_t tl, tr, bl, br;
> >>
> >>         cr = igt_get_cairo_ctx(data->gfx_fd, fb);
> >>
> >> -       if (rotation == IGT_ROTATION_180) {
> >> -               cairo_translate(cr, w, h);
> >> -               cairo_rotate(cr, M_PI);
> >> -       }
> >> +       set_color(&tl, o, 0.0f, 0.0f);
> >> +       set_color(&tr, 0.0f, o, 0.0f);
> >> +       set_color(&br, o, o, o);
> >> +       set_color(&bl, 0.0f, 0.0f, o);
> >>
> >> -       if (rotation == IGT_ROTATION_90) {
> >> -               /* Paint 4 squares with width == height in Green, White,
> >> -               Blue, Red Clockwise order to look like 270 degree rotated*/
> >> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
> >> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
> >> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
> >> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> >> -       } else if (rotation == IGT_ROTATION_270) {
> >> -               /* Paint 4 squares with width == height in Blue, Red,
> >> -               Green, White Clockwise order to look like 90 degree rotated*/
> >> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
> >> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
> >> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
> >> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
> >> -       } else {
> >> -               /* Paint with 4 squares of Red, Green, White, Blue Clockwise */
> >> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
> >> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
> >> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> >> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
> >> -       }
> >> +       rotate_colors(&tl, &tr, &br, &bl, rotation);
> >> +
> >> +       igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
> >> +       igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
> >> +       igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
> >> +       igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2,
> >> + RGB_COLOR(br));
> >>
> >>         cairo_destroy(cr);
> >>  }
> >> @@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
> >>
> >>         igt_remove_fb(data->gfx_fd, &data->fb);
> >>         igt_remove_fb(data->gfx_fd, &data->fb_reference);
> >> +       igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
> >>
> >>         if (data->fb_flip.fb_id)
> >>                 igt_remove_fb(data->gfx_fd, &data->fb_flip); @@
> >> -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t
> >*output,
> >>          * For 90/270, we will use create smaller fb so that the rotated
> >>          * frame can fit in
> >>          */
> >> -       if (data->rotation == IGT_ROTATION_90 ||
> >> -           data->rotation == IGT_ROTATION_270) {
> >> +       if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
> >>                 tiling = data->override_tiling ?:
> >> LOCAL_I915_FORMAT_MOD_Y_TILED;
> >>
> >>                 igt_swap(w, h);
> >>         }
> >>
> >> -       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
> >> -
> >> -       igt_plane_set_rotation(plane, IGT_ROTATION_0);
> >> -
> >>         /*
> >>          * Create a reference software rotated flip framebuffer.
> >>          */
> >> @@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t
> >*output,
> >>         igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> >>
> >>         /*
> >> +        * Prepare the non-rotated reference fb.
> >> +        */
> >> +       igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data-
> >>fb_unrotated);
> >> +       paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
> >> +       igt_plane_set_fb(plane, &data->fb_unrotated);
> >> +       igt_plane_set_rotation(plane, IGT_ROTATION_0);
> >> +       if (plane->type != DRM_PLANE_TYPE_CURSOR)
> >> +               igt_plane_set_position(plane, data->pos_x, data->pos_y);
> >> +       igt_display_commit2(display, display->is_atomic ?
> >> + COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> >> +
> >> +       /*
> >>          * Prepare the plane with an non-rotated fb let the hw rotate it.
> >>          */
> >> +       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
> >> + &data->fb);
> >>         paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
> >>         igt_plane_set_fb(plane, &data->fb);
> >>
> >> @@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
> >>         igt_assert(drmHandleEvent(fd, &evctx) == 0);  }
> >>
> >> -static void test_plane_rotation(data_t *data, int plane_type)
> >> +static void __test_plane_rotation(data_t *data, int plane_type, bool
> >> +test_bad_format)
> >>  {
> >>         igt_display_t *display = &data->display;
> >>         igt_output_t *output;
> >> @@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int
> >plane_type)
> >>                 igt_plane_t *plane;
> >>                 int i;
> >>
> >> +               if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
> >> +                       continue;
> >
> >This check here must be removed.
> OK.
> >> +
> >>                 igt_output_set_pipe(output, pipe);
> >>
> >>                 plane = igt_output_get_plane_type(output, plane_type);
> >> @@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int
> >plane_type)
> >>                         igt_debug("Testing case %i on pipe %s\n", i,
> >kmstest_pipe_name(pipe));
> >>                         prepare_fbs(data, output, plane, i);
> >>
> >> -                       igt_display_commit2(display, commit);
> >> -
> >>                         igt_plane_set_rotation(plane, data->rotation);
> >> -                       if (data->rotation == IGT_ROTATION_90 || data->rotation ==
> >IGT_ROTATION_270)
> >> +                       if (data->rotation & (IGT_ROTATION_90 |
> >> + IGT_ROTATION_270))
> >>                                 igt_plane_set_size(plane,
> >> data->fb.height, data->fb.width);
> >>
> >>                         ret = igt_display_try_commit2(display, commit);
> >> -                       if (data->override_fmt || data->override_tiling) {
> >> +                       if (test_bad_format && (data->override_fmt ||
> >> + data->override_tiling)) {
> >>                                 igt_assert_eq(ret, -EINVAL);
> >>                                 continue;
> >>                         }
> >> @@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int
> >plane_type)
> >>         igt_require_f(valid_tests, "no valid crtc/connector
> >> combinations found\n");  }
> >>
> >> +static inline void test_bad_plane_rotation(data_t *data, int
> >> +plane_type) {
> >> +       __test_plane_rotation(data, plane_type, true); }
> >> +
> >> +static inline void test_plane_rotation(data_t *data, int plane_type)
> >> +{
> >> +       __test_plane_rotation(data, plane_type, false); }
> >> +
> >>  static void test_plane_rotation_ytiled_obj(data_t *data,
> >>                                            igt_output_t *output,
> >>                                            int plane_type) @@ -613,6
> >> +670,8 @@ static const char *plane_test_str(unsigned plane)  static
> >> const char *rot_test_str(igt_rotation_t rot)  {
> >>         switch (rot) {
> >> +       case IGT_ROTATION_0:
> >> +               return "0";
> >>         case IGT_ROTATION_90:
> >>                 return "90";
> >>         case IGT_ROTATION_180:
> >> @@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
> >>         }
> >>  }
> >>
> >> +static const char *tiling_test_str(uint64_t tiling) {
> >> +       switch (tiling) {
> >> +       case LOCAL_I915_FORMAT_MOD_X_TILED:
> >> +               return "x-tiled";
> >> +       case LOCAL_I915_FORMAT_MOD_Y_TILED:
> >> +               return "y-tiled";
> >> +       case LOCAL_I915_FORMAT_MOD_Yf_TILED:
> >> +               return "yf-tiled";
> >> +       default:
> >> +               igt_assert(0);
> >> +       }
> >> +}
> >> +
> >>  static const char *flip_test_str(unsigned flips)  {
> >>         if (flips)
> >> @@ -637,7 +710,7 @@ igt_main
> >>         struct rot_subtest {
> >>                 unsigned plane;
> >>                 igt_rotation_t rot;
> >> -               unsigned flips;
> >> +               bool flips;
> >>         } *subtest, subtests[] = {
> >>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
> >>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 }, @@
> >> -654,6 +727,35 @@ igt_main
> >>                 { DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
> >>                 { 0, 0, 0}
> >>         };
> >> +
> >> +       struct reflect_x {
> >> +               uint64_t tiling;
> >> +               igt_rotation_t rot;
> >> +               bool flips;
> >> +       } *reflect_x, reflect_x_subtests[] = {
> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
> >> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
> >> +               { 0, 0, 0 }
> >> +       };
> >> +
> >>         data_t data = {};
> >>         int gen = 0;
> >>
> >> @@ -661,7 +763,8 @@ igt_main
> >>
> >>         igt_fixture {
> >>                 data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
> >> -               gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
> >> +               data.devid = intel_get_drm_devid(data.gfx_fd);
> >> +               gen = intel_gen(data.devid);
> >>
> >>                 kmstest_set_vt_graphics_mode();
> >>
> >> @@ -698,7 +801,7 @@ igt_main
> >>                 data.pos_y = 0;
> >>                 data.rotation = IGT_ROTATION_90;
> >>                 data.override_fmt = DRM_FORMAT_RGB565;
> >> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> >> +               test_bad_plane_rotation(&data,
> >> + DRM_PLANE_TYPE_PRIMARY);
> >>         }
> >>
> >>         igt_subtest_f("bad-tiling") {
> >> @@ -706,7 +809,7 @@ igt_main
> >>                 data.override_fmt = 0;
> >>                 data.rotation = IGT_ROTATION_90;
> >>                 data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> >> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> >> +               test_bad_plane_rotation(&data,
> >> + DRM_PLANE_TYPE_PRIMARY);
> >>         }
> >>
> >>         igt_subtest_f("primary-rotation-90-Y-tiled") { @@ -729,6
> >> +832,21 @@ igt_main
> >>                 igt_require_f(valid_tests, "no valid crtc/connector combinations
> >found\n");
> >>         }
> >>
> >> +       for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
> >> +               igt_subtest_f("primary-%s-reflect-x-%s%s",
> >> +                             tiling_test_str(reflect_x->tiling),
> >> +                             rot_test_str(reflect_x->rot),
> >> +                             flip_test_str(reflect_x->flips)) {
> >> +                       igt_require(gen >= 10 ||
> >> +                                   (IS_CHERRYVIEW(data.devid) && reflect_x->rot ==
> >IGT_ROTATION_0
> >> +                                    && reflect_x->tiling ==
> >> + LOCAL_I915_FORMAT_MOD_X_TILED));
> >
> >This check here also must be removed and instead we need to check whether the
> >rotation property supports the combination of rotation/flipping that we want to
> >test.
> >
> >Anusha, can you pls follow up with this?
> >
> >Cc'ing Luis too to keep track of this.
> Sure Daniel, Thanks a lot for your feedback.
> Will roll up a new version of this.

It is already merged so a patch to fix is
needed instead of a new version.

> 
> Anusha 
> >Thanks, Daniel
> >
> >> +                       data.rotation = (IGT_REFLECT_X | reflect_x->rot);
> >> +                       data.override_tiling = reflect_x->tiling;
> >> +                       data.flips = reflect_x->flips;
> >> +                       test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> >> +               }
> >> +       }
> >> +
> >>         igt_subtest_f("exhaust-fences") {
> >>                 enum pipe pipe;
> >>                 igt_output_t *output;
> >> --
> >> 2.7.4
> >>
> >> _______________________________________________
> >> Intel-gfx mailing list
> >> Intel-gfx@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> >
> >
> >
> >--
> >Daniel Vetter
> >Software Engineer, Intel Corporation
> >+41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-12-14 10:14 ` Daniel Vetter
  2017-12-19  0:00   ` Rodrigo Vivi
@ 2017-12-19  0:20   ` Srivatsa, Anusha
  2017-12-19 21:49     ` Rodrigo Vivi
  1 sibling, 1 reply; 15+ messages in thread
From: Srivatsa, Anusha @ 2017-12-19  0:20 UTC (permalink / raw)
  To: Daniel Vetter, Strano, Luis, Latvala, Petri, Lofstedt, Marta,
	Saarinen, Jani
  Cc: intel-gfx, Joseph Garvey



>-----Original Message-----
>From: daniel.vetter@ffwll.ch [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel
>Vetter
>Sent: Thursday, December 14, 2017 2:14 AM
>To: Srivatsa, Anusha <anusha.srivatsa@intel.com>; Strano, Luis
><luis.strano@intel.com>; Latvala, Petri <petri.latvala@intel.com>; Lofstedt,
>Marta <marta.lofstedt@intel.com>; Saarinen, Jani <jani.saarinen@intel.com>
>Cc: intel-gfx <intel-gfx@lists.freedesktop.org>; Joseph Garvey
><joseph1.garvey@intel.com>
>Subject: Re: [Intel-gfx] [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip
>subtest.
>
>On Thu, Nov 23, 2017 at 12:05 AM, Anusha Srivatsa <anusha.srivatsa@intel.com>
>wrote:
>> From: Joseph Garvey <joseph1.garvey@intel.com>
>>
>> Test that horizontal flip works with supported rotations. Includes a
>> fix for the unrotated fb which was not being positioned correctly with
>> portrait and landscape rectangles.
>>
>> v2:(from Anusha)
>> - Change 180 degree rotation to follow the rest, use igt_swap(), make
>> flip variable a bool. Format the patch correctly (Ville, Petri
>> Latvala)
>>
>> v3: (From Anusha)
>> - Correct the name of subtests in order to avoid duplication of names
>> (Arek)
>>
>> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
>> Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Cc: Petri Latvala <petri.latvala@intel.com>
>> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
>
>I didn't see this patch fly by originally, but now Marta pointed out that this skips
>everywhere. We need to rework it.
>
>General principle is that in kms tests we should _not_ have any platform/feature
>checks encoded in the test. Instead, the testcase should check properties to
>figure out whether something should work or not.
>
>
>> ---
>>  lib/igt_kms.c            |   2 +-
>>  lib/igt_kms.h            |   5 ++
>>  tests/kms_rotation_crc.c | 198
>> +++++++++++++++++++++++++++++++++++++----------
>>  3 files changed, 164 insertions(+), 41 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c index a572fc6..3034e44
>> 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb,
>> igt_plane_t *plane,
>>
>>  static const char *rotation_name(igt_rotation_t rotation)  {
>> -       switch (rotation) {
>> +       switch (rotation & IGT_ROTATION_MASK) {
>>         case IGT_ROTATION_0:
>>                 return "0°";
>>         case IGT_ROTATION_90:
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 8dc118c..b83a828
>> 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -281,8 +281,13 @@ typedef enum {
>>         IGT_ROTATION_90  = 1 << 1,
>>         IGT_ROTATION_180 = 1 << 2,
>>         IGT_ROTATION_270 = 1 << 3,
>> +       IGT_REFLECT_X    = 1 << 4,
>> +       IGT_REFLECT_Y    = 1 << 5,
>>  } igt_rotation_t;
>>
>> +#define IGT_ROTATION_MASK \
>> +       (IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 |
>> +IGT_ROTATION_270)
>> +
>>  typedef struct {
>>         /*< private >*/
>>         igt_pipe_t *pipe;
>> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index
>> 5aec8fa..9e13667 100644
>> --- a/tests/kms_rotation_crc.c
>> +++ b/tests/kms_rotation_crc.c
>> @@ -32,6 +32,7 @@ typedef struct {
>>         igt_display_t display;
>>         struct igt_fb fb;
>>         struct igt_fb fb_reference;
>> +       struct igt_fb fb_unrotated;
>>         struct igt_fb fb_modeset;
>>         struct igt_fb fb_flip;
>>         igt_crc_t ref_crc;
>> @@ -43,8 +44,59 @@ typedef struct {
>>         uint32_t override_fmt;
>>         uint64_t override_tiling;
>>         bool flips;
>> +       int devid;
>>  } data_t;
>>
>> +typedef struct {
>> +       float r;
>> +       float g;
>> +       float b;
>> +} rgb_color_t;
>> +
>> +static void set_color(rgb_color_t *color, float r, float g, float b)
>> +{
>> +       color->r = r;
>> +       color->g = g;
>> +       color->b = b;
>> +}
>> +
>> +static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
>> +                         rgb_color_t *bl, igt_rotation_t rotation) {
>> +       rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
>> +
>> +       if (rotation & IGT_REFLECT_X) {
>> +               igt_swap(*tl, *tr);
>> +               igt_swap(*bl, *br);
>> +       }
>> +
>> +       if (rotation & IGT_ROTATION_90) {
>> +               bl_tmp = *bl;
>> +               br_tmp = *br;
>> +               tl_tmp = *tl;
>> +               tr_tmp = *tr;
>> +               *tl = tr_tmp;
>> +               *bl = tl_tmp;
>> +               *tr = br_tmp;
>> +               *br = bl_tmp;
>> +       } else if (rotation & IGT_ROTATION_180) {
>> +               igt_swap(*tl, *br);
>> +               igt_swap(*tr, *bl);
>> +       } else if (rotation & IGT_ROTATION_270) {
>> +               bl_tmp = *bl;
>> +               br_tmp = *br;
>> +               tl_tmp = *tl;
>> +               tr_tmp = *tr;
>> +               *tl = bl_tmp;
>> +               *bl = br_tmp;
>> +               *tr = tl_tmp;
>> +               *br = tr_tmp;
>> +       }
>> +}
>> +
>> +#define RGB_COLOR(color) \
>> +       color.r, color.g, color.b
>> +
>>  static void
>>  paint_squares(data_t *data, igt_rotation_t rotation,
>>               struct igt_fb *fb, float o) @@ -52,35 +104,21 @@
>> paint_squares(data_t *data, igt_rotation_t rotation,
>>         cairo_t *cr;
>>         unsigned int w = fb->width;
>>         unsigned int h = fb->height;
>> +       rgb_color_t tl, tr, bl, br;
>>
>>         cr = igt_get_cairo_ctx(data->gfx_fd, fb);
>>
>> -       if (rotation == IGT_ROTATION_180) {
>> -               cairo_translate(cr, w, h);
>> -               cairo_rotate(cr, M_PI);
>> -       }
>> +       set_color(&tl, o, 0.0f, 0.0f);
>> +       set_color(&tr, 0.0f, o, 0.0f);
>> +       set_color(&br, o, o, o);
>> +       set_color(&bl, 0.0f, 0.0f, o);
>>
>> -       if (rotation == IGT_ROTATION_90) {
>> -               /* Paint 4 squares with width == height in Green, White,
>> -               Blue, Red Clockwise order to look like 270 degree rotated*/
>> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
>> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
>> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
>> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
>> -       } else if (rotation == IGT_ROTATION_270) {
>> -               /* Paint 4 squares with width == height in Blue, Red,
>> -               Green, White Clockwise order to look like 90 degree rotated*/
>> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
>> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
>> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
>> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
>> -       } else {
>> -               /* Paint with 4 squares of Red, Green, White, Blue Clockwise */
>> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
>> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
>> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
>> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
>> -       }
>> +       rotate_colors(&tl, &tr, &br, &bl, rotation);
>> +
>> +       igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
>> +       igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
>> +       igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
>> +       igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2,
>> + RGB_COLOR(br));
>>
>>         cairo_destroy(cr);
>>  }
>> @@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
>>
>>         igt_remove_fb(data->gfx_fd, &data->fb);
>>         igt_remove_fb(data->gfx_fd, &data->fb_reference);
>> +       igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
>>
>>         if (data->fb_flip.fb_id)
>>                 igt_remove_fb(data->gfx_fd, &data->fb_flip); @@
>> -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t
>*output,
>>          * For 90/270, we will use create smaller fb so that the rotated
>>          * frame can fit in
>>          */
>> -       if (data->rotation == IGT_ROTATION_90 ||
>> -           data->rotation == IGT_ROTATION_270) {
>> +       if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
>>                 tiling = data->override_tiling ?:
>> LOCAL_I915_FORMAT_MOD_Y_TILED;
>>
>>                 igt_swap(w, h);
>>         }
>>
>> -       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
>> -
>> -       igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> -
>>         /*
>>          * Create a reference software rotated flip framebuffer.
>>          */
>> @@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t
>*output,
>>         igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>>
>>         /*
>> +        * Prepare the non-rotated reference fb.
>> +        */
>> +       igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data-
>>fb_unrotated);
>> +       paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
>> +       igt_plane_set_fb(plane, &data->fb_unrotated);
>> +       igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> +       if (plane->type != DRM_PLANE_TYPE_CURSOR)
>> +               igt_plane_set_position(plane, data->pos_x, data->pos_y);
>> +       igt_display_commit2(display, display->is_atomic ?
>> + COMMIT_ATOMIC : COMMIT_UNIVERSAL);
>> +
>> +       /*
>>          * Prepare the plane with an non-rotated fb let the hw rotate it.
>>          */
>> +       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
>> + &data->fb);
>>         paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
>>         igt_plane_set_fb(plane, &data->fb);
>>
>> @@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
>>         igt_assert(drmHandleEvent(fd, &evctx) == 0);  }
>>
>> -static void test_plane_rotation(data_t *data, int plane_type)
>> +static void __test_plane_rotation(data_t *data, int plane_type, bool
>> +test_bad_format)
>>  {
>>         igt_display_t *display = &data->display;
>>         igt_output_t *output;
>> @@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int
>plane_type)
>>                 igt_plane_t *plane;
>>                 int i;
>>
>> +               if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
>> +                       continue;
>
>This check here must be removed.
OK.
>> +
>>                 igt_output_set_pipe(output, pipe);
>>
>>                 plane = igt_output_get_plane_type(output, plane_type);
>> @@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int
>plane_type)
>>                         igt_debug("Testing case %i on pipe %s\n", i,
>kmstest_pipe_name(pipe));
>>                         prepare_fbs(data, output, plane, i);
>>
>> -                       igt_display_commit2(display, commit);
>> -
>>                         igt_plane_set_rotation(plane, data->rotation);
>> -                       if (data->rotation == IGT_ROTATION_90 || data->rotation ==
>IGT_ROTATION_270)
>> +                       if (data->rotation & (IGT_ROTATION_90 |
>> + IGT_ROTATION_270))
>>                                 igt_plane_set_size(plane,
>> data->fb.height, data->fb.width);
>>
>>                         ret = igt_display_try_commit2(display, commit);
>> -                       if (data->override_fmt || data->override_tiling) {
>> +                       if (test_bad_format && (data->override_fmt ||
>> + data->override_tiling)) {
>>                                 igt_assert_eq(ret, -EINVAL);
>>                                 continue;
>>                         }
>> @@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int
>plane_type)
>>         igt_require_f(valid_tests, "no valid crtc/connector
>> combinations found\n");  }
>>
>> +static inline void test_bad_plane_rotation(data_t *data, int
>> +plane_type) {
>> +       __test_plane_rotation(data, plane_type, true); }
>> +
>> +static inline void test_plane_rotation(data_t *data, int plane_type)
>> +{
>> +       __test_plane_rotation(data, plane_type, false); }
>> +
>>  static void test_plane_rotation_ytiled_obj(data_t *data,
>>                                            igt_output_t *output,
>>                                            int plane_type) @@ -613,6
>> +670,8 @@ static const char *plane_test_str(unsigned plane)  static
>> const char *rot_test_str(igt_rotation_t rot)  {
>>         switch (rot) {
>> +       case IGT_ROTATION_0:
>> +               return "0";
>>         case IGT_ROTATION_90:
>>                 return "90";
>>         case IGT_ROTATION_180:
>> @@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
>>         }
>>  }
>>
>> +static const char *tiling_test_str(uint64_t tiling) {
>> +       switch (tiling) {
>> +       case LOCAL_I915_FORMAT_MOD_X_TILED:
>> +               return "x-tiled";
>> +       case LOCAL_I915_FORMAT_MOD_Y_TILED:
>> +               return "y-tiled";
>> +       case LOCAL_I915_FORMAT_MOD_Yf_TILED:
>> +               return "yf-tiled";
>> +       default:
>> +               igt_assert(0);
>> +       }
>> +}
>> +
>>  static const char *flip_test_str(unsigned flips)  {
>>         if (flips)
>> @@ -637,7 +710,7 @@ igt_main
>>         struct rot_subtest {
>>                 unsigned plane;
>>                 igt_rotation_t rot;
>> -               unsigned flips;
>> +               bool flips;
>>         } *subtest, subtests[] = {
>>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
>>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 }, @@
>> -654,6 +727,35 @@ igt_main
>>                 { DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
>>                 { 0, 0, 0}
>>         };
>> +
>> +       struct reflect_x {
>> +               uint64_t tiling;
>> +               igt_rotation_t rot;
>> +               bool flips;
>> +       } *reflect_x, reflect_x_subtests[] = {
>> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
>> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
>> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
>> +               { 0, 0, 0 }
>> +       };
>> +
>>         data_t data = {};
>>         int gen = 0;
>>
>> @@ -661,7 +763,8 @@ igt_main
>>
>>         igt_fixture {
>>                 data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
>> -               gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
>> +               data.devid = intel_get_drm_devid(data.gfx_fd);
>> +               gen = intel_gen(data.devid);
>>
>>                 kmstest_set_vt_graphics_mode();
>>
>> @@ -698,7 +801,7 @@ igt_main
>>                 data.pos_y = 0;
>>                 data.rotation = IGT_ROTATION_90;
>>                 data.override_fmt = DRM_FORMAT_RGB565;
>> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> +               test_bad_plane_rotation(&data,
>> + DRM_PLANE_TYPE_PRIMARY);
>>         }
>>
>>         igt_subtest_f("bad-tiling") {
>> @@ -706,7 +809,7 @@ igt_main
>>                 data.override_fmt = 0;
>>                 data.rotation = IGT_ROTATION_90;
>>                 data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
>> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> +               test_bad_plane_rotation(&data,
>> + DRM_PLANE_TYPE_PRIMARY);
>>         }
>>
>>         igt_subtest_f("primary-rotation-90-Y-tiled") { @@ -729,6
>> +832,21 @@ igt_main
>>                 igt_require_f(valid_tests, "no valid crtc/connector combinations
>found\n");
>>         }
>>
>> +       for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
>> +               igt_subtest_f("primary-%s-reflect-x-%s%s",
>> +                             tiling_test_str(reflect_x->tiling),
>> +                             rot_test_str(reflect_x->rot),
>> +                             flip_test_str(reflect_x->flips)) {
>> +                       igt_require(gen >= 10 ||
>> +                                   (IS_CHERRYVIEW(data.devid) && reflect_x->rot ==
>IGT_ROTATION_0
>> +                                    && reflect_x->tiling ==
>> + LOCAL_I915_FORMAT_MOD_X_TILED));
>
>This check here also must be removed and instead we need to check whether the
>rotation property supports the combination of rotation/flipping that we want to
>test.
>
>Anusha, can you pls follow up with this?
>
>Cc'ing Luis too to keep track of this.
Sure Daniel, Thanks a lot for your feedback.
Will roll up a new version of this.

Anusha 
>Thanks, Daniel
>
>> +                       data.rotation = (IGT_REFLECT_X | reflect_x->rot);
>> +                       data.override_tiling = reflect_x->tiling;
>> +                       data.flips = reflect_x->flips;
>> +                       test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> +               }
>> +       }
>> +
>>         igt_subtest_f("exhaust-fences") {
>>                 enum pipe pipe;
>>                 igt_output_t *output;
>> --
>> 2.7.4
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
>
>--
>Daniel Vetter
>Software Engineer, Intel Corporation
>+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-12-14 10:14 ` Daniel Vetter
@ 2017-12-19  0:00   ` Rodrigo Vivi
  2017-12-19  0:20   ` Srivatsa, Anusha
  1 sibling, 0 replies; 15+ messages in thread
From: Rodrigo Vivi @ 2017-12-19  0:00 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Joseph Garvey, intel-gfx, Strano, Luis

On Thu, Dec 14, 2017 at 10:14:19AM +0000, Daniel Vetter wrote:
> On Thu, Nov 23, 2017 at 12:05 AM, Anusha Srivatsa
> <anusha.srivatsa@intel.com> wrote:
> > From: Joseph Garvey <joseph1.garvey@intel.com>
> >
> > Test that horizontal flip works with supported rotations. Includes
> > a fix for the unrotated fb which was not being positioned correctly
> > with portrait and landscape rectangles.
> >
> > v2:(from Anusha)
> > - Change 180 degree rotation to follow the rest, use
> > igt_swap(), make flip variable a bool. Format the
> > patch correctly (Ville, Petri Latvala)
> >
> > v3: (From Anusha)
> > - Correct the name of subtests in order to avoid duplication
> > of names (Arek)
> >
> > Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> > Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Petri Latvala <petri.latvala@intel.com>
> > Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> 
> I didn't see this patch fly by originally, but now Marta pointed out
> that this skips everywhere. We need to rework it.
> 
> General principle is that in kms tests we should _not_ have any
> platform/feature checks encoded in the test. Instead, the testcase
> should check properties to figure out whether something should work or
> not.

I fully agree.

But oops... I just merged the cnl patch while I had swear that I'd just merge
when the test case was done. :/

> 
> 
> > ---
> >  lib/igt_kms.c            |   2 +-
> >  lib/igt_kms.h            |   5 ++
> >  tests/kms_rotation_crc.c | 198 +++++++++++++++++++++++++++++++++++++----------
> >  3 files changed, 164 insertions(+), 41 deletions(-)
> >
> > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > index a572fc6..3034e44 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
> >
> >  static const char *rotation_name(igt_rotation_t rotation)
> >  {
> > -       switch (rotation) {
> > +       switch (rotation & IGT_ROTATION_MASK) {
> >         case IGT_ROTATION_0:
> >                 return "0°";
> >         case IGT_ROTATION_90:
> > diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> > index 8dc118c..b83a828 100644
> > --- a/lib/igt_kms.h
> > +++ b/lib/igt_kms.h
> > @@ -281,8 +281,13 @@ typedef enum {
> >         IGT_ROTATION_90  = 1 << 1,
> >         IGT_ROTATION_180 = 1 << 2,
> >         IGT_ROTATION_270 = 1 << 3,
> > +       IGT_REFLECT_X    = 1 << 4,
> > +       IGT_REFLECT_Y    = 1 << 5,
> >  } igt_rotation_t;
> >
> > +#define IGT_ROTATION_MASK \
> > +       (IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
> > +
> >  typedef struct {
> >         /*< private >*/
> >         igt_pipe_t *pipe;
> > diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> > index 5aec8fa..9e13667 100644
> > --- a/tests/kms_rotation_crc.c
> > +++ b/tests/kms_rotation_crc.c
> > @@ -32,6 +32,7 @@ typedef struct {
> >         igt_display_t display;
> >         struct igt_fb fb;
> >         struct igt_fb fb_reference;
> > +       struct igt_fb fb_unrotated;
> >         struct igt_fb fb_modeset;
> >         struct igt_fb fb_flip;
> >         igt_crc_t ref_crc;
> > @@ -43,8 +44,59 @@ typedef struct {
> >         uint32_t override_fmt;
> >         uint64_t override_tiling;
> >         bool flips;
> > +       int devid;
> >  } data_t;
> >
> > +typedef struct {
> > +       float r;
> > +       float g;
> > +       float b;
> > +} rgb_color_t;
> > +
> > +static void set_color(rgb_color_t *color, float r, float g, float b)
> > +{
> > +       color->r = r;
> > +       color->g = g;
> > +       color->b = b;
> > +}
> > +
> > +static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
> > +                         rgb_color_t *bl, igt_rotation_t rotation)
> > +{
> > +       rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
> > +
> > +       if (rotation & IGT_REFLECT_X) {
> > +               igt_swap(*tl, *tr);
> > +               igt_swap(*bl, *br);
> > +       }
> > +
> > +       if (rotation & IGT_ROTATION_90) {
> > +               bl_tmp = *bl;
> > +               br_tmp = *br;
> > +               tl_tmp = *tl;
> > +               tr_tmp = *tr;
> > +               *tl = tr_tmp;
> > +               *bl = tl_tmp;
> > +               *tr = br_tmp;
> > +               *br = bl_tmp;
> > +       } else if (rotation & IGT_ROTATION_180) {
> > +               igt_swap(*tl, *br);
> > +               igt_swap(*tr, *bl);
> > +       } else if (rotation & IGT_ROTATION_270) {
> > +               bl_tmp = *bl;
> > +               br_tmp = *br;
> > +               tl_tmp = *tl;
> > +               tr_tmp = *tr;
> > +               *tl = bl_tmp;
> > +               *bl = br_tmp;
> > +               *tr = tl_tmp;
> > +               *br = tr_tmp;
> > +       }
> > +}
> > +
> > +#define RGB_COLOR(color) \
> > +       color.r, color.g, color.b
> > +
> >  static void
> >  paint_squares(data_t *data, igt_rotation_t rotation,
> >               struct igt_fb *fb, float o)
> > @@ -52,35 +104,21 @@ paint_squares(data_t *data, igt_rotation_t rotation,
> >         cairo_t *cr;
> >         unsigned int w = fb->width;
> >         unsigned int h = fb->height;
> > +       rgb_color_t tl, tr, bl, br;
> >
> >         cr = igt_get_cairo_ctx(data->gfx_fd, fb);
> >
> > -       if (rotation == IGT_ROTATION_180) {
> > -               cairo_translate(cr, w, h);
> > -               cairo_rotate(cr, M_PI);
> > -       }
> > +       set_color(&tl, o, 0.0f, 0.0f);
> > +       set_color(&tr, 0.0f, o, 0.0f);
> > +       set_color(&br, o, o, o);
> > +       set_color(&bl, 0.0f, 0.0f, o);
> >
> > -       if (rotation == IGT_ROTATION_90) {
> > -               /* Paint 4 squares with width == height in Green, White,
> > -               Blue, Red Clockwise order to look like 270 degree rotated*/
> > -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
> > -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
> > -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
> > -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> > -       } else if (rotation == IGT_ROTATION_270) {
> > -               /* Paint 4 squares with width == height in Blue, Red,
> > -               Green, White Clockwise order to look like 90 degree rotated*/
> > -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
> > -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
> > -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
> > -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
> > -       } else {
> > -               /* Paint with 4 squares of Red, Green, White, Blue Clockwise */
> > -               igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
> > -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
> > -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> > -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
> > -       }
> > +       rotate_colors(&tl, &tr, &br, &bl, rotation);
> > +
> > +       igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
> > +       igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
> > +       igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
> > +       igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, RGB_COLOR(br));
> >
> >         cairo_destroy(cr);
> >  }
> > @@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
> >
> >         igt_remove_fb(data->gfx_fd, &data->fb);
> >         igt_remove_fb(data->gfx_fd, &data->fb_reference);
> > +       igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
> >
> >         if (data->fb_flip.fb_id)
> >                 igt_remove_fb(data->gfx_fd, &data->fb_flip);
> > @@ -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
> >          * For 90/270, we will use create smaller fb so that the rotated
> >          * frame can fit in
> >          */
> > -       if (data->rotation == IGT_ROTATION_90 ||
> > -           data->rotation == IGT_ROTATION_270) {
> > +       if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
> >                 tiling = data->override_tiling ?: LOCAL_I915_FORMAT_MOD_Y_TILED;
> >
> >                 igt_swap(w, h);
> >         }
> >
> > -       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
> > -
> > -       igt_plane_set_rotation(plane, IGT_ROTATION_0);
> > -
> >         /*
> >          * Create a reference software rotated flip framebuffer.
> >          */
> > @@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
> >         igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
> >
> >         /*
> > +        * Prepare the non-rotated reference fb.
> > +        */
> > +       igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data->fb_unrotated);
> > +       paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
> > +       igt_plane_set_fb(plane, &data->fb_unrotated);
> > +       igt_plane_set_rotation(plane, IGT_ROTATION_0);
> > +       if (plane->type != DRM_PLANE_TYPE_CURSOR)
> > +               igt_plane_set_position(plane, data->pos_x, data->pos_y);
> > +       igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> > +
> > +       /*
> >          * Prepare the plane with an non-rotated fb let the hw rotate it.
> >          */
> > +       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
> >         paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
> >         igt_plane_set_fb(plane, &data->fb);
> >
> > @@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
> >         igt_assert(drmHandleEvent(fd, &evctx) == 0);
> >  }
> >
> > -static void test_plane_rotation(data_t *data, int plane_type)
> > +static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
> >  {
> >         igt_display_t *display = &data->display;
> >         igt_output_t *output;
> > @@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int plane_type)
> >                 igt_plane_t *plane;
> >                 int i;
> >
> > +               if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
> > +                       continue;
> 
> This check here must be removed.
> 
> > +
> >                 igt_output_set_pipe(output, pipe);
> >
> >                 plane = igt_output_get_plane_type(output, plane_type);
> > @@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int plane_type)
> >                         igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
> >                         prepare_fbs(data, output, plane, i);
> >
> > -                       igt_display_commit2(display, commit);
> > -
> >                         igt_plane_set_rotation(plane, data->rotation);
> > -                       if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
> > +                       if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
> >                                 igt_plane_set_size(plane, data->fb.height, data->fb.width);
> >
> >                         ret = igt_display_try_commit2(display, commit);
> > -                       if (data->override_fmt || data->override_tiling) {
> > +                       if (test_bad_format && (data->override_fmt || data->override_tiling)) {
> >                                 igt_assert_eq(ret, -EINVAL);
> >                                 continue;
> >                         }
> > @@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int plane_type)
> >         igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
> >  }
> >
> > +static inline void test_bad_plane_rotation(data_t *data, int plane_type)
> > +{
> > +       __test_plane_rotation(data, plane_type, true);
> > +}
> > +
> > +static inline void test_plane_rotation(data_t *data, int plane_type)
> > +{
> > +       __test_plane_rotation(data, plane_type, false);
> > +}
> > +
> >  static void test_plane_rotation_ytiled_obj(data_t *data,
> >                                            igt_output_t *output,
> >                                            int plane_type)
> > @@ -613,6 +670,8 @@ static const char *plane_test_str(unsigned plane)
> >  static const char *rot_test_str(igt_rotation_t rot)
> >  {
> >         switch (rot) {
> > +       case IGT_ROTATION_0:
> > +               return "0";
> >         case IGT_ROTATION_90:
> >                 return "90";
> >         case IGT_ROTATION_180:
> > @@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
> >         }
> >  }
> >
> > +static const char *tiling_test_str(uint64_t tiling)
> > +{
> > +       switch (tiling) {
> > +       case LOCAL_I915_FORMAT_MOD_X_TILED:
> > +               return "x-tiled";
> > +       case LOCAL_I915_FORMAT_MOD_Y_TILED:
> > +               return "y-tiled";
> > +       case LOCAL_I915_FORMAT_MOD_Yf_TILED:
> > +               return "yf-tiled";
> > +       default:
> > +               igt_assert(0);
> > +       }
> > +}
> > +
> >  static const char *flip_test_str(unsigned flips)
> >  {
> >         if (flips)
> > @@ -637,7 +710,7 @@ igt_main
> >         struct rot_subtest {
> >                 unsigned plane;
> >                 igt_rotation_t rot;
> > -               unsigned flips;
> > +               bool flips;
> >         } *subtest, subtests[] = {
> >                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
> >                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
> > @@ -654,6 +727,35 @@ igt_main
> >                 { DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
> >                 { 0, 0, 0}
> >         };
> > +
> > +       struct reflect_x {
> > +               uint64_t tiling;
> > +               igt_rotation_t rot;
> > +               bool flips;
> > +       } *reflect_x, reflect_x_subtests[] = {
> > +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
> > +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
> > +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
> > +               { 0, 0, 0 }
> > +       };
> > +
> >         data_t data = {};
> >         int gen = 0;
> >
> > @@ -661,7 +763,8 @@ igt_main
> >
> >         igt_fixture {
> >                 data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
> > -               gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
> > +               data.devid = intel_get_drm_devid(data.gfx_fd);
> > +               gen = intel_gen(data.devid);
> >
> >                 kmstest_set_vt_graphics_mode();
> >
> > @@ -698,7 +801,7 @@ igt_main
> >                 data.pos_y = 0;
> >                 data.rotation = IGT_ROTATION_90;
> >                 data.override_fmt = DRM_FORMAT_RGB565;
> > -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> > +               test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> >         }
> >
> >         igt_subtest_f("bad-tiling") {
> > @@ -706,7 +809,7 @@ igt_main
> >                 data.override_fmt = 0;
> >                 data.rotation = IGT_ROTATION_90;
> >                 data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> > -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> > +               test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> >         }
> >
> >         igt_subtest_f("primary-rotation-90-Y-tiled") {
> > @@ -729,6 +832,21 @@ igt_main
> >                 igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
> >         }
> >
> > +       for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
> > +               igt_subtest_f("primary-%s-reflect-x-%s%s",
> > +                             tiling_test_str(reflect_x->tiling),
> > +                             rot_test_str(reflect_x->rot),
> > +                             flip_test_str(reflect_x->flips)) {
> > +                       igt_require(gen >= 10 ||
> > +                                   (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
> > +                                    && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));
> 
> This check here also must be removed and instead we need to check
> whether the rotation property supports the combination of
> rotation/flipping that we want to test.
> 
> Anusha, can you pls follow up with this?
> 
> Cc'ing Luis too to keep track of this.
> 
> Thanks, Daniel
> 
> > +                       data.rotation = (IGT_REFLECT_X | reflect_x->rot);
> > +                       data.override_tiling = reflect_x->tiling;
> > +                       data.flips = reflect_x->flips;
> > +                       test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> > +               }
> > +       }
> > +
> >         igt_subtest_f("exhaust-fences") {
> >                 enum pipe pipe;
> >                 igt_output_t *output;
> > --
> > 2.7.4
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-11-22 23:05 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
  2017-11-29  9:55 ` Petri Latvala
  2017-12-12  9:53 ` Petri Latvala
@ 2017-12-14 10:14 ` Daniel Vetter
  2017-12-19  0:00   ` Rodrigo Vivi
  2017-12-19  0:20   ` Srivatsa, Anusha
  2 siblings, 2 replies; 15+ messages in thread
From: Daniel Vetter @ 2017-12-14 10:14 UTC (permalink / raw)
  To: Anusha Srivatsa, Strano, Luis, Petri Latvala, Marta Lofstedt,
	Saarinen, Jani
  Cc: intel-gfx, Joseph Garvey

On Thu, Nov 23, 2017 at 12:05 AM, Anusha Srivatsa
<anusha.srivatsa@intel.com> wrote:
> From: Joseph Garvey <joseph1.garvey@intel.com>
>
> Test that horizontal flip works with supported rotations. Includes
> a fix for the unrotated fb which was not being positioned correctly
> with portrait and landscape rectangles.
>
> v2:(from Anusha)
> - Change 180 degree rotation to follow the rest, use
> igt_swap(), make flip variable a bool. Format the
> patch correctly (Ville, Petri Latvala)
>
> v3: (From Anusha)
> - Correct the name of subtests in order to avoid duplication
> of names (Arek)
>
> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

I didn't see this patch fly by originally, but now Marta pointed out
that this skips everywhere. We need to rework it.

General principle is that in kms tests we should _not_ have any
platform/feature checks encoded in the test. Instead, the testcase
should check properties to figure out whether something should work or
not.


> ---
>  lib/igt_kms.c            |   2 +-
>  lib/igt_kms.h            |   5 ++
>  tests/kms_rotation_crc.c | 198 +++++++++++++++++++++++++++++++++++++----------
>  3 files changed, 164 insertions(+), 41 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index a572fc6..3034e44 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
>
>  static const char *rotation_name(igt_rotation_t rotation)
>  {
> -       switch (rotation) {
> +       switch (rotation & IGT_ROTATION_MASK) {
>         case IGT_ROTATION_0:
>                 return "0°";
>         case IGT_ROTATION_90:
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 8dc118c..b83a828 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -281,8 +281,13 @@ typedef enum {
>         IGT_ROTATION_90  = 1 << 1,
>         IGT_ROTATION_180 = 1 << 2,
>         IGT_ROTATION_270 = 1 << 3,
> +       IGT_REFLECT_X    = 1 << 4,
> +       IGT_REFLECT_Y    = 1 << 5,
>  } igt_rotation_t;
>
> +#define IGT_ROTATION_MASK \
> +       (IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
> +
>  typedef struct {
>         /*< private >*/
>         igt_pipe_t *pipe;
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 5aec8fa..9e13667 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -32,6 +32,7 @@ typedef struct {
>         igt_display_t display;
>         struct igt_fb fb;
>         struct igt_fb fb_reference;
> +       struct igt_fb fb_unrotated;
>         struct igt_fb fb_modeset;
>         struct igt_fb fb_flip;
>         igt_crc_t ref_crc;
> @@ -43,8 +44,59 @@ typedef struct {
>         uint32_t override_fmt;
>         uint64_t override_tiling;
>         bool flips;
> +       int devid;
>  } data_t;
>
> +typedef struct {
> +       float r;
> +       float g;
> +       float b;
> +} rgb_color_t;
> +
> +static void set_color(rgb_color_t *color, float r, float g, float b)
> +{
> +       color->r = r;
> +       color->g = g;
> +       color->b = b;
> +}
> +
> +static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
> +                         rgb_color_t *bl, igt_rotation_t rotation)
> +{
> +       rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
> +
> +       if (rotation & IGT_REFLECT_X) {
> +               igt_swap(*tl, *tr);
> +               igt_swap(*bl, *br);
> +       }
> +
> +       if (rotation & IGT_ROTATION_90) {
> +               bl_tmp = *bl;
> +               br_tmp = *br;
> +               tl_tmp = *tl;
> +               tr_tmp = *tr;
> +               *tl = tr_tmp;
> +               *bl = tl_tmp;
> +               *tr = br_tmp;
> +               *br = bl_tmp;
> +       } else if (rotation & IGT_ROTATION_180) {
> +               igt_swap(*tl, *br);
> +               igt_swap(*tr, *bl);
> +       } else if (rotation & IGT_ROTATION_270) {
> +               bl_tmp = *bl;
> +               br_tmp = *br;
> +               tl_tmp = *tl;
> +               tr_tmp = *tr;
> +               *tl = bl_tmp;
> +               *bl = br_tmp;
> +               *tr = tl_tmp;
> +               *br = tr_tmp;
> +       }
> +}
> +
> +#define RGB_COLOR(color) \
> +       color.r, color.g, color.b
> +
>  static void
>  paint_squares(data_t *data, igt_rotation_t rotation,
>               struct igt_fb *fb, float o)
> @@ -52,35 +104,21 @@ paint_squares(data_t *data, igt_rotation_t rotation,
>         cairo_t *cr;
>         unsigned int w = fb->width;
>         unsigned int h = fb->height;
> +       rgb_color_t tl, tr, bl, br;
>
>         cr = igt_get_cairo_ctx(data->gfx_fd, fb);
>
> -       if (rotation == IGT_ROTATION_180) {
> -               cairo_translate(cr, w, h);
> -               cairo_rotate(cr, M_PI);
> -       }
> +       set_color(&tl, o, 0.0f, 0.0f);
> +       set_color(&tr, 0.0f, o, 0.0f);
> +       set_color(&br, o, o, o);
> +       set_color(&bl, 0.0f, 0.0f, o);
>
> -       if (rotation == IGT_ROTATION_90) {
> -               /* Paint 4 squares with width == height in Green, White,
> -               Blue, Red Clockwise order to look like 270 degree rotated*/
> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> -       } else if (rotation == IGT_ROTATION_270) {
> -               /* Paint 4 squares with width == height in Blue, Red,
> -               Green, White Clockwise order to look like 90 degree rotated*/
> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
> -       } else {
> -               /* Paint with 4 squares of Red, Green, White, Blue Clockwise */
> -               igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
> -               igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
> -               igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> -               igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
> -       }
> +       rotate_colors(&tl, &tr, &br, &bl, rotation);
> +
> +       igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
> +       igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
> +       igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
> +       igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, RGB_COLOR(br));
>
>         cairo_destroy(cr);
>  }
> @@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
>
>         igt_remove_fb(data->gfx_fd, &data->fb);
>         igt_remove_fb(data->gfx_fd, &data->fb_reference);
> +       igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
>
>         if (data->fb_flip.fb_id)
>                 igt_remove_fb(data->gfx_fd, &data->fb_flip);
> @@ -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
>          * For 90/270, we will use create smaller fb so that the rotated
>          * frame can fit in
>          */
> -       if (data->rotation == IGT_ROTATION_90 ||
> -           data->rotation == IGT_ROTATION_270) {
> +       if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
>                 tiling = data->override_tiling ?: LOCAL_I915_FORMAT_MOD_Y_TILED;
>
>                 igt_swap(w, h);
>         }
>
> -       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
> -
> -       igt_plane_set_rotation(plane, IGT_ROTATION_0);
> -
>         /*
>          * Create a reference software rotated flip framebuffer.
>          */
> @@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
>         igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>
>         /*
> +        * Prepare the non-rotated reference fb.
> +        */
> +       igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data->fb_unrotated);
> +       paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
> +       igt_plane_set_fb(plane, &data->fb_unrotated);
> +       igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +       if (plane->type != DRM_PLANE_TYPE_CURSOR)
> +               igt_plane_set_position(plane, data->pos_x, data->pos_y);
> +       igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> +
> +       /*
>          * Prepare the plane with an non-rotated fb let the hw rotate it.
>          */
> +       igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
>         paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
>         igt_plane_set_fb(plane, &data->fb);
>
> @@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
>         igt_assert(drmHandleEvent(fd, &evctx) == 0);
>  }
>
> -static void test_plane_rotation(data_t *data, int plane_type)
> +static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
>  {
>         igt_display_t *display = &data->display;
>         igt_output_t *output;
> @@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int plane_type)
>                 igt_plane_t *plane;
>                 int i;
>
> +               if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
> +                       continue;

This check here must be removed.

> +
>                 igt_output_set_pipe(output, pipe);
>
>                 plane = igt_output_get_plane_type(output, plane_type);
> @@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int plane_type)
>                         igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
>                         prepare_fbs(data, output, plane, i);
>
> -                       igt_display_commit2(display, commit);
> -
>                         igt_plane_set_rotation(plane, data->rotation);
> -                       if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
> +                       if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
>                                 igt_plane_set_size(plane, data->fb.height, data->fb.width);
>
>                         ret = igt_display_try_commit2(display, commit);
> -                       if (data->override_fmt || data->override_tiling) {
> +                       if (test_bad_format && (data->override_fmt || data->override_tiling)) {
>                                 igt_assert_eq(ret, -EINVAL);
>                                 continue;
>                         }
> @@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int plane_type)
>         igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
>  }
>
> +static inline void test_bad_plane_rotation(data_t *data, int plane_type)
> +{
> +       __test_plane_rotation(data, plane_type, true);
> +}
> +
> +static inline void test_plane_rotation(data_t *data, int plane_type)
> +{
> +       __test_plane_rotation(data, plane_type, false);
> +}
> +
>  static void test_plane_rotation_ytiled_obj(data_t *data,
>                                            igt_output_t *output,
>                                            int plane_type)
> @@ -613,6 +670,8 @@ static const char *plane_test_str(unsigned plane)
>  static const char *rot_test_str(igt_rotation_t rot)
>  {
>         switch (rot) {
> +       case IGT_ROTATION_0:
> +               return "0";
>         case IGT_ROTATION_90:
>                 return "90";
>         case IGT_ROTATION_180:
> @@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
>         }
>  }
>
> +static const char *tiling_test_str(uint64_t tiling)
> +{
> +       switch (tiling) {
> +       case LOCAL_I915_FORMAT_MOD_X_TILED:
> +               return "x-tiled";
> +       case LOCAL_I915_FORMAT_MOD_Y_TILED:
> +               return "y-tiled";
> +       case LOCAL_I915_FORMAT_MOD_Yf_TILED:
> +               return "yf-tiled";
> +       default:
> +               igt_assert(0);
> +       }
> +}
> +
>  static const char *flip_test_str(unsigned flips)
>  {
>         if (flips)
> @@ -637,7 +710,7 @@ igt_main
>         struct rot_subtest {
>                 unsigned plane;
>                 igt_rotation_t rot;
> -               unsigned flips;
> +               bool flips;
>         } *subtest, subtests[] = {
>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
>                 { DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
> @@ -654,6 +727,35 @@ igt_main
>                 { DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
>                 { 0, 0, 0}
>         };
> +
> +       struct reflect_x {
> +               uint64_t tiling;
> +               igt_rotation_t rot;
> +               bool flips;
> +       } *reflect_x, reflect_x_subtests[] = {
> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
> +               { LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
> +               { LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
> +               { 0, 0, 0 }
> +       };
> +
>         data_t data = {};
>         int gen = 0;
>
> @@ -661,7 +763,8 @@ igt_main
>
>         igt_fixture {
>                 data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
> -               gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
> +               data.devid = intel_get_drm_devid(data.gfx_fd);
> +               gen = intel_gen(data.devid);
>
>                 kmstest_set_vt_graphics_mode();
>
> @@ -698,7 +801,7 @@ igt_main
>                 data.pos_y = 0;
>                 data.rotation = IGT_ROTATION_90;
>                 data.override_fmt = DRM_FORMAT_RGB565;
> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> +               test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>         }
>
>         igt_subtest_f("bad-tiling") {
> @@ -706,7 +809,7 @@ igt_main
>                 data.override_fmt = 0;
>                 data.rotation = IGT_ROTATION_90;
>                 data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> -               test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> +               test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>         }
>
>         igt_subtest_f("primary-rotation-90-Y-tiled") {
> @@ -729,6 +832,21 @@ igt_main
>                 igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
>         }
>
> +       for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
> +               igt_subtest_f("primary-%s-reflect-x-%s%s",
> +                             tiling_test_str(reflect_x->tiling),
> +                             rot_test_str(reflect_x->rot),
> +                             flip_test_str(reflect_x->flips)) {
> +                       igt_require(gen >= 10 ||
> +                                   (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
> +                                    && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));

This check here also must be removed and instead we need to check
whether the rotation property supports the combination of
rotation/flipping that we want to test.

Anusha, can you pls follow up with this?

Cc'ing Luis too to keep track of this.

Thanks, Daniel

> +                       data.rotation = (IGT_REFLECT_X | reflect_x->rot);
> +                       data.override_tiling = reflect_x->tiling;
> +                       data.flips = reflect_x->flips;
> +                       test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> +               }
> +       }
> +
>         igt_subtest_f("exhaust-fences") {
>                 enum pipe pipe;
>                 igt_output_t *output;
> --
> 2.7.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-11-22 23:05 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
  2017-11-29  9:55 ` Petri Latvala
@ 2017-12-12  9:53 ` Petri Latvala
  2017-12-14 10:14 ` Daniel Vetter
  2 siblings, 0 replies; 15+ messages in thread
From: Petri Latvala @ 2017-12-12  9:53 UTC (permalink / raw)
  To: Anusha Srivatsa; +Cc: intel-gfx, Joseph Garvey

On Wed, Nov 22, 2017 at 03:05:55PM -0800, Anusha Srivatsa wrote:
> From: Joseph Garvey <joseph1.garvey@intel.com>
> 
> Test that horizontal flip works with supported rotations. Includes
> a fix for the unrotated fb which was not being positioned correctly
> with portrait and landscape rectangles.
> 
> v2:(from Anusha)
> - Change 180 degree rotation to follow the rest, use
> igt_swap(), make flip variable a bool. Format the
> patch correctly (Ville, Petri Latvala)
> 
> v3: (From Anusha)
> - Correct the name of subtests in order to avoid duplication
> of names (Arek)
> 
> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>


Reviewed-by: Petri Latvala <petri.latvala@intel.com>

And merged, thanks.


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

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-11-29  9:55 ` Petri Latvala
@ 2017-11-29 19:26   ` Srivatsa, Anusha
  0 siblings, 0 replies; 15+ messages in thread
From: Srivatsa, Anusha @ 2017-11-29 19:26 UTC (permalink / raw)
  To: Latvala, Petri; +Cc: intel-gfx, Joseph Garvey



>-----Original Message-----
>From: Latvala, Petri
>Sent: Wednesday, November 29, 2017 1:55 AM
>To: Srivatsa, Anusha <anusha.srivatsa@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; Joseph Garvey <joseph1.garvey@intel.com>;
>Ville Syrjälä <ville.syrjala@linux.intel.com>; Hiler, Arkadiusz
><arkadiusz.hiler@intel.com>
>Subject: Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
>
>On Wed, Nov 22, 2017 at 03:05:55PM -0800, Anusha Srivatsa wrote:
>> From: Joseph Garvey <joseph1.garvey@intel.com>
>>
>> Test that horizontal flip works with supported rotations. Includes a
>> fix for the unrotated fb which was not being positioned correctly with
>> portrait and landscape rectangles.
>>
>> v2:(from Anusha)
>> - Change 180 degree rotation to follow the rest, use igt_swap(), make
>> flip variable a bool. Format the patch correctly (Ville, Petri
>> Latvala)
>>
>> v3: (From Anusha)
>> - Correct the name of subtests in order to avoid duplication of names
>> (Arek)
>>
>> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
>> Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Cc: Petri Latvala <petri.latvala@intel.com>
>> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
>> ---
>>  lib/igt_kms.c            |   2 +-
>>  lib/igt_kms.h            |   5 ++
>>  tests/kms_rotation_crc.c | 198
>> +++++++++++++++++++++++++++++++++++++----------
>>  3 files changed, 164 insertions(+), 41 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c index a572fc6..3034e44
>> 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb,
>> igt_plane_t *plane,
>>
>>  static const char *rotation_name(igt_rotation_t rotation)  {
>> -	switch (rotation) {
>> +	switch (rotation & IGT_ROTATION_MASK) {
>>  	case IGT_ROTATION_0:
>>  		return "0°";
>>  	case IGT_ROTATION_90:
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 8dc118c..b83a828
>> 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -281,8 +281,13 @@ typedef enum {
>>  	IGT_ROTATION_90  = 1 << 1,
>>  	IGT_ROTATION_180 = 1 << 2,
>>  	IGT_ROTATION_270 = 1 << 3,
>> +	IGT_REFLECT_X    = 1 << 4,
>> +	IGT_REFLECT_Y    = 1 << 5,
>>  } igt_rotation_t;
>>
>> +#define IGT_ROTATION_MASK \
>> +	(IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 |
>> +IGT_ROTATION_270)
>> +
>>  typedef struct {
>>  	/*< private >*/
>>  	igt_pipe_t *pipe;
>> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index
>> 5aec8fa..9e13667 100644
>> --- a/tests/kms_rotation_crc.c
>> +++ b/tests/kms_rotation_crc.c
>> @@ -32,6 +32,7 @@ typedef struct {
>>  	igt_display_t display;
>>  	struct igt_fb fb;
>>  	struct igt_fb fb_reference;
>> +	struct igt_fb fb_unrotated;
>>  	struct igt_fb fb_modeset;
>>  	struct igt_fb fb_flip;
>>  	igt_crc_t ref_crc;
>> @@ -43,8 +44,59 @@ typedef struct {
>>  	uint32_t override_fmt;
>>  	uint64_t override_tiling;
>>  	bool flips;
>> +	int devid;
>>  } data_t;
>>
>> +typedef struct {
>> +	float r;
>> +	float g;
>> +	float b;
>> +} rgb_color_t;
>> +
>> +static void set_color(rgb_color_t *color, float r, float g, float b)
>> +{
>> +	color->r = r;
>> +	color->g = g;
>> +	color->b = b;
>> +}
>> +
>> +static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
>> +			  rgb_color_t *bl, igt_rotation_t rotation) {
>> +	rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
>> +
>> +	if (rotation & IGT_REFLECT_X) {
>> +		igt_swap(*tl, *tr);
>> +		igt_swap(*bl, *br);
>> +	}
>> +
>> +	if (rotation & IGT_ROTATION_90) {
>> +		bl_tmp = *bl;
>> +		br_tmp = *br;
>> +		tl_tmp = *tl;
>> +		tr_tmp = *tr;
>> +		*tl = tr_tmp;
>> +		*bl = tl_tmp;
>> +		*tr = br_tmp;
>> +		*br = bl_tmp;
>> +	} else if (rotation & IGT_ROTATION_180) {
>> +		igt_swap(*tl, *br);
>> +		igt_swap(*tr, *bl);
>> +	} else if (rotation & IGT_ROTATION_270) {
>> +		bl_tmp = *bl;
>> +		br_tmp = *br;
>> +		tl_tmp = *tl;
>> +		tr_tmp = *tr;
>> +		*tl = bl_tmp;
>> +		*bl = br_tmp;
>> +		*tr = tl_tmp;
>> +		*br = tr_tmp;
>> +	}
>> +}
>> +
>> +#define RGB_COLOR(color) \
>> +	color.r, color.g, color.b
>> +
>>  static void
>>  paint_squares(data_t *data, igt_rotation_t rotation,
>>  	      struct igt_fb *fb, float o)
>> @@ -52,35 +104,21 @@ paint_squares(data_t *data, igt_rotation_t rotation,
>>  	cairo_t *cr;
>>  	unsigned int w = fb->width;
>>  	unsigned int h = fb->height;
>> +	rgb_color_t tl, tr, bl, br;
>>
>>  	cr = igt_get_cairo_ctx(data->gfx_fd, fb);
>>
>> -	if (rotation == IGT_ROTATION_180) {
>> -		cairo_translate(cr, w, h);
>> -		cairo_rotate(cr, M_PI);
>> -	}
>> +	set_color(&tl, o, 0.0f, 0.0f);
>> +	set_color(&tr, 0.0f, o, 0.0f);
>> +	set_color(&br, o, o, o);
>> +	set_color(&bl, 0.0f, 0.0f, o);
>>
>> -	if (rotation == IGT_ROTATION_90) {
>> -		/* Paint 4 squares with width == height in Green, White,
>> -		Blue, Red Clockwise order to look like 270 degree rotated*/
>> -		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
>> -		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
>> -		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
>> -		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
>> -	} else if (rotation == IGT_ROTATION_270) {
>> -		/* Paint 4 squares with width == height in Blue, Red,
>> -		Green, White Clockwise order to look like 90 degree rotated*/
>> -		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
>> -		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
>> -		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
>> -		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
>> -	} else {
>> -		/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
>> -		igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
>> -		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
>> -		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
>> -		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
>> -	}
>> +	rotate_colors(&tl, &tr, &br, &bl, rotation);
>> +
>> +	igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
>> +	igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
>> +	igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
>> +	igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, RGB_COLOR(br));
>>
>>  	cairo_destroy(cr);
>>  }
>> @@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
>>
>>  	igt_remove_fb(data->gfx_fd, &data->fb);
>>  	igt_remove_fb(data->gfx_fd, &data->fb_reference);
>> +	igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
>>
>>  	if (data->fb_flip.fb_id)
>>  		igt_remove_fb(data->gfx_fd, &data->fb_flip); @@ -212,17
>+251,12 @@
>> static void prepare_fbs(data_t *data, igt_output_t *output,
>>  	 * For 90/270, we will use create smaller fb so that the rotated
>>  	 * frame can fit in
>>  	 */
>> -	if (data->rotation == IGT_ROTATION_90 ||
>> -	    data->rotation == IGT_ROTATION_270) {
>> +	if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
>>  		tiling = data->override_tiling ?:
>LOCAL_I915_FORMAT_MOD_Y_TILED;
>>
>>  		igt_swap(w, h);
>>  	}
>>
>> -	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
>> -
>> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> -
>>  	/*
>>  	 * Create a reference software rotated flip framebuffer.
>>  	 */
>> @@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t
>*output,
>>  	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>>
>>  	/*
>> +	 * Prepare the non-rotated reference fb.
>> +	 */
>> +	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data-
>>fb_unrotated);
>> +	paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
>> +	igt_plane_set_fb(plane, &data->fb_unrotated);
>> +	igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> +	if (plane->type != DRM_PLANE_TYPE_CURSOR)
>> +		igt_plane_set_position(plane, data->pos_x, data->pos_y);
>> +	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC :
>> +COMMIT_UNIVERSAL);
>> +
>> +	/*
>>  	 * Prepare the plane with an non-rotated fb let the hw rotate it.
>>  	 */
>> +	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
>>  	paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
>>  	igt_plane_set_fb(plane, &data->fb);
>>
>> @@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
>>  	igt_assert(drmHandleEvent(fd, &evctx) == 0);  }
>>
>> -static void test_plane_rotation(data_t *data, int plane_type)
>> +static void __test_plane_rotation(data_t *data, int plane_type, bool
>> +test_bad_format)
>>  {
>>  	igt_display_t *display = &data->display;
>>  	igt_output_t *output;
>> @@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int
>plane_type)
>>  		igt_plane_t *plane;
>>  		int i;
>>
>> +		if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
>> +			continue;
>> +
>>  		igt_output_set_pipe(output, pipe);
>>
>>  		plane = igt_output_get_plane_type(output, plane_type); @@ -
>369,14
>> +418,12 @@ static void test_plane_rotation(data_t *data, int plane_type)
>>  			igt_debug("Testing case %i on pipe %s\n", i,
>kmstest_pipe_name(pipe));
>>  			prepare_fbs(data, output, plane, i);
>>
>> -			igt_display_commit2(display, commit);
>> -
>>  			igt_plane_set_rotation(plane, data->rotation);
>> -			if (data->rotation == IGT_ROTATION_90 || data-
>>rotation == IGT_ROTATION_270)
>> +			if (data->rotation & (IGT_ROTATION_90 |
>IGT_ROTATION_270))
>>  				igt_plane_set_size(plane, data->fb.height, data-
>>fb.width);
>>
>>  			ret = igt_display_try_commit2(display, commit);
>> -			if (data->override_fmt || data->override_tiling) {
>> +			if (test_bad_format && (data->override_fmt ||
>> +data->override_tiling)) {
>>  				igt_assert_eq(ret, -EINVAL);
>>  				continue;
>>  			}
>> @@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int
>plane_type)
>>  	igt_require_f(valid_tests, "no valid crtc/connector combinations
>> found\n");  }
>>
>> +static inline void test_bad_plane_rotation(data_t *data, int
>> +plane_type) {
>> +	__test_plane_rotation(data, plane_type, true); }
>> +
>> +static inline void test_plane_rotation(data_t *data, int plane_type)
>> +{
>> +	__test_plane_rotation(data, plane_type, false); }
>> +
>>  static void test_plane_rotation_ytiled_obj(data_t *data,
>>  					   igt_output_t *output,
>>  					   int plane_type)
>> @@ -613,6 +670,8 @@ static const char *plane_test_str(unsigned plane)
>> static const char *rot_test_str(igt_rotation_t rot)  {
>>  	switch (rot) {
>> +	case IGT_ROTATION_0:
>> +		return "0";
>>  	case IGT_ROTATION_90:
>>  		return "90";
>>  	case IGT_ROTATION_180:
>> @@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
>>  	}
>>  }
>>
>> +static const char *tiling_test_str(uint64_t tiling) {
>> +	switch (tiling) {
>> +	case LOCAL_I915_FORMAT_MOD_X_TILED:
>> +		return "x-tiled";
>> +	case LOCAL_I915_FORMAT_MOD_Y_TILED:
>> +		return "y-tiled";
>> +	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
>> +		return "yf-tiled";
>> +	default:
>> +		igt_assert(0);
>> +	}
>> +}
>> +
>>  static const char *flip_test_str(unsigned flips)  {
>>  	if (flips)
>> @@ -637,7 +710,7 @@ igt_main
>>  	struct rot_subtest {
>>  		unsigned plane;
>>  		igt_rotation_t rot;
>> -		unsigned flips;
>> +		bool flips;
>>  	} *subtest, subtests[] = {
>>  		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
>>  		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 }, @@ -
>654,6 +727,35
>> @@ igt_main
>>  		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
>>  		{ 0, 0, 0}
>>  	};
>> +
>> +	struct reflect_x {
>> +		uint64_t tiling;
>> +		igt_rotation_t rot;
>> +		bool flips;
>> +	} *reflect_x, reflect_x_subtests[] = {
>> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
>> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0
>},
>> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
>> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1
>},
>> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1
>},
>> +		{ 0, 0, 0 }
>> +	};
>> +
>>  	data_t data = {};
>>  	int gen = 0;
>>
>> @@ -661,7 +763,8 @@ igt_main
>>
>>  	igt_fixture {
>>  		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
>> -		gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
>> +		data.devid = intel_get_drm_devid(data.gfx_fd);
>> +		gen = intel_gen(data.devid);
>>
>>  		kmstest_set_vt_graphics_mode();
>>
>> @@ -698,7 +801,7 @@ igt_main
>>  		data.pos_y = 0;
>>  		data.rotation = IGT_ROTATION_90;
>>  		data.override_fmt = DRM_FORMAT_RGB565;
>> -		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> +		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>>  	}
>>
>>  	igt_subtest_f("bad-tiling") {
>> @@ -706,7 +809,7 @@ igt_main
>>  		data.override_fmt = 0;
>>  		data.rotation = IGT_ROTATION_90;
>>  		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
>> -		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>> +		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>>  	}
>>
>>  	igt_subtest_f("primary-rotation-90-Y-tiled") { @@ -729,6 +832,21 @@
>> igt_main
>>  		igt_require_f(valid_tests, "no valid crtc/connector combinations
>found\n");
>>  	}
>>
>> +	for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
>> +		igt_subtest_f("primary-%s-reflect-x-%s%s",
>> +			      tiling_test_str(reflect_x->tiling),
>> +			      rot_test_str(reflect_x->rot),
>> +			      flip_test_str(reflect_x->flips)) {
>> +			igt_require(gen >= 10 ||
>> +				    (IS_CHERRYVIEW(data.devid) && reflect_x-
>>rot == IGT_ROTATION_0
>> +				     && reflect_x->tiling ==
>LOCAL_I915_FORMAT_MOD_X_TILED));
>
>Bxt and glk are unable to do this?

Yes, that is correct. 

Anusha

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

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

* Re: [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
  2017-11-22 23:05 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
@ 2017-11-29  9:55 ` Petri Latvala
  2017-11-29 19:26   ` Srivatsa, Anusha
  2017-12-12  9:53 ` Petri Latvala
  2017-12-14 10:14 ` Daniel Vetter
  2 siblings, 1 reply; 15+ messages in thread
From: Petri Latvala @ 2017-11-29  9:55 UTC (permalink / raw)
  To: Anusha Srivatsa; +Cc: intel-gfx, Joseph Garvey

On Wed, Nov 22, 2017 at 03:05:55PM -0800, Anusha Srivatsa wrote:
> From: Joseph Garvey <joseph1.garvey@intel.com>
> 
> Test that horizontal flip works with supported rotations. Includes
> a fix for the unrotated fb which was not being positioned correctly
> with portrait and landscape rectangles.
> 
> v2:(from Anusha)
> - Change 180 degree rotation to follow the rest, use
> igt_swap(), make flip variable a bool. Format the
> patch correctly (Ville, Petri Latvala)
> 
> v3: (From Anusha)
> - Correct the name of subtests in order to avoid duplication
> of names (Arek)
> 
> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
>  lib/igt_kms.c            |   2 +-
>  lib/igt_kms.h            |   5 ++
>  tests/kms_rotation_crc.c | 198 +++++++++++++++++++++++++++++++++++++----------
>  3 files changed, 164 insertions(+), 41 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index a572fc6..3034e44 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
>  
>  static const char *rotation_name(igt_rotation_t rotation)
>  {
> -	switch (rotation) {
> +	switch (rotation & IGT_ROTATION_MASK) {
>  	case IGT_ROTATION_0:
>  		return "0°";
>  	case IGT_ROTATION_90:
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 8dc118c..b83a828 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -281,8 +281,13 @@ typedef enum {
>  	IGT_ROTATION_90  = 1 << 1,
>  	IGT_ROTATION_180 = 1 << 2,
>  	IGT_ROTATION_270 = 1 << 3,
> +	IGT_REFLECT_X    = 1 << 4,
> +	IGT_REFLECT_Y    = 1 << 5,
>  } igt_rotation_t;
>  
> +#define IGT_ROTATION_MASK \
> +	(IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
> +
>  typedef struct {
>  	/*< private >*/
>  	igt_pipe_t *pipe;
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 5aec8fa..9e13667 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -32,6 +32,7 @@ typedef struct {
>  	igt_display_t display;
>  	struct igt_fb fb;
>  	struct igt_fb fb_reference;
> +	struct igt_fb fb_unrotated;
>  	struct igt_fb fb_modeset;
>  	struct igt_fb fb_flip;
>  	igt_crc_t ref_crc;
> @@ -43,8 +44,59 @@ typedef struct {
>  	uint32_t override_fmt;
>  	uint64_t override_tiling;
>  	bool flips;
> +	int devid;
>  } data_t;
>  
> +typedef struct {
> +	float r;
> +	float g;
> +	float b;
> +} rgb_color_t;
> +
> +static void set_color(rgb_color_t *color, float r, float g, float b)
> +{
> +	color->r = r;
> +	color->g = g;
> +	color->b = b;
> +}
> +
> +static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
> +			  rgb_color_t *bl, igt_rotation_t rotation)
> +{
> +	rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
> +
> +	if (rotation & IGT_REFLECT_X) {
> +		igt_swap(*tl, *tr);
> +		igt_swap(*bl, *br);
> +	}
> +
> +	if (rotation & IGT_ROTATION_90) {
> +		bl_tmp = *bl;
> +		br_tmp = *br;
> +		tl_tmp = *tl;
> +		tr_tmp = *tr;
> +		*tl = tr_tmp;
> +		*bl = tl_tmp;
> +		*tr = br_tmp;
> +		*br = bl_tmp;
> +	} else if (rotation & IGT_ROTATION_180) {
> +		igt_swap(*tl, *br);
> +		igt_swap(*tr, *bl);
> +	} else if (rotation & IGT_ROTATION_270) {
> +		bl_tmp = *bl;
> +		br_tmp = *br;
> +		tl_tmp = *tl;
> +		tr_tmp = *tr;
> +		*tl = bl_tmp;
> +		*bl = br_tmp;
> +		*tr = tl_tmp;
> +		*br = tr_tmp;
> +	}
> +}
> +
> +#define RGB_COLOR(color) \
> +	color.r, color.g, color.b
> +
>  static void
>  paint_squares(data_t *data, igt_rotation_t rotation,
>  	      struct igt_fb *fb, float o)
> @@ -52,35 +104,21 @@ paint_squares(data_t *data, igt_rotation_t rotation,
>  	cairo_t *cr;
>  	unsigned int w = fb->width;
>  	unsigned int h = fb->height;
> +	rgb_color_t tl, tr, bl, br;
>  
>  	cr = igt_get_cairo_ctx(data->gfx_fd, fb);
>  
> -	if (rotation == IGT_ROTATION_180) {
> -		cairo_translate(cr, w, h);
> -		cairo_rotate(cr, M_PI);
> -	}
> +	set_color(&tl, o, 0.0f, 0.0f);
> +	set_color(&tr, 0.0f, o, 0.0f);
> +	set_color(&br, o, o, o);
> +	set_color(&bl, 0.0f, 0.0f, o);
>  
> -	if (rotation == IGT_ROTATION_90) {
> -		/* Paint 4 squares with width == height in Green, White,
> -		Blue, Red Clockwise order to look like 270 degree rotated*/
> -		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
> -		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
> -		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
> -		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> -	} else if (rotation == IGT_ROTATION_270) {
> -		/* Paint 4 squares with width == height in Blue, Red,
> -		Green, White Clockwise order to look like 90 degree rotated*/
> -		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
> -		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
> -		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
> -		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
> -	} else {
> -		/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
> -		igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
> -		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
> -		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
> -		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
> -	}
> +	rotate_colors(&tl, &tr, &br, &bl, rotation);
> +
> +	igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
> +	igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
> +	igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
> +	igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, RGB_COLOR(br));
>  
>  	cairo_destroy(cr);
>  }
> @@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
>  
>  	igt_remove_fb(data->gfx_fd, &data->fb);
>  	igt_remove_fb(data->gfx_fd, &data->fb_reference);
> +	igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
>  
>  	if (data->fb_flip.fb_id)
>  		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> @@ -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
>  	 * For 90/270, we will use create smaller fb so that the rotated
>  	 * frame can fit in
>  	 */
> -	if (data->rotation == IGT_ROTATION_90 ||
> -	    data->rotation == IGT_ROTATION_270) {
> +	if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
>  		tiling = data->override_tiling ?: LOCAL_I915_FORMAT_MOD_Y_TILED;
>  
>  		igt_swap(w, h);
>  	}
>  
> -	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
> -
> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> -
>  	/*
>  	 * Create a reference software rotated flip framebuffer.
>  	 */
> @@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
>  	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>  
>  	/*
> +	 * Prepare the non-rotated reference fb.
> +	 */
> +	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data->fb_unrotated);
> +	paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
> +	igt_plane_set_fb(plane, &data->fb_unrotated);
> +	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +	if (plane->type != DRM_PLANE_TYPE_CURSOR)
> +		igt_plane_set_position(plane, data->pos_x, data->pos_y);
> +	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> +
> +	/*
>  	 * Prepare the plane with an non-rotated fb let the hw rotate it.
>  	 */
> +	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
>  	paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
>  	igt_plane_set_fb(plane, &data->fb);
>  
> @@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
>  	igt_assert(drmHandleEvent(fd, &evctx) == 0);
>  }
>  
> -static void test_plane_rotation(data_t *data, int plane_type)
> +static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
>  {
>  	igt_display_t *display = &data->display;
>  	igt_output_t *output;
> @@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int plane_type)
>  		igt_plane_t *plane;
>  		int i;
>  
> +		if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
> +			continue;
> +
>  		igt_output_set_pipe(output, pipe);
>  
>  		plane = igt_output_get_plane_type(output, plane_type);
> @@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int plane_type)
>  			igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
>  			prepare_fbs(data, output, plane, i);
>  
> -			igt_display_commit2(display, commit);
> -
>  			igt_plane_set_rotation(plane, data->rotation);
> -			if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
> +			if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
>  				igt_plane_set_size(plane, data->fb.height, data->fb.width);
>  
>  			ret = igt_display_try_commit2(display, commit);
> -			if (data->override_fmt || data->override_tiling) {
> +			if (test_bad_format && (data->override_fmt || data->override_tiling)) {
>  				igt_assert_eq(ret, -EINVAL);
>  				continue;
>  			}
> @@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int plane_type)
>  	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
>  }
>  
> +static inline void test_bad_plane_rotation(data_t *data, int plane_type)
> +{
> +	__test_plane_rotation(data, plane_type, true);
> +}
> +
> +static inline void test_plane_rotation(data_t *data, int plane_type)
> +{
> +	__test_plane_rotation(data, plane_type, false);
> +}
> +
>  static void test_plane_rotation_ytiled_obj(data_t *data,
>  					   igt_output_t *output,
>  					   int plane_type)
> @@ -613,6 +670,8 @@ static const char *plane_test_str(unsigned plane)
>  static const char *rot_test_str(igt_rotation_t rot)
>  {
>  	switch (rot) {
> +	case IGT_ROTATION_0:
> +		return "0";
>  	case IGT_ROTATION_90:
>  		return "90";
>  	case IGT_ROTATION_180:
> @@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
>  	}
>  }
>  
> +static const char *tiling_test_str(uint64_t tiling)
> +{
> +	switch (tiling) {
> +	case LOCAL_I915_FORMAT_MOD_X_TILED:
> +		return "x-tiled";
> +	case LOCAL_I915_FORMAT_MOD_Y_TILED:
> +		return "y-tiled";
> +	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
> +		return "yf-tiled";
> +	default:
> +		igt_assert(0);
> +	}
> +}
> +
>  static const char *flip_test_str(unsigned flips)
>  {
>  	if (flips)
> @@ -637,7 +710,7 @@ igt_main
>  	struct rot_subtest {
>  		unsigned plane;
>  		igt_rotation_t rot;
> -		unsigned flips;
> +		bool flips;
>  	} *subtest, subtests[] = {
>  		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
>  		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
> @@ -654,6 +727,35 @@ igt_main
>  		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
>  		{ 0, 0, 0}
>  	};
> +
> +	struct reflect_x {
> +		uint64_t tiling;
> +		igt_rotation_t rot;
> +		bool flips;
> +	} *reflect_x, reflect_x_subtests[] = {
> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
> +		{ 0, 0, 0 }
> +	};
> +
>  	data_t data = {};
>  	int gen = 0;
>  
> @@ -661,7 +763,8 @@ igt_main
>  
>  	igt_fixture {
>  		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
> -		gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
> +		data.devid = intel_get_drm_devid(data.gfx_fd);
> +		gen = intel_gen(data.devid);
>  
>  		kmstest_set_vt_graphics_mode();
>  
> @@ -698,7 +801,7 @@ igt_main
>  		data.pos_y = 0;
>  		data.rotation = IGT_ROTATION_90;
>  		data.override_fmt = DRM_FORMAT_RGB565;
> -		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> +		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>  	}
>  
>  	igt_subtest_f("bad-tiling") {
> @@ -706,7 +809,7 @@ igt_main
>  		data.override_fmt = 0;
>  		data.rotation = IGT_ROTATION_90;
>  		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> -		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
> +		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
>  	}
>  
>  	igt_subtest_f("primary-rotation-90-Y-tiled") {
> @@ -729,6 +832,21 @@ igt_main
>  		igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
>  	}
>  
> +	for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
> +		igt_subtest_f("primary-%s-reflect-x-%s%s",
> +			      tiling_test_str(reflect_x->tiling),
> +			      rot_test_str(reflect_x->rot),
> +			      flip_test_str(reflect_x->flips)) {
> +			igt_require(gen >= 10 ||
> +				    (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
> +				     && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));

Bxt and glk are unable to do this?


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

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

* [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
@ 2017-11-22 23:05 Anusha Srivatsa
  2017-11-29  9:55 ` Petri Latvala
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Anusha Srivatsa @ 2017-11-22 23:05 UTC (permalink / raw)
  To: intel-gfx; +Cc: Joseph Garvey

From: Joseph Garvey <joseph1.garvey@intel.com>

Test that horizontal flip works with supported rotations. Includes
a fix for the unrotated fb which was not being positioned correctly
with portrait and landscape rectangles.

v2:(from Anusha)
- Change 180 degree rotation to follow the rest, use
igt_swap(), make flip variable a bool. Format the
patch correctly (Ville, Petri Latvala)

v3: (From Anusha)
- Correct the name of subtests in order to avoid duplication
of names (Arek)

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 lib/igt_kms.c            |   2 +-
 lib/igt_kms.h            |   5 ++
 tests/kms_rotation_crc.c | 198 +++++++++++++++++++++++++++++++++++++----------
 3 files changed, 164 insertions(+), 41 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a572fc6..3034e44 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
 
 static const char *rotation_name(igt_rotation_t rotation)
 {
-	switch (rotation) {
+	switch (rotation & IGT_ROTATION_MASK) {
 	case IGT_ROTATION_0:
 		return "0°";
 	case IGT_ROTATION_90:
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8dc118c..b83a828 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -281,8 +281,13 @@ typedef enum {
 	IGT_ROTATION_90  = 1 << 1,
 	IGT_ROTATION_180 = 1 << 2,
 	IGT_ROTATION_270 = 1 << 3,
+	IGT_REFLECT_X    = 1 << 4,
+	IGT_REFLECT_Y    = 1 << 5,
 } igt_rotation_t;
 
+#define IGT_ROTATION_MASK \
+	(IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
+
 typedef struct {
 	/*< private >*/
 	igt_pipe_t *pipe;
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5aec8fa..9e13667 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -32,6 +32,7 @@ typedef struct {
 	igt_display_t display;
 	struct igt_fb fb;
 	struct igt_fb fb_reference;
+	struct igt_fb fb_unrotated;
 	struct igt_fb fb_modeset;
 	struct igt_fb fb_flip;
 	igt_crc_t ref_crc;
@@ -43,8 +44,59 @@ typedef struct {
 	uint32_t override_fmt;
 	uint64_t override_tiling;
 	bool flips;
+	int devid;
 } data_t;
 
+typedef struct {
+	float r;
+	float g;
+	float b;
+} rgb_color_t;
+
+static void set_color(rgb_color_t *color, float r, float g, float b)
+{
+	color->r = r;
+	color->g = g;
+	color->b = b;
+}
+
+static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
+			  rgb_color_t *bl, igt_rotation_t rotation)
+{
+	rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
+
+	if (rotation & IGT_REFLECT_X) {
+		igt_swap(*tl, *tr);
+		igt_swap(*bl, *br);
+	}
+
+	if (rotation & IGT_ROTATION_90) {
+		bl_tmp = *bl;
+		br_tmp = *br;
+		tl_tmp = *tl;
+		tr_tmp = *tr;
+		*tl = tr_tmp;
+		*bl = tl_tmp;
+		*tr = br_tmp;
+		*br = bl_tmp;
+	} else if (rotation & IGT_ROTATION_180) {
+		igt_swap(*tl, *br);
+		igt_swap(*tr, *bl);
+	} else if (rotation & IGT_ROTATION_270) {
+		bl_tmp = *bl;
+		br_tmp = *br;
+		tl_tmp = *tl;
+		tr_tmp = *tr;
+		*tl = bl_tmp;
+		*bl = br_tmp;
+		*tr = tl_tmp;
+		*br = tr_tmp;
+	}
+}
+
+#define RGB_COLOR(color) \
+	color.r, color.g, color.b
+
 static void
 paint_squares(data_t *data, igt_rotation_t rotation,
 	      struct igt_fb *fb, float o)
@@ -52,35 +104,21 @@ paint_squares(data_t *data, igt_rotation_t rotation,
 	cairo_t *cr;
 	unsigned int w = fb->width;
 	unsigned int h = fb->height;
+	rgb_color_t tl, tr, bl, br;
 
 	cr = igt_get_cairo_ctx(data->gfx_fd, fb);
 
-	if (rotation == IGT_ROTATION_180) {
-		cairo_translate(cr, w, h);
-		cairo_rotate(cr, M_PI);
-	}
+	set_color(&tl, o, 0.0f, 0.0f);
+	set_color(&tr, 0.0f, o, 0.0f);
+	set_color(&br, o, o, o);
+	set_color(&bl, 0.0f, 0.0f, o);
 
-	if (rotation == IGT_ROTATION_90) {
-		/* Paint 4 squares with width == height in Green, White,
-		Blue, Red Clockwise order to look like 270 degree rotated*/
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
-	} else if (rotation == IGT_ROTATION_270) {
-		/* Paint 4 squares with width == height in Blue, Red,
-		Green, White Clockwise order to look like 90 degree rotated*/
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
-	} else {
-		/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
-	}
+	rotate_colors(&tl, &tr, &br, &bl, rotation);
+
+	igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
+	igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
+	igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
+	igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, RGB_COLOR(br));
 
 	cairo_destroy(cr);
 }
@@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
 
 	igt_remove_fb(data->gfx_fd, &data->fb);
 	igt_remove_fb(data->gfx_fd, &data->fb_reference);
+	igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
 
 	if (data->fb_flip.fb_id)
 		igt_remove_fb(data->gfx_fd, &data->fb_flip);
@@ -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	 * For 90/270, we will use create smaller fb so that the rotated
 	 * frame can fit in
 	 */
-	if (data->rotation == IGT_ROTATION_90 ||
-	    data->rotation == IGT_ROTATION_270) {
+	if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
 		tiling = data->override_tiling ?: LOCAL_I915_FORMAT_MOD_Y_TILED;
 
 		igt_swap(w, h);
 	}
 
-	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
-
-	igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
 	/*
 	 * Create a reference software rotated flip framebuffer.
 	 */
@@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
 	/*
+	 * Prepare the non-rotated reference fb.
+	 */
+	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data->fb_unrotated);
+	paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
+	igt_plane_set_fb(plane, &data->fb_unrotated);
+	igt_plane_set_rotation(plane, IGT_ROTATION_0);
+	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+		igt_plane_set_position(plane, data->pos_x, data->pos_y);
+	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
+
+	/*
 	 * Prepare the plane with an non-rotated fb let the hw rotate it.
 	 */
+	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
 	paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
 	igt_plane_set_fb(plane, &data->fb);
 
@@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
 	igt_assert(drmHandleEvent(fd, &evctx) == 0);
 }
 
-static void test_plane_rotation(data_t *data, int plane_type)
+static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
@@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int plane_type)
 		igt_plane_t *plane;
 		int i;
 
+		if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
+			continue;
+
 		igt_output_set_pipe(output, pipe);
 
 		plane = igt_output_get_plane_type(output, plane_type);
@@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int plane_type)
 			igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
 			prepare_fbs(data, output, plane, i);
 
-			igt_display_commit2(display, commit);
-
 			igt_plane_set_rotation(plane, data->rotation);
-			if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
+			if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
 				igt_plane_set_size(plane, data->fb.height, data->fb.width);
 
 			ret = igt_display_try_commit2(display, commit);
-			if (data->override_fmt || data->override_tiling) {
+			if (test_bad_format && (data->override_fmt || data->override_tiling)) {
 				igt_assert_eq(ret, -EINVAL);
 				continue;
 			}
@@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int plane_type)
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
+static inline void test_bad_plane_rotation(data_t *data, int plane_type)
+{
+	__test_plane_rotation(data, plane_type, true);
+}
+
+static inline void test_plane_rotation(data_t *data, int plane_type)
+{
+	__test_plane_rotation(data, plane_type, false);
+}
+
 static void test_plane_rotation_ytiled_obj(data_t *data,
 					   igt_output_t *output,
 					   int plane_type)
@@ -613,6 +670,8 @@ static const char *plane_test_str(unsigned plane)
 static const char *rot_test_str(igt_rotation_t rot)
 {
 	switch (rot) {
+	case IGT_ROTATION_0:
+		return "0";
 	case IGT_ROTATION_90:
 		return "90";
 	case IGT_ROTATION_180:
@@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
 	}
 }
 
+static const char *tiling_test_str(uint64_t tiling)
+{
+	switch (tiling) {
+	case LOCAL_I915_FORMAT_MOD_X_TILED:
+		return "x-tiled";
+	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+		return "y-tiled";
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+		return "yf-tiled";
+	default:
+		igt_assert(0);
+	}
+}
+
 static const char *flip_test_str(unsigned flips)
 {
 	if (flips)
@@ -637,7 +710,7 @@ igt_main
 	struct rot_subtest {
 		unsigned plane;
 		igt_rotation_t rot;
-		unsigned flips;
+		bool flips;
 	} *subtest, subtests[] = {
 		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
 		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
@@ -654,6 +727,35 @@ igt_main
 		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
 		{ 0, 0, 0}
 	};
+
+	struct reflect_x {
+		uint64_t tiling;
+		igt_rotation_t rot;
+		bool flips;
+	} *reflect_x, reflect_x_subtests[] = {
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
+		{ 0, 0, 0 }
+	};
+
 	data_t data = {};
 	int gen = 0;
 
@@ -661,7 +763,8 @@ igt_main
 
 	igt_fixture {
 		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
-		gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
+		data.devid = intel_get_drm_devid(data.gfx_fd);
+		gen = intel_gen(data.devid);
 
 		kmstest_set_vt_graphics_mode();
 
@@ -698,7 +801,7 @@ igt_main
 		data.pos_y = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_fmt = DRM_FORMAT_RGB565;
-		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("bad-tiling") {
@@ -706,7 +809,7 @@ igt_main
 		data.override_fmt = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
-		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("primary-rotation-90-Y-tiled") {
@@ -729,6 +832,21 @@ igt_main
 		igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 	}
 
+	for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
+		igt_subtest_f("primary-%s-reflect-x-%s%s",
+			      tiling_test_str(reflect_x->tiling),
+			      rot_test_str(reflect_x->rot),
+			      flip_test_str(reflect_x->flips)) {
+			igt_require(gen >= 10 ||
+				    (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
+				     && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));
+			data.rotation = (IGT_REFLECT_X | reflect_x->rot);
+			data.override_tiling = reflect_x->tiling;
+			data.flips = reflect_x->flips;
+			test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		}
+	}
+
 	igt_subtest_f("exhaust-fences") {
 		enum pipe pipe;
 		igt_output_t *output;
-- 
2.7.4

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

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

* [patch i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest.
@ 2017-10-05  0:43 Anusha Srivatsa
  0 siblings, 0 replies; 15+ messages in thread
From: Anusha Srivatsa @ 2017-10-05  0:43 UTC (permalink / raw)
  To: intel-gfx

From: Joseph Garvey <joseph1.garvey@intel.com>

Test that horizontal flip works with supported rotations. Includes
a fix for the unrotated fb which was not being positioned correctly
with portrait and landscape rectangles.

v2:(from Anusha)
- Change 180 degree rotation to follow the rest, use
igt_swap(), make flip variable a bool. Format the
patch correctly (Ville, Petri Latvala)

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Joseph Garvey <joseph1.garvey@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
---
 lib/igt_kms.c            |   2 +-
 lib/igt_kms.h            |   5 ++
 tests/kms_rotation_crc.c | 197 +++++++++++++++++++++++++++++++++++++----------
 3 files changed, 163 insertions(+), 41 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a572fc6..3034e44 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3050,7 +3050,7 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
 
 static const char *rotation_name(igt_rotation_t rotation)
 {
-	switch (rotation) {
+	switch (rotation & IGT_ROTATION_MASK) {
 	case IGT_ROTATION_0:
 		return "0°";
 	case IGT_ROTATION_90:
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8dc118c..b83a828 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -281,8 +281,13 @@ typedef enum {
 	IGT_ROTATION_90  = 1 << 1,
 	IGT_ROTATION_180 = 1 << 2,
 	IGT_ROTATION_270 = 1 << 3,
+	IGT_REFLECT_X    = 1 << 4,
+	IGT_REFLECT_Y    = 1 << 5,
 } igt_rotation_t;
 
+#define IGT_ROTATION_MASK \
+	(IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
+
 typedef struct {
 	/*< private >*/
 	igt_pipe_t *pipe;
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5aec8fa..b894df3 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -32,6 +32,7 @@ typedef struct {
 	igt_display_t display;
 	struct igt_fb fb;
 	struct igt_fb fb_reference;
+	struct igt_fb fb_unrotated;
 	struct igt_fb fb_modeset;
 	struct igt_fb fb_flip;
 	igt_crc_t ref_crc;
@@ -43,8 +44,59 @@ typedef struct {
 	uint32_t override_fmt;
 	uint64_t override_tiling;
 	bool flips;
+	int devid;
 } data_t;
 
+typedef struct {
+	float r;
+	float g;
+	float b;
+} rgb_color_t;
+
+static void set_color(rgb_color_t *color, float r, float g, float b)
+{
+	color->r = r;
+	color->g = g;
+	color->b = b;
+}
+
+static void rotate_colors(rgb_color_t *tl, rgb_color_t *tr, rgb_color_t *br,
+			  rgb_color_t *bl, igt_rotation_t rotation)
+{
+	rgb_color_t bl_tmp, br_tmp, tl_tmp, tr_tmp;
+
+	if (rotation & IGT_REFLECT_X) {
+		igt_swap(*tl, *tr);
+		igt_swap(*bl, *br);
+	}
+
+	if (rotation & IGT_ROTATION_90) {
+		bl_tmp = *bl;
+		br_tmp = *br;
+		tl_tmp = *tl;
+		tr_tmp = *tr;
+		*tl = tr_tmp;
+		*bl = tl_tmp;
+		*tr = br_tmp;
+		*br = bl_tmp;
+	} else if (rotation & IGT_ROTATION_180) {
+		igt_swap(*tl, *br);
+		igt_swap(*tr, *bl);
+	} else if (rotation & IGT_ROTATION_270) {
+		bl_tmp = *bl;
+		br_tmp = *br;
+		tl_tmp = *tl;
+		tr_tmp = *tr;
+		*tl = bl_tmp;
+		*bl = br_tmp;
+		*tr = tl_tmp;
+		*br = tr_tmp;
+	}
+}
+
+#define RGB_COLOR(color) \
+	color.r, color.g, color.b
+
 static void
 paint_squares(data_t *data, igt_rotation_t rotation,
 	      struct igt_fb *fb, float o)
@@ -52,35 +104,21 @@ paint_squares(data_t *data, igt_rotation_t rotation,
 	cairo_t *cr;
 	unsigned int w = fb->width;
 	unsigned int h = fb->height;
+	rgb_color_t tl, tr, bl, br;
 
 	cr = igt_get_cairo_ctx(data->gfx_fd, fb);
 
-	if (rotation == IGT_ROTATION_180) {
-		cairo_translate(cr, w, h);
-		cairo_rotate(cr, M_PI);
-	}
+	set_color(&tl, o, 0.0f, 0.0f);
+	set_color(&tr, 0.0f, o, 0.0f);
+	set_color(&br, o, o, o);
+	set_color(&bl, 0.0f, 0.0f, o);
 
-	if (rotation == IGT_ROTATION_90) {
-		/* Paint 4 squares with width == height in Green, White,
-		Blue, Red Clockwise order to look like 270 degree rotated*/
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o);
-	} else if (rotation == IGT_ROTATION_270) {
-		/* Paint 4 squares with width == height in Blue, Red,
-		Green, White Clockwise order to look like 90 degree rotated*/
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0);
-	} else {
-		/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o);
-	}
+	rotate_colors(&tl, &tr, &br, &bl, rotation);
+
+	igt_paint_color(cr, 0, 0, w / 2, h / 2, RGB_COLOR(tl));
+	igt_paint_color(cr, w / 2, 0, w / 2, h / 2, RGB_COLOR(tr));
+	igt_paint_color(cr, 0, h / 2, w / 2, h / 2, RGB_COLOR(bl));
+	igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, RGB_COLOR(br));
 
 	cairo_destroy(cr);
 }
@@ -141,6 +179,7 @@ static void remove_fbs(data_t *data)
 
 	igt_remove_fb(data->gfx_fd, &data->fb);
 	igt_remove_fb(data->gfx_fd, &data->fb_reference);
+	igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
 
 	if (data->fb_flip.fb_id)
 		igt_remove_fb(data->gfx_fd, &data->fb_flip);
@@ -212,17 +251,12 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	 * For 90/270, we will use create smaller fb so that the rotated
 	 * frame can fit in
 	 */
-	if (data->rotation == IGT_ROTATION_90 ||
-	    data->rotation == IGT_ROTATION_270) {
+	if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270)) {
 		tiling = data->override_tiling ?: LOCAL_I915_FORMAT_MOD_Y_TILED;
 
 		igt_swap(w, h);
 	}
 
-	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
-
-	igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
 	/*
 	 * Create a reference software rotated flip framebuffer.
 	 */
@@ -255,8 +289,20 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
 	/*
+	 * Prepare the non-rotated reference fb.
+	 */
+	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling, &data->fb_unrotated);
+	paint_squares(data, IGT_ROTATION_0, &data->fb_unrotated, 1.0);
+	igt_plane_set_fb(plane, &data->fb_unrotated);
+	igt_plane_set_rotation(plane, IGT_ROTATION_0);
+	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+		igt_plane_set_position(plane, data->pos_x, data->pos_y);
+	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
+
+	/*
 	 * Prepare the plane with an non-rotated fb let the hw rotate it.
 	 */
+	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb);
 	paint_squares(data, IGT_ROTATION_0, &data->fb, 1.0);
 	igt_plane_set_fb(plane, &data->fb);
 
@@ -322,7 +368,7 @@ static void wait_for_pageflip(int fd)
 	igt_assert(drmHandleEvent(fd, &evctx) == 0);
 }
 
-static void test_plane_rotation(data_t *data, int plane_type)
+static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_format)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
@@ -348,6 +394,9 @@ static void test_plane_rotation(data_t *data, int plane_type)
 		igt_plane_t *plane;
 		int i;
 
+		if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
+			continue;
+
 		igt_output_set_pipe(output, pipe);
 
 		plane = igt_output_get_plane_type(output, plane_type);
@@ -369,14 +418,12 @@ static void test_plane_rotation(data_t *data, int plane_type)
 			igt_debug("Testing case %i on pipe %s\n", i, kmstest_pipe_name(pipe));
 			prepare_fbs(data, output, plane, i);
 
-			igt_display_commit2(display, commit);
-
 			igt_plane_set_rotation(plane, data->rotation);
-			if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
+			if (data->rotation & (IGT_ROTATION_90 | IGT_ROTATION_270))
 				igt_plane_set_size(plane, data->fb.height, data->fb.width);
 
 			ret = igt_display_try_commit2(display, commit);
-			if (data->override_fmt || data->override_tiling) {
+			if (test_bad_format && (data->override_fmt || data->override_tiling)) {
 				igt_assert_eq(ret, -EINVAL);
 				continue;
 			}
@@ -421,6 +468,16 @@ static void test_plane_rotation(data_t *data, int plane_type)
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
+static inline void test_bad_plane_rotation(data_t *data, int plane_type)
+{
+	__test_plane_rotation(data, plane_type, true);
+}
+
+static inline void test_plane_rotation(data_t *data, int plane_type)
+{
+	__test_plane_rotation(data, plane_type, false);
+}
+
 static void test_plane_rotation_ytiled_obj(data_t *data,
 					   igt_output_t *output,
 					   int plane_type)
@@ -613,6 +670,8 @@ static const char *plane_test_str(unsigned plane)
 static const char *rot_test_str(igt_rotation_t rot)
 {
 	switch (rot) {
+	case IGT_ROTATION_0:
+		return "0";
 	case IGT_ROTATION_90:
 		return "90";
 	case IGT_ROTATION_180:
@@ -624,6 +683,20 @@ static const char *rot_test_str(igt_rotation_t rot)
 	}
 }
 
+static const char *tiling_test_str(uint64_t tiling)
+{
+	switch (tiling) {
+	case LOCAL_I915_FORMAT_MOD_X_TILED:
+		return "x-tiled";
+	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+		return "y-tiled";
+	case LOCAL_I915_FORMAT_MOD_Yf_TILED:
+		return "yf-tiled";
+	default:
+		igt_assert(0);
+	}
+}
+
 static const char *flip_test_str(unsigned flips)
 {
 	if (flips)
@@ -637,7 +710,7 @@ igt_main
 	struct rot_subtest {
 		unsigned plane;
 		igt_rotation_t rot;
-		unsigned flips;
+		bool flips;
 	} *subtest, subtests[] = {
 		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
 		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
@@ -654,6 +727,35 @@ igt_main
 		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
 		{ 0, 0, 0}
 	};
+
+	struct reflect_x {
+		uint64_t tiling;
+		igt_rotation_t rot;
+		bool flips;
+	} *reflect_x, reflect_x_subtests[] = {
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 0 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180, 1 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270, 1 },
+		{ 0, 0, 0 }
+	};
+
 	data_t data = {};
 	int gen = 0;
 
@@ -661,7 +763,8 @@ igt_main
 
 	igt_fixture {
 		data.gfx_fd = drm_open_driver_master(DRIVER_INTEL);
-		gen = intel_gen(intel_get_drm_devid(data.gfx_fd));
+		data.devid = intel_get_drm_devid(data.gfx_fd);
+		gen = intel_gen(data.devid);
 
 		kmstest_set_vt_graphics_mode();
 
@@ -698,7 +801,7 @@ igt_main
 		data.pos_y = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_fmt = DRM_FORMAT_RGB565;
-		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("bad-tiling") {
@@ -706,7 +809,7 @@ igt_main
 		data.override_fmt = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
-		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("primary-rotation-90-Y-tiled") {
@@ -729,6 +832,20 @@ igt_main
 		igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 	}
 
+	for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
+		igt_subtest_f("primary-%s-reflect-x-%s",
+			      tiling_test_str(reflect_x->tiling),
+			      rot_test_str(reflect_x->rot)) {
+			igt_require(gen >= 10 ||
+				    (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
+				     && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));
+			data.rotation = (IGT_REFLECT_X | reflect_x->rot);
+			data.override_tiling = reflect_x->tiling;
+			data.flips = reflect_x->flips;
+			test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		}
+	}
+
 	igt_subtest_f("exhaust-fences") {
 		enum pipe pipe;
 		igt_output_t *output;
-- 
2.7.4

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

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

end of thread, other threads:[~2018-02-02  7:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 23:29 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
2017-10-20 23:48 ` ✗ Fi.CI.BAT: warning for igt/kms_rotation_crc: Add horizontal flip subtest. (rev2) Patchwork
2017-10-24 12:12   ` Arkadiusz Hiler
2017-10-24 14:53 ` ✓ Fi.CI.BAT: success " Patchwork
2017-10-24 15:53 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-11-22 23:05 [PATCH i-g-t] igt/kms_rotation_crc: Add horizontal flip subtest Anusha Srivatsa
2017-11-29  9:55 ` Petri Latvala
2017-11-29 19:26   ` Srivatsa, Anusha
2017-12-12  9:53 ` Petri Latvala
2017-12-14 10:14 ` Daniel Vetter
2017-12-19  0:00   ` Rodrigo Vivi
2017-12-19  0:20   ` Srivatsa, Anusha
2017-12-19 21:49     ` Rodrigo Vivi
2018-02-02  7:04       ` Srivatsa, Anusha
2017-10-05  0:43 [patch " Anusha Srivatsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.