public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/7] kms_rotation_crc cleanups
@ 2015-04-22 15:46 Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 1/7] kms_rotation_crc: Local framebuffers do not need to be global Tvrtko Ursulin
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

I thought I will need to add some page flipping tests here and wanted
to do some cleanups first.

Unfortunately (or fortunately), kms_flip_tiling already tests Y tiled
flips with CRC so the focus shifts to fixing that one.

But these cleanups are still an improvement in amount of code and clarity.

This is on top of Sonika's 90/270 kms_rotation_crc patch which I r-b-ed.

Tvrtko Ursulin (7):
  kms_rotation_crc: Local framebuffers do not need to be global
  kms_rotation_crc: Framebuffer used for initial modeset does not need
    to be painted
  kms_rotation_crc: Remove unused variable in negative test
  kms_rotation_crc: Negative test does not need to render anything
  kms_rotation_crc: Consolidate plane and cursor code paths
  kms_rotation_crc: No need to square the buffer in paint
  kms_rotation_crc: Use main test for negative cases

 tests/kms_rotation_crc.c | 271 ++++++++++++++++-------------------------------
 1 file changed, 92 insertions(+), 179 deletions(-)

-- 
2.3.5

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

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

* [PATCH i-g-t 1/7] kms_rotation_crc: Local framebuffers do not need to be global
  2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
@ 2015-04-22 15:46 ` Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 2/7] kms_rotation_crc: Framebuffer used for initial modeset does not need to be painted Tvrtko Ursulin
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
---
 tests/kms_rotation_crc.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index eda66de..22bc554 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -36,8 +36,6 @@ typedef struct {
 	struct igt_fb fb;
 	struct igt_fb fb_cursor;
 	struct igt_fb fb_full;
-	struct igt_fb fb_565;
-	struct igt_fb fb_tiling;
 	igt_crc_t ref_crc;
 	igt_pipe_crc_t *pipe_crc;
 	igt_rotation_t rotation;
@@ -247,6 +245,7 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 	enum pipe pipe;
 	int valid_tests = 0;
 	int fb_tiling_id, fb_565_id;
+	struct igt_fb fb_565, fb_tiling;
 
 	for_each_connected_output(display, output) {
 		for_each_pipe(display, pipe) {
@@ -262,10 +261,10 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 					mode->hdisplay, mode->vdisplay,
 					DRM_FORMAT_XRGB8888,
 					LOCAL_DRM_FORMAT_MOD_NONE,
-					&data->fb_tiling);
+					&fb_tiling);
 			igt_assert(fb_tiling_id);
-			paint_squares(data, &data->fb_tiling, mode, IGT_ROTATION_0, plane);
-			igt_plane_set_fb(plane, &data->fb_tiling);
+			paint_squares(data, &fb_tiling, mode, IGT_ROTATION_0, plane);
+			igt_plane_set_fb(plane, &fb_tiling);
 			/* For the first modeset with legacy commit */
 			igt_display_commit(display);
 			igt_plane_set_rotation(plane, data->rotation);
@@ -276,10 +275,10 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 					mode->hdisplay, mode->vdisplay,
 					DRM_FORMAT_RGB565,
 					LOCAL_I915_FORMAT_MOD_Y_TILED,
-					&data->fb_565);
+					&fb_565);
 			igt_assert(fb_565_id);
-			paint_squares(data, &data->fb_565, mode, IGT_ROTATION_0, plane);
-			igt_plane_set_fb(plane, &data->fb_565);
+			paint_squares(data, &fb_565, mode, IGT_ROTATION_0, plane);
+			igt_plane_set_fb(plane, &fb_565);
 			igt_plane_set_rotation(plane, data->rotation);
 			/* Shud fail because 90/270 is not supported with RGB565 */
 			igt_assert(igt_display_try_commit2(display, COMMIT_UNIVERSAL) == -EINVAL);
@@ -294,8 +293,8 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 
 			valid_tests++;
 
-			igt_remove_fb(data->gfx_fd, &data->fb_tiling);
-			igt_remove_fb(data->gfx_fd, &data->fb_565);
+			igt_remove_fb(data->gfx_fd, &fb_tiling);
+			igt_remove_fb(data->gfx_fd, &fb_565);
 			cleanup_crtc(data, output, plane);
 
 			igt_display_commit(display);
-- 
2.3.5

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

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

* [PATCH i-g-t 2/7] kms_rotation_crc: Framebuffer used for initial modeset does not need to be painted
  2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 1/7] kms_rotation_crc: Local framebuffers do not need to be global Tvrtko Ursulin
@ 2015-04-22 15:46 ` Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 3/7] kms_rotation_crc: Remove unused variable in negative test Tvrtko Ursulin
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

It is just there to light up the display using the full modeset. Also renamed it
from fb_full to fb_modeset to be more descriptive.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
---
 tests/kms_rotation_crc.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 22bc554..ab13f70 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -35,7 +35,7 @@ typedef struct {
 	igt_display_t display;
 	struct igt_fb fb;
 	struct igt_fb fb_cursor;
-	struct igt_fb fb_full;
+	struct igt_fb fb_modeset;
 	igt_crc_t ref_crc;
 	igt_pipe_crc_t *pipe_crc;
 	igt_rotation_t rotation;
@@ -117,11 +117,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 {
 	drmModeModeInfo *mode;
 	igt_display_t *display = &data->display;
-	int fb_id, fb_cursor_id, fb_full_id;
+	int fb_id, fb_cursor_id, fb_modeset_id;
 	int w, h;
 	uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
 	enum igt_commit_style commit = COMMIT_LEGACY;
-	int old_rotation;
 	igt_plane_t *primary;
 
 	igt_output_set_pipe(output, pipe);
@@ -135,12 +134,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	w = mode->hdisplay;
 	h = mode->vdisplay;
 
-	fb_full_id = igt_create_fb(data->gfx_fd,
-			w, h,
-			DRM_FORMAT_XRGB8888,
-			tiling,
-			&data->fb_full);
-	igt_assert(fb_full_id);
+	fb_modeset_id = igt_create_fb(data->gfx_fd,
+				      w, h,
+				      DRM_FORMAT_XRGB8888,
+				      tiling,
+				      &data->fb_modeset);
+	igt_assert(fb_modeset_id);
 
 	/*
 	 * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
@@ -149,13 +148,9 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	 * we create an fb covering the crtc and call commit
 	 */
 
-	old_rotation = data->rotation;
-	data->rotation = IGT_ROTATION_0;
 	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-	paint_squares(data, &data->fb_full, mode, IGT_ROTATION_0, primary);
-	igt_plane_set_fb(primary, &data->fb_full);
+	igt_plane_set_fb(primary, &data->fb_modeset);
 	igt_display_commit(display);
-	data->rotation = old_rotation;
 
 	/*
 	 * For 90/270, we will use create smaller fb so that the rotated
@@ -221,7 +216,7 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 
 	igt_remove_fb(data->gfx_fd, &data->fb);
 	igt_remove_fb(data->gfx_fd, &data->fb_cursor);
-	igt_remove_fb(data->gfx_fd, &data->fb_full);
+	igt_remove_fb(data->gfx_fd, &data->fb_modeset);
 
 	/* XXX: see the note in prepare_crtc() */
 	if (!plane->is_primary) {
-- 
2.3.5

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

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

* [PATCH i-g-t 3/7] kms_rotation_crc: Remove unused variable in negative test
  2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 1/7] kms_rotation_crc: Local framebuffers do not need to be global Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 2/7] kms_rotation_crc: Framebuffer used for initial modeset does not need to be painted Tvrtko Ursulin
@ 2015-04-22 15:46 ` Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 4/7] kms_rotation_crc: Negative test does not need to render anything Tvrtko Ursulin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
---
 tests/kms_rotation_crc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index ab13f70..a523527 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -238,7 +238,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	enum pipe pipe;
-	int valid_tests = 0;
 	int fb_tiling_id, fb_565_id;
 	struct igt_fb fb_565, fb_tiling;
 
@@ -286,8 +285,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 			kmstest_set_vt_graphics_mode();
 			prepare_crtc(data, output, pipe, plane);
 
-			valid_tests++;
-
 			igt_remove_fb(data->gfx_fd, &fb_tiling);
 			igt_remove_fb(data->gfx_fd, &fb_565);
 			cleanup_crtc(data, output, plane);
-- 
2.3.5

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

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

* [PATCH i-g-t 4/7] kms_rotation_crc: Negative test does not need to render anything
  2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
                   ` (2 preceding siblings ...)
  2015-04-22 15:46 ` [PATCH i-g-t 3/7] kms_rotation_crc: Remove unused variable in negative test Tvrtko Ursulin
@ 2015-04-22 15:46 ` Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 5/7] kms_rotation_crc: Consolidate plane and cursor code paths Tvrtko Ursulin
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
---
 tests/kms_rotation_crc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index a523527..f871e2a 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -257,7 +257,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 					LOCAL_DRM_FORMAT_MOD_NONE,
 					&fb_tiling);
 			igt_assert(fb_tiling_id);
-			paint_squares(data, &fb_tiling, mode, IGT_ROTATION_0, plane);
 			igt_plane_set_fb(plane, &fb_tiling);
 			/* For the first modeset with legacy commit */
 			igt_display_commit(display);
@@ -271,7 +270,6 @@ static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane pl
 					LOCAL_I915_FORMAT_MOD_Y_TILED,
 					&fb_565);
 			igt_assert(fb_565_id);
-			paint_squares(data, &fb_565, mode, IGT_ROTATION_0, plane);
 			igt_plane_set_fb(plane, &fb_565);
 			igt_plane_set_rotation(plane, data->rotation);
 			/* Shud fail because 90/270 is not supported with RGB565 */
-- 
2.3.5

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

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

* [PATCH i-g-t 5/7] kms_rotation_crc: Consolidate plane and cursor code paths
  2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
                   ` (3 preceding siblings ...)
  2015-04-22 15:46 ` [PATCH i-g-t 4/7] kms_rotation_crc: Negative test does not need to render anything Tvrtko Ursulin
@ 2015-04-22 15:46 ` Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 6/7] kms_rotation_crc: No need to square the buffer in paint Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases Tvrtko Ursulin
  6 siblings, 0 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

There can only be one, either a plane or a cursor, in each subtest so there
is no need for two framebuffer varilables and also some codepaths can be
unified.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
---
 tests/kms_rotation_crc.c | 150 ++++++++++++++++++++---------------------------
 1 file changed, 62 insertions(+), 88 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f871e2a..60819b3 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -34,81 +34,64 @@ typedef struct {
 	int gfx_fd;
 	igt_display_t display;
 	struct igt_fb fb;
-	struct igt_fb fb_cursor;
 	struct igt_fb fb_modeset;
 	igt_crc_t ref_crc;
 	igt_pipe_crc_t *pipe_crc;
 	igt_rotation_t rotation;
 	int pos_x;
 	int pos_y;
+	unsigned int w, h;
 } data_t;
 
 static void
-paint_squares(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
-	      igt_rotation_t rotation, igt_plane_t *plane)
+paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation,
+	      igt_plane_t *plane)
 {
 	cairo_t *cr;
-	int w, h;
+	unsigned int w = data->w;
+	unsigned int h = data->h;
 
-	if (plane->is_cursor) {
-		w = 128;
-		h = 128;
-		cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb_cursor);
+	cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
 
-		if (rotation == IGT_ROTATION_180) {
-			cairo_translate(cr, w, h);
-			cairo_rotate(cr, M_PI);
-		}
-
-		igt_paint_color(cr, 0, 0, w / 2, h / 2, .75, 0.5, 0.5);
-		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.5, .75, 0.5);
-		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.5, 0.5, .75);
-		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, .75, .75, .75);
-	} else {
-		w = mode->hdisplay;
-		h = mode->vdisplay;
-
-		cr = igt_get_cairo_ctx(data->gfx_fd, fb);
+	if (rotation == IGT_ROTATION_180) {
+		cairo_translate(cr, w, h);
+		cairo_rotate(cr, M_PI);
+	}
 
-		if (rotation == IGT_ROTATION_180) {
-			cairo_translate(cr, w, h);
-			cairo_rotate(cr, M_PI);
-		}
+	/*
+	 * "rotation" is used for creating ref rotated fb and
+	 * "data->rotation" is used to determine the required size
+	 * while creating unrotated fb.
+	 */
+	if (rotation == IGT_ROTATION_90) {
+		/* Paint 4 squares with width == height in Blue, Red,
+		Green, White Clockwise order to look like 90 degree rotated*/
+		w = h = mode->vdisplay;
+		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, 1.0);
+		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
+		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0);
+		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 1.0, 0.0);
+
+	} else if (rotation == IGT_ROTATION_270) {
+		/* Paint 4 squares with width == height in Green, White,
+		Blue, Red Clockwise order to look like 270 degree rotated*/
+		w = h = mode->vdisplay;
+		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
+		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 1.0, 1.0);
+		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 0.0, 0.0);
+		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0);
 
-		/*
-		 * "rotation" is used for creating ref rotated fb and
-		 * "data->rotation" is used to determine the required size
-		 * while creating unrotated fb.
-		 */
-		if (rotation == IGT_ROTATION_90) {
-			/* Paint 4 squares with width == height in Blue, Red,
-			Green, White Clockwise order to look like 90 degree rotated*/
-			w = h = mode->vdisplay;
-			igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, 1.0);
-			igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
-			igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0);
-			igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 1.0, 0.0);
-
-		} else if (rotation == IGT_ROTATION_270) {
-			/* Paint 4 squares with width == height in Green, White,
-			Blue, Red Clockwise order to look like 270 degree rotated*/
+	} else {
+		if (data->rotation == IGT_ROTATION_90 ||
+			data->rotation == IGT_ROTATION_270)
 			w = h = mode->vdisplay;
-			igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
-			igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 1.0, 1.0);
-			igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 0.0, 0.0);
-			igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0);
-
-		} else {
-			if (data->rotation == IGT_ROTATION_90 ||
-				data->rotation == IGT_ROTATION_270)
-				w = h = mode->vdisplay;
-			/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
-			igt_paint_color(cr, 0, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
-			igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
-			igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0);
-			igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0);
-		}
+		/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
+		igt_paint_color(cr, 0, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
+		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
+		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0);
+		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0);
 	}
+
 	cairo_destroy(cr);
 }
 
@@ -117,9 +100,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 {
 	drmModeModeInfo *mode;
 	igt_display_t *display = &data->display;
-	int fb_id, fb_cursor_id, fb_modeset_id;
-	int w, h;
+	int fb_id, fb_modeset_id;
+	unsigned int w, h;
 	uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
+	uint32_t pixel_format = DRM_FORMAT_XRGB8888;
 	enum igt_commit_style commit = COMMIT_LEGACY;
 	igt_plane_t *primary;
 
@@ -136,7 +120,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	fb_modeset_id = igt_create_fb(data->gfx_fd,
 				      w, h,
-				      DRM_FORMAT_XRGB8888,
+				      pixel_format,
 				      tiling,
 				      &data->fb_modeset);
 	igt_assert(fb_modeset_id);
@@ -157,35 +141,31 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	 * frame can fit in
 	 */
 	if (data->rotation == IGT_ROTATION_90 ||
-		data->rotation == IGT_ROTATION_270) {
+	    data->rotation == IGT_ROTATION_270) {
 		tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
 		w = h =  mode->vdisplay;
+	} else if (plane->is_cursor) {
+		pixel_format = DRM_FORMAT_ARGB8888;
+		w = h = 128;
 	}
 
+	data->w = w;
+	data->h = h;
+
 	fb_id = igt_create_fb(data->gfx_fd,
-			w, h,
-			DRM_FORMAT_XRGB8888,
-			tiling,
-			&data->fb);
+			      w, h,
+			      pixel_format,
+			      tiling,
+			      &data->fb);
 	igt_assert(fb_id);
 
-	fb_cursor_id = igt_create_fb(data->gfx_fd,
-				     128, 128,
-				     DRM_FORMAT_ARGB8888,
-				     LOCAL_DRM_FORMAT_MOD_NONE,
-				     &data->fb_cursor);
-	igt_assert(fb_cursor_id);
-
 	/* Step 1: create a reference CRC for a software-rotated fb */
 
-	if (plane->is_cursor) {
-		paint_squares(data, &data->fb_cursor, mode, data->rotation, plane);
-		igt_plane_set_fb(plane, &data->fb_cursor);
-	} else {
-		paint_squares(data, &data->fb, mode, data->rotation, plane);
-		igt_plane_set_fb(plane, &data->fb);
+	paint_squares(data, mode, data->rotation, plane);
+	igt_plane_set_fb(plane, &data->fb);
+	if (!plane->is_cursor)
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
-	}
+
 	if (plane->is_primary || plane->is_cursor) {
 		igt_require(data->display.has_universal_planes);
 		commit = COMMIT_UNIVERSAL;
@@ -198,13 +178,8 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	 * Step 2: prepare the plane with an non-rotated fb let the hw
 	 * rotate it.
 	 */
-	if (plane->is_cursor) {
-		paint_squares(data, &data->fb_cursor, mode, IGT_ROTATION_0, plane);
-		igt_plane_set_fb(plane, &data->fb_cursor);
-	} else {
-		paint_squares(data, &data->fb, mode, IGT_ROTATION_0, plane);
-		igt_plane_set_fb(plane, &data->fb);
-	}
+	paint_squares(data, mode, IGT_ROTATION_0, plane);
+	igt_plane_set_fb(plane, &data->fb);
 }
 
 static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
@@ -215,7 +190,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 	data->pipe_crc = NULL;
 
 	igt_remove_fb(data->gfx_fd, &data->fb);
-	igt_remove_fb(data->gfx_fd, &data->fb_cursor);
 	igt_remove_fb(data->gfx_fd, &data->fb_modeset);
 
 	/* XXX: see the note in prepare_crtc() */
-- 
2.3.5

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

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

* [PATCH i-g-t 6/7] kms_rotation_crc: No need to square the buffer in paint
  2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
                   ` (4 preceding siblings ...)
  2015-04-22 15:46 ` [PATCH i-g-t 5/7] kms_rotation_crc: Consolidate plane and cursor code paths Tvrtko Ursulin
@ 2015-04-22 15:46 ` Tvrtko Ursulin
  2015-04-22 15:46 ` [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases Tvrtko Ursulin
  6 siblings, 0 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Now that size is calculated in a single place and correct geometry passed in,
paint squares does not need to concern itself with it.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
---
 tests/kms_rotation_crc.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 60819b3..45a9284 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -58,15 +58,9 @@ paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation,
 		cairo_rotate(cr, M_PI);
 	}
 
-	/*
-	 * "rotation" is used for creating ref rotated fb and
-	 * "data->rotation" is used to determine the required size
-	 * while creating unrotated fb.
-	 */
 	if (rotation == IGT_ROTATION_90) {
 		/* Paint 4 squares with width == height in Blue, Red,
 		Green, White Clockwise order to look like 90 degree rotated*/
-		w = h = mode->vdisplay;
 		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, 1.0);
 		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
 		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0);
@@ -75,16 +69,12 @@ paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation,
 	} else if (rotation == IGT_ROTATION_270) {
 		/* Paint 4 squares with width == height in Green, White,
 		Blue, Red Clockwise order to look like 270 degree rotated*/
-		w = h = mode->vdisplay;
 		igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
 		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 1.0, 1.0);
 		igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 0.0, 0.0);
 		igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0);
 
 	} else {
-		if (data->rotation == IGT_ROTATION_90 ||
-			data->rotation == IGT_ROTATION_270)
-			w = h = mode->vdisplay;
 		/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
 		igt_paint_color(cr, 0, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
 		igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
-- 
2.3.5

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

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

* [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases
  2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
                   ` (5 preceding siblings ...)
  2015-04-22 15:46 ` [PATCH i-g-t 6/7] kms_rotation_crc: No need to square the buffer in paint Tvrtko Ursulin
@ 2015-04-22 15:46 ` Tvrtko Ursulin
  2015-04-23  9:41   ` Jindal, Sonika
  6 siblings, 1 reply; 10+ messages in thread
From: Tvrtko Ursulin @ 2015-04-22 15:46 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Saves a good amount of code duplication by supporting expected
failures from the main loop.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
---
 tests/kms_rotation_crc.c | 106 +++++++++++++++--------------------------------
 1 file changed, 33 insertions(+), 73 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 45a9284..0661b6b 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -41,6 +41,8 @@ typedef struct {
 	int pos_x;
 	int pos_y;
 	unsigned int w, h;
+	uint32_t override_fmt;
+	uint64_t override_tiling;
 } data_t;
 
 static void
@@ -92,8 +94,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	igt_display_t *display = &data->display;
 	int fb_id, fb_modeset_id;
 	unsigned int w, h;
-	uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
-	uint32_t pixel_format = DRM_FORMAT_XRGB8888;
+	uint64_t tiling = data->override_tiling ?
+			  data->override_tiling : LOCAL_DRM_FORMAT_MOD_NONE;
+	uint32_t pixel_format = data->override_fmt ?
+				data->override_fmt : DRM_FORMAT_XRGB8888;
 	enum igt_commit_style commit = COMMIT_LEGACY;
 	igt_plane_t *primary;
 
@@ -132,10 +136,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	 */
 	if (data->rotation == IGT_ROTATION_90 ||
 	    data->rotation == IGT_ROTATION_270) {
-		tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+		tiling = data->override_tiling ?
+			 data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED;
 		w = h =  mode->vdisplay;
 	} else if (plane->is_cursor) {
-		pixel_format = DRM_FORMAT_ARGB8888;
+		pixel_format = data->override_fmt ?
+			       data->override_fmt : DRM_FORMAT_ARGB8888;
 		w = h = 128;
 	}
 
@@ -196,67 +202,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 	igt_display_commit(display);
 }
 
-static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane plane_type)
-{
-	drmModeModeInfo *mode;
-	igt_display_t *display = &data->display;
-	igt_output_t *output;
-	enum pipe pipe;
-	int fb_tiling_id, fb_565_id;
-	struct igt_fb fb_565, fb_tiling;
-
-	for_each_connected_output(display, output) {
-		for_each_pipe(display, pipe) {
-			igt_plane_t *plane;
-
-			igt_output_set_pipe(output, pipe);
-
-			plane = igt_output_get_plane(output, plane_type);
-			igt_require(igt_plane_supports_rotation(plane));
-			mode = igt_output_get_mode(output);
-
-			fb_tiling_id = igt_create_fb(data->gfx_fd,
-					mode->hdisplay, mode->vdisplay,
-					DRM_FORMAT_XRGB8888,
-					LOCAL_DRM_FORMAT_MOD_NONE,
-					&fb_tiling);
-			igt_assert(fb_tiling_id);
-			igt_plane_set_fb(plane, &fb_tiling);
-			/* For the first modeset with legacy commit */
-			igt_display_commit(display);
-			igt_plane_set_rotation(plane, data->rotation);
-			/* Shud fail because 90/270 is only supported with Y/Yf */
-			igt_assert(igt_display_try_commit2(display, COMMIT_UNIVERSAL) == -EINVAL);
-
-			fb_565_id = igt_create_fb(data->gfx_fd,
-					mode->hdisplay, mode->vdisplay,
-					DRM_FORMAT_RGB565,
-					LOCAL_I915_FORMAT_MOD_Y_TILED,
-					&fb_565);
-			igt_assert(fb_565_id);
-			igt_plane_set_fb(plane, &fb_565);
-			igt_plane_set_rotation(plane, data->rotation);
-			/* Shud fail because 90/270 is not supported with RGB565 */
-			igt_assert(igt_display_try_commit2(display, COMMIT_UNIVERSAL) == -EINVAL);
-
-			/*
-			 * check the rotation state has been reset when the VT
-			 * mode is restored
-			 */
-			kmstest_restore_vt_mode();
-			kmstest_set_vt_graphics_mode();
-			prepare_crtc(data, output, pipe, plane);
-
-			igt_remove_fb(data->gfx_fd, &fb_tiling);
-			igt_remove_fb(data->gfx_fd, &fb_565);
-			cleanup_crtc(data, output, plane);
-
-			igt_display_commit(display);
-
-		}
-	}
-}
-
 static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 {
 	igt_display_t *display = &data->display;
@@ -265,6 +210,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 	int valid_tests = 0;
 	igt_crc_t crc_output, crc_unrotated;
 	enum igt_commit_style commit = COMMIT_LEGACY;
+	int ret;
 
 	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
 		igt_require(data->display.has_universal_planes);
@@ -288,11 +234,16 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated);
 
 			igt_plane_set_rotation(plane, data->rotation);
-			igt_display_commit2(display, commit);
-
-			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
-
-			igt_assert_crc_equal(&data->ref_crc, &crc_output);
+			ret = igt_display_try_commit2(display, commit);
+			if (data->override_fmt || data->override_tiling) {
+				igt_assert(ret == -EINVAL);
+			} else {
+				igt_assert(ret == 0);
+				igt_pipe_crc_collect_crc(data->pipe_crc,
+							 &crc_output);
+				igt_assert_crc_equal(&data->ref_crc,
+						     &crc_output);
+			}
 
 			/*
 			 * check the rotation state has been reset when the VT
@@ -376,12 +327,21 @@ igt_main
 		test_plane_rotation(&data, IGT_PLANE_2);
 	}
 
-	igt_subtest_f("90-rotation-unsupported-tiling-pixel-format") {
+	igt_subtest_f("bad-pixel-format") {
 		igt_require(gen >= 9);
-		data.rotation = IGT_ROTATION_90;
 		data.pos_x = 0,
 		data.pos_y = 0;
-		test_unsupported_tiling_pixel_format(&data, IGT_PLANE_PRIMARY);
+		data.rotation = IGT_ROTATION_90;
+		data.override_fmt = DRM_FORMAT_RGB565;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+	}
+
+	igt_subtest_f("bad-tiling") {
+		igt_require(gen >= 9);
+		data.override_fmt = 0;
+		data.rotation = IGT_ROTATION_90;
+		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
 	}
 
 	igt_fixture {
-- 
2.3.5

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

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

* Re: [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases
  2015-04-22 15:46 ` [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases Tvrtko Ursulin
@ 2015-04-23  9:41   ` Jindal, Sonika
  2015-04-27 17:30     ` Thomas Wood
  0 siblings, 1 reply; 10+ messages in thread
From: Jindal, Sonika @ 2015-04-23  9:41 UTC (permalink / raw)
  To: Tvrtko Ursulin, Intel-gfx

Thanks Tvrtko.
This series makes kms_rotation_crc much cleaner :)

Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>


On 4/22/2015 9:16 PM, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Saves a good amount of code duplication by supporting expected
> failures from the main loop.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Sonika Jindal <sonika.jindal@intel.com>
> ---
>   tests/kms_rotation_crc.c | 106 +++++++++++++++--------------------------------
>   1 file changed, 33 insertions(+), 73 deletions(-)
>
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 45a9284..0661b6b 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -41,6 +41,8 @@ typedef struct {
>   	int pos_x;
>   	int pos_y;
>   	unsigned int w, h;
> +	uint32_t override_fmt;
> +	uint64_t override_tiling;
>   } data_t;
>
>   static void
> @@ -92,8 +94,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
>   	igt_display_t *display = &data->display;
>   	int fb_id, fb_modeset_id;
>   	unsigned int w, h;
> -	uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> -	uint32_t pixel_format = DRM_FORMAT_XRGB8888;
> +	uint64_t tiling = data->override_tiling ?
> +			  data->override_tiling : LOCAL_DRM_FORMAT_MOD_NONE;
> +	uint32_t pixel_format = data->override_fmt ?
> +				data->override_fmt : DRM_FORMAT_XRGB8888;
>   	enum igt_commit_style commit = COMMIT_LEGACY;
>   	igt_plane_t *primary;
>
> @@ -132,10 +136,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
>   	 */
>   	if (data->rotation == IGT_ROTATION_90 ||
>   	    data->rotation == IGT_ROTATION_270) {
> -		tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> +		tiling = data->override_tiling ?
> +			 data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED;
>   		w = h =  mode->vdisplay;
>   	} else if (plane->is_cursor) {
> -		pixel_format = DRM_FORMAT_ARGB8888;
> +		pixel_format = data->override_fmt ?
> +			       data->override_fmt : DRM_FORMAT_ARGB8888;
>   		w = h = 128;
>   	}
>
> @@ -196,67 +202,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
>   	igt_display_commit(display);
>   }
>
> -static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane plane_type)
> -{
> -	drmModeModeInfo *mode;
> -	igt_display_t *display = &data->display;
> -	igt_output_t *output;
> -	enum pipe pipe;
> -	int fb_tiling_id, fb_565_id;
> -	struct igt_fb fb_565, fb_tiling;
> -
> -	for_each_connected_output(display, output) {
> -		for_each_pipe(display, pipe) {
> -			igt_plane_t *plane;
> -
> -			igt_output_set_pipe(output, pipe);
> -
> -			plane = igt_output_get_plane(output, plane_type);
> -			igt_require(igt_plane_supports_rotation(plane));
> -			mode = igt_output_get_mode(output);
> -
> -			fb_tiling_id = igt_create_fb(data->gfx_fd,
> -					mode->hdisplay, mode->vdisplay,
> -					DRM_FORMAT_XRGB8888,
> -					LOCAL_DRM_FORMAT_MOD_NONE,
> -					&fb_tiling);
> -			igt_assert(fb_tiling_id);
> -			igt_plane_set_fb(plane, &fb_tiling);
> -			/* For the first modeset with legacy commit */
> -			igt_display_commit(display);
> -			igt_plane_set_rotation(plane, data->rotation);
> -			/* Shud fail because 90/270 is only supported with Y/Yf */
> -			igt_assert(igt_display_try_commit2(display, COMMIT_UNIVERSAL) == -EINVAL);
> -
> -			fb_565_id = igt_create_fb(data->gfx_fd,
> -					mode->hdisplay, mode->vdisplay,
> -					DRM_FORMAT_RGB565,
> -					LOCAL_I915_FORMAT_MOD_Y_TILED,
> -					&fb_565);
> -			igt_assert(fb_565_id);
> -			igt_plane_set_fb(plane, &fb_565);
> -			igt_plane_set_rotation(plane, data->rotation);
> -			/* Shud fail because 90/270 is not supported with RGB565 */
> -			igt_assert(igt_display_try_commit2(display, COMMIT_UNIVERSAL) == -EINVAL);
> -
> -			/*
> -			 * check the rotation state has been reset when the VT
> -			 * mode is restored
> -			 */
> -			kmstest_restore_vt_mode();
> -			kmstest_set_vt_graphics_mode();
> -			prepare_crtc(data, output, pipe, plane);
> -
> -			igt_remove_fb(data->gfx_fd, &fb_tiling);
> -			igt_remove_fb(data->gfx_fd, &fb_565);
> -			cleanup_crtc(data, output, plane);
> -
> -			igt_display_commit(display);
> -
> -		}
> -	}
> -}
> -
>   static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
>   {
>   	igt_display_t *display = &data->display;
> @@ -265,6 +210,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
>   	int valid_tests = 0;
>   	igt_crc_t crc_output, crc_unrotated;
>   	enum igt_commit_style commit = COMMIT_LEGACY;
> +	int ret;
>
>   	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
>   		igt_require(data->display.has_universal_planes);
> @@ -288,11 +234,16 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
>   			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated);
>
>   			igt_plane_set_rotation(plane, data->rotation);
> -			igt_display_commit2(display, commit);
> -
> -			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
> -
> -			igt_assert_crc_equal(&data->ref_crc, &crc_output);
> +			ret = igt_display_try_commit2(display, commit);
> +			if (data->override_fmt || data->override_tiling) {
> +				igt_assert(ret == -EINVAL);
> +			} else {
> +				igt_assert(ret == 0);
> +				igt_pipe_crc_collect_crc(data->pipe_crc,
> +							 &crc_output);
> +				igt_assert_crc_equal(&data->ref_crc,
> +						     &crc_output);
> +			}
>
>   			/*
>   			 * check the rotation state has been reset when the VT
> @@ -376,12 +327,21 @@ igt_main
>   		test_plane_rotation(&data, IGT_PLANE_2);
>   	}
>
> -	igt_subtest_f("90-rotation-unsupported-tiling-pixel-format") {
> +	igt_subtest_f("bad-pixel-format") {
>   		igt_require(gen >= 9);
> -		data.rotation = IGT_ROTATION_90;
>   		data.pos_x = 0,
>   		data.pos_y = 0;
> -		test_unsupported_tiling_pixel_format(&data, IGT_PLANE_PRIMARY);
> +		data.rotation = IGT_ROTATION_90;
> +		data.override_fmt = DRM_FORMAT_RGB565;
> +		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
> +	}
> +
> +	igt_subtest_f("bad-tiling") {
> +		igt_require(gen >= 9);
> +		data.override_fmt = 0;
> +		data.rotation = IGT_ROTATION_90;
> +		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> +		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
>   	}
>
>   	igt_fixture {
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases
  2015-04-23  9:41   ` Jindal, Sonika
@ 2015-04-27 17:30     ` Thomas Wood
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Wood @ 2015-04-27 17:30 UTC (permalink / raw)
  To: Jindal, Sonika; +Cc: Intel Graphics Development

On 23 April 2015 at 10:41, Jindal, Sonika <sonika.jindal@intel.com> wrote:
> Thanks Tvrtko.
> This series makes kms_rotation_crc much cleaner :)
>
> Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>

Thanks, I've pushed the whole series.


>
>
>
> On 4/22/2015 9:16 PM, Tvrtko Ursulin wrote:
>>
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Saves a good amount of code duplication by supporting expected
>> failures from the main loop.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Sonika Jindal <sonika.jindal@intel.com>
>> ---
>>   tests/kms_rotation_crc.c | 106
>> +++++++++++++++--------------------------------
>>   1 file changed, 33 insertions(+), 73 deletions(-)
>>
>> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
>> index 45a9284..0661b6b 100644
>> --- a/tests/kms_rotation_crc.c
>> +++ b/tests/kms_rotation_crc.c
>> @@ -41,6 +41,8 @@ typedef struct {
>>         int pos_x;
>>         int pos_y;
>>         unsigned int w, h;
>> +       uint32_t override_fmt;
>> +       uint64_t override_tiling;
>>   } data_t;
>>
>>   static void
>> @@ -92,8 +94,10 @@ static void prepare_crtc(data_t *data, igt_output_t
>> *output, enum pipe pipe,
>>         igt_display_t *display = &data->display;
>>         int fb_id, fb_modeset_id;
>>         unsigned int w, h;
>> -       uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
>> -       uint32_t pixel_format = DRM_FORMAT_XRGB8888;
>> +       uint64_t tiling = data->override_tiling ?
>> +                         data->override_tiling :
>> LOCAL_DRM_FORMAT_MOD_NONE;
>> +       uint32_t pixel_format = data->override_fmt ?
>> +                               data->override_fmt : DRM_FORMAT_XRGB8888;
>>         enum igt_commit_style commit = COMMIT_LEGACY;
>>         igt_plane_t *primary;
>>
>> @@ -132,10 +136,12 @@ static void prepare_crtc(data_t *data, igt_output_t
>> *output, enum pipe pipe,
>>          */
>>         if (data->rotation == IGT_ROTATION_90 ||
>>             data->rotation == IGT_ROTATION_270) {
>> -               tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
>> +               tiling = data->override_tiling ?
>> +                        data->override_tiling :
>> LOCAL_I915_FORMAT_MOD_Y_TILED;
>>                 w = h =  mode->vdisplay;
>>         } else if (plane->is_cursor) {
>> -               pixel_format = DRM_FORMAT_ARGB8888;
>> +               pixel_format = data->override_fmt ?
>> +                              data->override_fmt : DRM_FORMAT_ARGB8888;
>>                 w = h = 128;
>>         }
>>
>> @@ -196,67 +202,6 @@ static void cleanup_crtc(data_t *data, igt_output_t
>> *output, igt_plane_t *plane)
>>         igt_display_commit(display);
>>   }
>>
>> -static void test_unsupported_tiling_pixel_format(data_t *data, enum
>> igt_plane plane_type)
>> -{
>> -       drmModeModeInfo *mode;
>> -       igt_display_t *display = &data->display;
>> -       igt_output_t *output;
>> -       enum pipe pipe;
>> -       int fb_tiling_id, fb_565_id;
>> -       struct igt_fb fb_565, fb_tiling;
>> -
>> -       for_each_connected_output(display, output) {
>> -               for_each_pipe(display, pipe) {
>> -                       igt_plane_t *plane;
>> -
>> -                       igt_output_set_pipe(output, pipe);
>> -
>> -                       plane = igt_output_get_plane(output, plane_type);
>> -                       igt_require(igt_plane_supports_rotation(plane));
>> -                       mode = igt_output_get_mode(output);
>> -
>> -                       fb_tiling_id = igt_create_fb(data->gfx_fd,
>> -                                       mode->hdisplay, mode->vdisplay,
>> -                                       DRM_FORMAT_XRGB8888,
>> -                                       LOCAL_DRM_FORMAT_MOD_NONE,
>> -                                       &fb_tiling);
>> -                       igt_assert(fb_tiling_id);
>> -                       igt_plane_set_fb(plane, &fb_tiling);
>> -                       /* For the first modeset with legacy commit */
>> -                       igt_display_commit(display);
>> -                       igt_plane_set_rotation(plane, data->rotation);
>> -                       /* Shud fail because 90/270 is only supported with
>> Y/Yf */
>> -                       igt_assert(igt_display_try_commit2(display,
>> COMMIT_UNIVERSAL) == -EINVAL);
>> -
>> -                       fb_565_id = igt_create_fb(data->gfx_fd,
>> -                                       mode->hdisplay, mode->vdisplay,
>> -                                       DRM_FORMAT_RGB565,
>> -                                       LOCAL_I915_FORMAT_MOD_Y_TILED,
>> -                                       &fb_565);
>> -                       igt_assert(fb_565_id);
>> -                       igt_plane_set_fb(plane, &fb_565);
>> -                       igt_plane_set_rotation(plane, data->rotation);
>> -                       /* Shud fail because 90/270 is not supported with
>> RGB565 */
>> -                       igt_assert(igt_display_try_commit2(display,
>> COMMIT_UNIVERSAL) == -EINVAL);
>> -
>> -                       /*
>> -                        * check the rotation state has been reset when
>> the VT
>> -                        * mode is restored
>> -                        */
>> -                       kmstest_restore_vt_mode();
>> -                       kmstest_set_vt_graphics_mode();
>> -                       prepare_crtc(data, output, pipe, plane);
>> -
>> -                       igt_remove_fb(data->gfx_fd, &fb_tiling);
>> -                       igt_remove_fb(data->gfx_fd, &fb_565);
>> -                       cleanup_crtc(data, output, plane);
>> -
>> -                       igt_display_commit(display);
>> -
>> -               }
>> -       }
>> -}
>> -
>>   static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
>>   {
>>         igt_display_t *display = &data->display;
>> @@ -265,6 +210,7 @@ static void test_plane_rotation(data_t *data, enum
>> igt_plane plane_type)
>>         int valid_tests = 0;
>>         igt_crc_t crc_output, crc_unrotated;
>>         enum igt_commit_style commit = COMMIT_LEGACY;
>> +       int ret;
>>
>>         if (plane_type == IGT_PLANE_PRIMARY || plane_type ==
>> IGT_PLANE_CURSOR) {
>>                 igt_require(data->display.has_universal_planes);
>> @@ -288,11 +234,16 @@ static void test_plane_rotation(data_t *data, enum
>> igt_plane plane_type)
>>                         igt_pipe_crc_collect_crc(data->pipe_crc,
>> &crc_unrotated);
>>
>>                         igt_plane_set_rotation(plane, data->rotation);
>> -                       igt_display_commit2(display, commit);
>> -
>> -                       igt_pipe_crc_collect_crc(data->pipe_crc,
>> &crc_output);
>> -
>> -                       igt_assert_crc_equal(&data->ref_crc, &crc_output);
>> +                       ret = igt_display_try_commit2(display, commit);
>> +                       if (data->override_fmt || data->override_tiling) {
>> +                               igt_assert(ret == -EINVAL);
>> +                       } else {
>> +                               igt_assert(ret == 0);
>> +                               igt_pipe_crc_collect_crc(data->pipe_crc,
>> +                                                        &crc_output);
>> +                               igt_assert_crc_equal(&data->ref_crc,
>> +                                                    &crc_output);
>> +                       }
>>
>>                         /*
>>                          * check the rotation state has been reset when
>> the VT
>> @@ -376,12 +327,21 @@ igt_main
>>                 test_plane_rotation(&data, IGT_PLANE_2);
>>         }
>>
>> -       igt_subtest_f("90-rotation-unsupported-tiling-pixel-format") {
>> +       igt_subtest_f("bad-pixel-format") {
>>                 igt_require(gen >= 9);
>> -               data.rotation = IGT_ROTATION_90;
>>                 data.pos_x = 0,
>>                 data.pos_y = 0;
>> -               test_unsupported_tiling_pixel_format(&data,
>> IGT_PLANE_PRIMARY);
>> +               data.rotation = IGT_ROTATION_90;
>> +               data.override_fmt = DRM_FORMAT_RGB565;
>> +               test_plane_rotation(&data, IGT_PLANE_PRIMARY);
>> +       }
>> +
>> +       igt_subtest_f("bad-tiling") {
>> +               igt_require(gen >= 9);
>> +               data.override_fmt = 0;
>> +               data.rotation = IGT_ROTATION_90;
>> +               data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
>> +               test_plane_rotation(&data, IGT_PLANE_PRIMARY);
>>         }
>>
>>         igt_fixture {
>>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2015-04-27 17:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-22 15:46 [PATCH i-g-t 0/7] kms_rotation_crc cleanups Tvrtko Ursulin
2015-04-22 15:46 ` [PATCH i-g-t 1/7] kms_rotation_crc: Local framebuffers do not need to be global Tvrtko Ursulin
2015-04-22 15:46 ` [PATCH i-g-t 2/7] kms_rotation_crc: Framebuffer used for initial modeset does not need to be painted Tvrtko Ursulin
2015-04-22 15:46 ` [PATCH i-g-t 3/7] kms_rotation_crc: Remove unused variable in negative test Tvrtko Ursulin
2015-04-22 15:46 ` [PATCH i-g-t 4/7] kms_rotation_crc: Negative test does not need to render anything Tvrtko Ursulin
2015-04-22 15:46 ` [PATCH i-g-t 5/7] kms_rotation_crc: Consolidate plane and cursor code paths Tvrtko Ursulin
2015-04-22 15:46 ` [PATCH i-g-t 6/7] kms_rotation_crc: No need to square the buffer in paint Tvrtko Ursulin
2015-04-22 15:46 ` [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases Tvrtko Ursulin
2015-04-23  9:41   ` Jindal, Sonika
2015-04-27 17:30     ` Thomas Wood

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