All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations.
@ 2018-02-01 15:39 Maarten Lankhorst
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code Maarten Lankhorst
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

Some cleanups and adding NV12 support to kms_plane_scaling.

The cleanups to kms_rotation_crc will make it easier to test each pixel
format later on.

Maarten Lankhorst (9):
  tests/kms_panel_fitting: Remove dead code
  tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch.
  tests/kms_plane_scaling: Test all pixel formats in
    pipe-*-scaler-with-rotation
  tests/kms_plane_scaling: Test all pixel formats with clamping and
    clipping too
  tests/kms_rotation_crc: Fix bad-tiling testcase.
  tests/kms_rotation_crc: Move bad_format parameter to
    test_plane_rotation
  tests/kms_rotation_crc: Always run the flip tests when available.
  tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled.
  tests/kms_rotation_crc: Perform lazy cleanup and require atomic.

 tests/kms_atomic.c        |   8 +
 tests/kms_panel_fitting.c |  52 ++----
 tests/kms_plane_scaling.c | 107 ++++++++----
 tests/kms_rotation_crc.c  | 415 ++++++++++++----------------------------------
 4 files changed, 198 insertions(+), 384 deletions(-)

-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-05 10:50   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 2/9] tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch Maarten Lankhorst
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

fb3 is unused, and fb_id1/2 are also set in igt_framebuffer, so
it doesn't need separate member values.

image_w/h are also unused and create_fb will always succeed, so
more elimination of dead code.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_panel_fitting.c | 52 +++++++++++++++--------------------------------
 1 file changed, 16 insertions(+), 36 deletions(-)

diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index e4ea355611c3..e0ca6cca8e6a 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -32,15 +32,8 @@ typedef struct {
 	int drm_fd;
 	igt_display_t display;
 
-	int image_w;
-	int image_h;
-
 	struct igt_fb fb1;
 	struct igt_fb fb2;
-	struct igt_fb fb3;
-	int fb_id1;
-	int fb_id2;
-	int fb_id3;
 
 	igt_plane_t *plane1;
 	igt_plane_t *plane2;
@@ -58,18 +51,17 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	igt_output_set_pipe(output, pipe);
 
 	/* before allocating, free if any older fb */
-	if (data->fb_id1) {
+	if (data->fb1.fb_id) {
 		igt_remove_fb(data->drm_fd, &data->fb1);
-		data->fb_id1 = 0;
+		data->fb1.fb_id = 0;
 	}
 
 	/* allocate fb for plane 1 */
-	data->fb_id1 = igt_create_pattern_fb(data->drm_fd,
-						mode->hdisplay, mode->vdisplay,
-						DRM_FORMAT_XRGB8888,
-						LOCAL_DRM_FORMAT_MOD_NONE,
-						&data->fb1);
-	igt_assert(data->fb_id1);
+	igt_create_pattern_fb(data->drm_fd,
+			      mode->hdisplay, mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &data->fb1);
 
 	/*
 	 * We always set the primary plane to actually enable the pipe as
@@ -91,17 +83,13 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 
-	if (data->fb_id1) {
+	if (data->fb1.fb_id) {
 		igt_remove_fb(data->drm_fd, &data->fb1);
-		data->fb_id1 = 0;
+		data->fb1.fb_id = 0;
 	}
-	if (data->fb_id2) {
+	if (data->fb2.fb_id) {
 		igt_remove_fb(data->drm_fd, &data->fb2);
-		data->fb_id2 = 0;
-	}
-	if (data->fb_id3) {
-		igt_remove_fb(data->drm_fd, &data->fb3);
-		data->fb_id3 = 0;
+		data->fb2.fb_id = 0;
 	}
 
 	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
@@ -121,7 +109,6 @@ static void test_panel_fitting(data_t *d)
 {
 	igt_display_t *display = &d->display;
 	igt_output_t *output;
-	cairo_surface_t *image;
 	enum pipe pipe;
 	int valid_tests = 0;
 
@@ -146,18 +133,11 @@ static void test_panel_fitting(data_t *d)
 		mode = igt_output_get_mode(output);
 		native_mode = *mode;
 
-		/* allocate fb2 with image size */
-		image = igt_cairo_image_surface_create_from_png(FILE_NAME);
-		igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
-		d->image_w = cairo_image_surface_get_width(image);
-		d->image_h = cairo_image_surface_get_height(image);
-		cairo_surface_destroy(image);
-
-		d->fb_id2 = igt_create_image_fb(d->drm_fd, 0, 0,
-						DRM_FORMAT_XRGB8888,
-						LOCAL_DRM_FORMAT_MOD_NONE,
-						FILE_NAME, &d->fb2);
-		igt_assert(d->fb_id2);
+		/* allocate fb2 with image */
+		igt_create_image_fb(d->drm_fd, 0, 0,
+				    DRM_FORMAT_XRGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    FILE_NAME, &d->fb2);
 
 		/* Set up display to enable panel fitting */
 		mode->hdisplay = 640;
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 2/9] tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch.
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-05 10:53   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation Maarten Lankhorst
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

This check was missing, and caused a WARN_ON that dates back to
the original design of atomic.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
Sent to see if it passes shards, doesn't need to be reviewed further.

 tests/kms_atomic.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 9204d7e18698..2e21b53b8c87 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -485,6 +485,10 @@ static void plane_invalid_params(igt_pipe_t *pipe,
 	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, pipe->values[IGT_CRTC_MODE_ID]);
 	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
 
+	/* Valid, but invalid because CRTC_ID is set. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0);
+	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
+
 	igt_plane_set_fb(plane, fb);
 	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
 
@@ -501,6 +505,10 @@ static void plane_invalid_params(igt_pipe_t *pipe,
 	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, pipe->values[IGT_CRTC_MODE_ID]);
 	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
 
+	/* Valid, but invalid because FB_ID is set. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0);
+	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
+
 	igt_plane_set_fb(plane, fb);
 	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
 
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code Maarten Lankhorst
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 2/9] tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-05 11:14   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 4/9] tests/kms_plane_scaling: Test all pixel formats with clamping and clipping too Maarten Lankhorst
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

This will allow us to test NV12 as well, when available.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_plane_scaling.c | 46 +++++++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index d32f3441e8c9..18a42035fb3e 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -164,25 +164,13 @@ static const igt_rotation_t rotations[] = {
 	IGT_ROTATION_270,
 };
 
-static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
-					   igt_output_t *output)
+static bool can_rotate(unsigned format)
 {
-	igt_display_t *display = &d->display;
-	igt_plane_t *plane;
-
-	igt_output_set_pipe(output, pipe);
-	for_each_plane_on_pipe(display, pipe, plane) {
-		if (plane->type == DRM_PLANE_TYPE_CURSOR)
-			continue;
+	if (format == DRM_FORMAT_C8 ||
+	    format == DRM_FORMAT_RGB565)
+		return false;
 
-		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
-			igt_rotation_t rot = rotations[i];
-
-			check_scaling_pipe_plane_rot(d, plane, DRM_FORMAT_XRGB8888,
-						     LOCAL_I915_FORMAT_MOD_Y_TILED,
-						     pipe, output, rot);
-		}
-	}
+	return true;
 }
 
 static bool can_draw(uint32_t drm_format)
@@ -199,6 +187,30 @@ static bool can_draw(uint32_t drm_format)
 	return false;
 }
 
+static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
+					   igt_output_t *output)
+{
+	igt_display_t *display = &d->display;
+	igt_plane_t *plane;
+
+	igt_output_set_pipe(output, pipe);
+	for_each_plane_on_pipe(display, pipe, plane) {
+		if (plane->type == DRM_PLANE_TYPE_CURSOR)
+			continue;
+
+		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
+			igt_rotation_t rot = rotations[i];
+			for (int j = 0; j < plane->drm_plane->count_formats; j++) {
+				unsigned format = plane->drm_plane->formats[j];
+				if (can_draw(format) && can_rotate(format))
+					check_scaling_pipe_plane_rot(d, plane, format,
+								     LOCAL_I915_FORMAT_MOD_Y_TILED,
+								     pipe, output, rot);
+			}
+		}
+	}
+}
+
 static const uint64_t tilings[] = {
 	LOCAL_DRM_FORMAT_MOD_NONE,
 	LOCAL_I915_FORMAT_MOD_X_TILED,
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 4/9] tests/kms_plane_scaling: Test all pixel formats with clamping and clipping too
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (2 preceding siblings ...)
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-05 11:47   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 5/9] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

Run across all combinations of pixel formats to ensure better testing.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_plane_scaling.c | 61 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 43 insertions(+), 18 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 18a42035fb3e..208f9262f84b 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -58,14 +58,10 @@ static int get_num_scalers(uint32_t devid, enum pipe pipe)
 		return 1;
 }
 
-static void cleanup_crtc(data_t *data)
+static void cleanup_fbs(data_t *data)
 {
 	int i;
 
-	igt_display_reset(&data->display);
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = NULL;
-
 	for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
 		if (!data->fb[i].fb_id)
 			continue;
@@ -75,6 +71,15 @@ static void cleanup_crtc(data_t *data)
 	}
 }
 
+static void cleanup_crtc(data_t *data)
+{
+	igt_display_reset(&data->display);
+	igt_pipe_crc_free(data->pipe_crc);
+	data->pipe_crc = NULL;
+
+	cleanup_fbs(data);
+}
+
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 			igt_plane_t *plane, drmModeModeInfo *mode)
 {
@@ -401,28 +406,20 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 }
 
 static void
-test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_output_t *output)
+__test_scaler_with_clipping_clamping_scenario(data_t *d, drmModeModeInfo *mode,
+					      uint32_t f1, uint32_t f2)
 {
-	drmModeModeInfo *mode;
-
-	igt_require(get_num_scalers(d->devid, pipe) >= 2);
-
-	mode = igt_output_get_mode(output);
-	d->plane1 = &d->display.pipes[pipe].planes[0];
-	prepare_crtc(d, output, pipe, d->plane1, mode);
+	cleanup_fbs(d);
 
 	igt_create_pattern_fb(d->drm_fd,
-			      mode->hdisplay, mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
+			      mode->hdisplay, mode->vdisplay, f1,
 			      LOCAL_I915_FORMAT_MOD_X_TILED, &d->fb[1]);
 
 	igt_create_pattern_fb(d->drm_fd,
-			      mode->hdisplay, mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
+			      mode->hdisplay, mode->vdisplay, f2,
 			      LOCAL_I915_FORMAT_MOD_Y_TILED, &d->fb[2]);
 
 	igt_plane_set_fb(d->plane1, &d->fb[1]);
-	d->plane2 = igt_output_get_plane(output, 1);
 	igt_plane_set_fb(d->plane2, &d->fb[2]);
 
 	igt_fb_set_position(&d->fb[1], d->plane1, 0, 0);
@@ -440,6 +437,34 @@ test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_outpu
 	igt_display_commit2(&d->display, COMMIT_ATOMIC);
 }
 
+static void
+test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_output_t *output)
+{
+	drmModeModeInfo *mode;
+
+	igt_require(get_num_scalers(d->devid, pipe) >= 2);
+
+	mode = igt_output_get_mode(output);
+	d->plane1 = &d->display.pipes[pipe].planes[0];
+	d->plane2 = &d->display.pipes[pipe].planes[1];
+	prepare_crtc(d, output, pipe, d->plane1, mode);
+
+	for (int i = 0; i < d->plane1->drm_plane->count_formats; i++) {
+		unsigned f1 = d->plane1->drm_plane->formats[i];
+		if (!can_draw(f1))
+			continue;
+
+		for (int j = 0; j < d->plane2->drm_plane->count_formats; j++) {
+			unsigned f2 = d->plane2->drm_plane->formats[j];
+
+			if (!can_draw(f2))
+				continue;
+
+			__test_scaler_with_clipping_clamping_scenario(d, mode, f1, f2);
+		}
+	}
+}
+
 static void find_connected_pipe(igt_display_t *display, bool second, enum pipe *pipe, igt_output_t **output)
 {
 	enum pipe first = PIPE_NONE;
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 5/9] tests/kms_rotation_crc: Fix bad-tiling testcase.
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (3 preceding siblings ...)
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 4/9] tests/kms_plane_scaling: Test all pixel formats with clamping and clipping too Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-06 10:50   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 6/9] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

bad-tiling test didn't work, LOCAL_DRM_FORMAT_MODE_NONE == 0, so
the fb was created with tiling = Y, but because test_bad_format
was set but override_tiling wasn't, we fell through to the success
case. Always assume failure if test_bad_format is set, and pass X
tiled for fb, so the format override works.

Also clear variables after subtests in main, so if the next subtest
doesn't run we still clear the variables.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_rotation_crc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f65562bae9eb..c402da068ae0 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -423,7 +423,7 @@ static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_fo
 				igt_plane_set_size(plane, data->fb.height, data->fb.width);
 
 			ret = igt_display_try_commit2(display, commit);
-			if (test_bad_format && (data->override_fmt || data->override_tiling)) {
+			if (test_bad_format) {
 				igt_assert_eq(ret, -EINVAL);
 				continue;
 			}
@@ -787,6 +787,7 @@ igt_main
 			test_plane_rotation(&data, subtest->plane);
 		}
 	}
+	data.flips = 0;
 
 	igt_subtest_f("sprite-rotation-90-pos-100-0") {
 		igt_require(gen >= 9);
@@ -795,23 +796,24 @@ igt_main
 		data.pos_y = 0;
 		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
 	}
+	data.pos_x = 0,
+	data.pos_y = 0;
 
 	igt_subtest_f("bad-pixel-format") {
 		igt_require(gen >= 9);
-		data.pos_x = 0,
-		data.pos_y = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_fmt = DRM_FORMAT_RGB565;
 		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
+	data.override_fmt = 0;
 
 	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;
+		data.override_tiling = LOCAL_I915_FORMAT_MOD_X_TILED;
 		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
+	data.override_tiling = 0;
 
 	igt_subtest_f("primary-rotation-90-Y-tiled") {
 		enum pipe pipe;
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 6/9] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (4 preceding siblings ...)
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 5/9] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-06 10:57   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 7/9] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

Instead of 2 functions doing the same thing, consolidate to a single function.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_rotation_crc.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index c402da068ae0..70eb6d24b466 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -368,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, bool test_bad_format)
+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;
@@ -468,16 +468,6 @@ static void __test_plane_rotation(data_t *data, int plane_type, bool test_bad_fo
 	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)
@@ -784,7 +774,7 @@ igt_main
 				    gen >= 9);
 			data.rotation = subtest->rot;
 			data.flips = subtest->flips;
-			test_plane_rotation(&data, subtest->plane);
+			test_plane_rotation(&data, subtest->plane, false);
 		}
 	}
 	data.flips = 0;
@@ -794,7 +784,7 @@ igt_main
 		data.rotation = IGT_ROTATION_90;
 		data.pos_x = 100,
 		data.pos_y = 0;
-		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY, false);
 	}
 	data.pos_x = 0,
 	data.pos_y = 0;
@@ -803,7 +793,7 @@ igt_main
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
 		data.override_fmt = DRM_FORMAT_RGB565;
-		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, true);
 	}
 	data.override_fmt = 0;
 
@@ -811,7 +801,7 @@ igt_main
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
 		data.override_tiling = LOCAL_I915_FORMAT_MOD_X_TILED;
-		test_bad_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, true);
 	}
 	data.override_tiling = 0;
 
@@ -846,7 +836,7 @@ igt_main
 			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);
+			test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, false);
 		}
 	}
 
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 7/9] tests/kms_rotation_crc: Always run the flip tests when available.
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (5 preceding siblings ...)
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 6/9] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-06 11:39   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 8/9] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

The -flip tests are the same, but with a pageflip at the end,
since the test is otherwise the same, run the test once with flips
always enabled when possible.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_rotation_crc.c | 106 +++++++++++++++--------------------------------
 1 file changed, 34 insertions(+), 72 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 70eb6d24b466..cc1a9bfe655e 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -43,7 +43,6 @@ typedef struct {
 	int pos_y;
 	uint32_t override_fmt;
 	uint64_t override_tiling;
-	bool flips;
 	int devid;
 } data_t;
 
@@ -260,7 +259,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	/*
 	 * Create a reference software rotated flip framebuffer.
 	 */
-	if (data->flips) {
+	if (plane->type == DRM_PLANE_TYPE_PRIMARY || display->is_atomic) {
 		igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling,
 			      &data->fb_flip);
 		paint_squares(data, data->rotation, &data->fb_flip,
@@ -272,6 +271,15 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 				    display->is_atomic ?
 				    COMMIT_ATOMIC : COMMIT_UNIVERSAL);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
+
+		/*
+		 * Prepare the non-rotated flip fb.
+		 */
+		igt_remove_fb(data->gfx_fd, &data->fb_flip);
+		igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
+			      &data->fb_flip);
+		paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
+			      flip_opacity);
 	}
 
 	/*
@@ -308,18 +316,6 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 
 	if (plane->type != DRM_PLANE_TYPE_CURSOR)
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
-
-	/*
-	 * Prepare the non-rotated flip fb.
-	 */
-	if (data->flips) {
-		igt_remove_fb(data->gfx_fd, &data->fb_flip);
-		igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
-			      &data->fb_flip);
-		paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
-			      flip_opacity);
-	}
-
 }
 
 static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
@@ -378,9 +374,6 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 	enum igt_commit_style commit = COMMIT_LEGACY;
 	int ret;
 
-	if (data->flips && plane_type != DRM_PLANE_TYPE_PRIMARY)
-		igt_require(data->display.is_atomic);
-
 	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
 		commit = COMMIT_UNIVERSAL;
 
@@ -439,7 +432,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 			 * If flips are requested flip to a different fb and
 			 * check CRC against that one as well.
 			 */
-			if (data->flips) {
+			if (data->fb_flip.fb_id) {
 				igt_plane_set_fb(plane, &data->fb_flip);
 				if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
 					igt_plane_set_size(plane, data->fb.height, data->fb.width);
@@ -688,63 +681,37 @@ static const char *tiling_test_str(uint64_t tiling)
 	}
 }
 
-static const char *flip_test_str(unsigned flips)
-{
-	if (flips)
-		return "-flip";
-	else
-		return "";
-}
-
 igt_main
 {
 	struct rot_subtest {
 		unsigned plane;
 		igt_rotation_t rot;
-		bool flips;
 	} *subtest, subtests[] = {
-		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
-		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
-		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270, 0 },
-		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 1 },
-		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 1 },
-		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270, 1 },
-		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90, 0 },
-		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180, 0 },
-		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270, 0 },
-		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90, 1 },
-		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180, 1 },
-		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270, 1 },
-		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
-		{ 0, 0, 0}
+		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90 },
+		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180 },
+		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270 },
+		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90 },
+		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180 },
+		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270 },
+		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180 },
+		{ 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 }
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0 },
+		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180 },
+		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180 },
+		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270 },
+		{ 0, 0 }
 	};
 
 	data_t data = {};
@@ -765,19 +732,16 @@ igt_main
 	}
 
 	for (subtest = subtests; subtest->rot; subtest++) {
-		igt_subtest_f("%s-rotation-%s%s",
+		igt_subtest_f("%s-rotation-%s",
 			      plane_test_str(subtest->plane),
-			      rot_test_str(subtest->rot),
-			      flip_test_str(subtest->flips)) {
+			      rot_test_str(subtest->rot)) {
 			igt_require(!(subtest->rot &
 				    (IGT_ROTATION_90 | IGT_ROTATION_270)) ||
 				    gen >= 9);
 			data.rotation = subtest->rot;
-			data.flips = subtest->flips;
 			test_plane_rotation(&data, subtest->plane, false);
 		}
 	}
-	data.flips = 0;
 
 	igt_subtest_f("sprite-rotation-90-pos-100-0") {
 		igt_require(gen >= 9);
@@ -826,16 +790,14 @@ igt_main
 	}
 
 	for (reflect_x = reflect_x_subtests; reflect_x->tiling; reflect_x++) {
-		igt_subtest_f("primary-%s-reflect-x-%s%s",
+		igt_subtest_f("primary-%s-reflect-x-%s",
 			      tiling_test_str(reflect_x->tiling),
-			      rot_test_str(reflect_x->rot),
-			      flip_test_str(reflect_x->flips)) {
+			      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, false);
 		}
 	}
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 8/9] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled.
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (6 preceding siblings ...)
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 7/9] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-06 13:01   ` Mika Kahola
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

This is already tested by the rotation tests, which require Y-tiled
for 90° and 270° rotations.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_rotation_crc.c | 84 ------------------------------------------------
 1 file changed, 84 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc1a9bfe655e..52a85fb62f9f 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -461,70 +461,6 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
-static void test_plane_rotation_ytiled_obj(data_t *data,
-					   igt_output_t *output,
-					   int plane_type)
-{
-	igt_display_t *display = &data->display;
-	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
-	uint32_t format = DRM_FORMAT_XRGB8888;
-	int bpp = igt_drm_format_to_bpp(format);
-	enum igt_commit_style commit = COMMIT_LEGACY;
-	int fd = data->gfx_fd;
-	igt_plane_t *plane;
-	drmModeModeInfo *mode;
-	unsigned int stride, size, w, h;
-	uint32_t gem_handle;
-	int ret;
-
-	plane = igt_output_get_plane_type(output, plane_type);
-	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
-
-	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
-		commit = COMMIT_UNIVERSAL;
-
-	if (plane_type == DRM_PLANE_TYPE_CURSOR)
-		igt_require(display->has_cursor_plane);
-
-	if (data->display.is_atomic)
-		commit = COMMIT_ATOMIC;
-
-	mode = igt_output_get_mode(output);
-	w = mode->hdisplay;
-	h = mode->vdisplay;
-
-	for (stride = 512; stride < (w * bpp / 8); stride *= 2)
-		;
-	for (size = 1024*1024; size < stride * h; size *= 2)
-		;
-
-	gem_handle = gem_create(fd, size);
-	ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
-	igt_assert_eq(ret, 0);
-
-	do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
-		  format, tiling, NULL, LOCAL_DRM_MODE_FB_MODIFIERS,
-		  &data->fb.fb_id));
-	data->fb.width = w;
-	data->fb.height = h;
-	data->fb.gem_handle = gem_handle;
-
-	igt_plane_set_fb(plane, NULL);
-	igt_display_commit(display);
-
-	igt_plane_set_rotation(plane, data->rotation);
-	igt_plane_set_fb(plane, &data->fb);
-	igt_plane_set_size(plane, h, w);
-
-	ret = igt_display_try_commit2(display, commit);
-
-	igt_output_set_pipe(output, PIPE_NONE);
-
-	kmstest_restore_vt_mode();
-	igt_remove_fb(fd, &data->fb);
-	igt_assert_eq(ret, 0);
-}
-
 static void test_plane_rotation_exhaust_fences(data_t *data,
 					       igt_output_t *output,
 					       int plane_type)
@@ -769,26 +705,6 @@ igt_main
 	}
 	data.override_tiling = 0;
 
-	igt_subtest_f("primary-rotation-90-Y-tiled") {
-		enum pipe pipe;
-		igt_output_t *output;
-		int valid_tests = 0;
-
-		igt_require(gen >= 9);
-		data.rotation = IGT_ROTATION_90;
-
-		for_each_pipe_with_valid_output(&data.display, pipe, output) {
-			igt_output_set_pipe(output, pipe);
-
-			test_plane_rotation_ytiled_obj(&data, output, DRM_PLANE_TYPE_PRIMARY);
-
-			valid_tests++;
-			break;
-		}
-
-		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),
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic.
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (7 preceding siblings ...)
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 8/9] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
@ 2018-02-01 15:39 ` Maarten Lankhorst
  2018-02-07  8:55   ` Mika Kahola
  2018-02-01 16:04 ` [igt-dev] ✓ Fi.CI.BAT: success for tests: Cleanups and NV12 preparations Patchwork
  2018-02-01 19:07 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
  10 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-01 15:39 UTC (permalink / raw)
  To: igt-dev

This won't clean up resources between subtests, so if subtests fail
the next subtest will clean up everything. This allows all subtests
even if one fails.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_rotation_crc.c | 213 +++++++++++++++--------------------------------
 1 file changed, 66 insertions(+), 147 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 52a85fb62f9f..a0fb734d02f6 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -33,7 +33,6 @@ typedef struct {
 	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;
 	igt_crc_t flip_crc;
@@ -122,68 +121,50 @@ paint_squares(data_t *data, igt_rotation_t rotation,
 	igt_put_cairo_ctx(data->gfx_fd, fb, cr);
 }
 
-static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
-			 igt_plane_t *plane, enum igt_commit_style commit)
+static void remove_fbs(data_t *data)
 {
-	drmModeModeInfo *mode;
-	unsigned int w, h;
-	uint64_t tiling = data->override_tiling ?: LOCAL_DRM_FORMAT_MOD_NONE;
-	uint32_t pixel_format = data->override_fmt ?: DRM_FORMAT_XRGB8888;
-	igt_display_t *display = &data->display;
-	igt_plane_t *primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	if (data->fb.fb_id)
+		igt_remove_fb(data->gfx_fd, &data->fb);
 
-	igt_output_set_pipe(output, pipe);
-	igt_plane_set_rotation(plane, IGT_ROTATION_0);
+	if (data->fb_reference.fb_id)
+		igt_remove_fb(data->gfx_fd, &data->fb_reference);
 
-	/* create the pipe_crc object for this pipe */
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-
-	mode = igt_output_get_mode(output);
+	if (data->fb_unrotated.fb_id)
+		igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
 
-	w = mode->hdisplay;
-	h = mode->vdisplay;
-
-	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb_modeset);
+	if (data->fb_flip.fb_id)
+		igt_remove_fb(data->gfx_fd, &data->fb_flip);
 
-	/*
-	 * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
-	 * setplane without a modeset. So, to be able to call
-	 * igt_display_commit and ultimately setcrtc to do the first modeset,
-	 * we create an fb covering the crtc and call commit
-	 *
-	 * It's also a good idea to set a primary fb on the primary plane
-	 * regardless, to force a underrun when watermarks are allocated
-	 * incorrectly for other planes.
-	 */
-	igt_plane_set_fb(primary, &data->fb_modeset);
+	data->fb_flip.fb_id = data->fb_reference.fb_id = data->fb_unrotated.fb_id = data->fb.fb_id = 0;
+}
 
-	if (commit < COMMIT_ATOMIC) {
-		igt_plane_clear_prop_changed(primary, IGT_PLANE_ROTATION);
-		igt_display_commit(display);
+static void cleanup_crtc(data_t *data)
+{
+	igt_display_t *display = &data->display;
 
-		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
-			igt_plane_set_prop_changed(primary, IGT_PLANE_ROTATION);
-	}
+	igt_pipe_crc_free(data->pipe_crc);
+	data->pipe_crc = NULL;
 
-	igt_plane_set_fb(plane, NULL);
+	remove_fbs(data);
 
-	igt_display_commit2(display, commit);
+	igt_display_reset(display);
 }
 
-static void remove_fbs(data_t *data)
+static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
+			 igt_plane_t *plane)
 {
-	if (!data->fb.fb_id)
-		return;
+	igt_display_t *display = &data->display;
 
-	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);
+	cleanup_crtc(data);
 
-	if (data->fb_flip.fb_id)
-		igt_remove_fb(data->gfx_fd, &data->fb_flip);
+	igt_output_set_pipe(output, pipe);
+	igt_plane_set_rotation(plane, IGT_ROTATION_0);
+
+	/* create the pipe_crc object for this pipe */
+	igt_pipe_crc_free(data->pipe_crc);
+	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
 
-	data->fb_flip.fb_id = data->fb.fb_id = 0;
+	igt_display_commit2(display, COMMIT_ATOMIC);
 }
 
 enum rectangle_type {
@@ -206,7 +187,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 
 	if (data->fb.fb_id) {
 		igt_plane_set_fb(plane, NULL);
-		igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
+		igt_display_commit2(display, COMMIT_ATOMIC);
 
 		remove_fbs(data);
 	}
@@ -259,28 +240,24 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	/*
 	 * Create a reference software rotated flip framebuffer.
 	 */
-	if (plane->type == DRM_PLANE_TYPE_PRIMARY || display->is_atomic) {
-		igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling,
-			      &data->fb_flip);
-		paint_squares(data, data->rotation, &data->fb_flip,
-			      flip_opacity);
-		igt_plane_set_fb(plane, &data->fb_flip);
-		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);
-		igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
-
-		/*
-		 * Prepare the non-rotated flip fb.
-		 */
-		igt_remove_fb(data->gfx_fd, &data->fb_flip);
-		igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
-			      &data->fb_flip);
-		paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
-			      flip_opacity);
-	}
+	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format, tiling,
+		      &data->fb_flip);
+	paint_squares(data, data->rotation, &data->fb_flip,
+		      flip_opacity);
+	igt_plane_set_fb(plane, &data->fb_flip);
+	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+		igt_plane_set_position(plane, data->pos_x, data->pos_y);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
+
+	/*
+	  * Prepare the non-rotated flip fb.
+	  */
+	igt_remove_fb(data->gfx_fd, &data->fb_flip);
+	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
+		      &data->fb_flip);
+	paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
+		      flip_opacity);
 
 	/*
 	 * Create a reference CRC for a software-rotated fb.
@@ -292,7 +269,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	igt_plane_set_fb(plane, &data->fb_reference);
 	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);
+	igt_display_commit2(display, COMMIT_ATOMIC);
 
 	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
@@ -305,7 +282,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	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);
+	igt_display_commit2(display, COMMIT_ATOMIC);
 
 	/*
 	 * Prepare the plane with an non-rotated fb let the hw rotate it.
@@ -318,35 +295,6 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 }
 
-static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
-{
-	igt_display_t *display = &data->display;
-
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = NULL;
-
-	remove_fbs(data);
-
-	igt_remove_fb(data->gfx_fd, &data->fb_modeset);
-
-	/* XXX: see the note in prepare_crtc() */
-	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
-		igt_plane_t *primary;
-
-		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-		igt_plane_set_fb(primary, NULL);
-	}
-
-	igt_plane_set_fb(plane, NULL);
-	igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
-	igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-	igt_output_set_pipe(output, PIPE_ANY);
-
-	igt_display_commit(display);
-}
-
 static void wait_for_pageflip(int fd)
 {
 	drmEventContext evctx = { .version = 2 };
@@ -371,18 +319,11 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 	enum pipe pipe;
 	int valid_tests = 0;
 	igt_crc_t crc_output;
-	enum igt_commit_style commit = COMMIT_LEGACY;
 	int ret;
 
-	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
-		commit = COMMIT_UNIVERSAL;
-
 	if (plane_type == DRM_PLANE_TYPE_CURSOR)
 		igt_require(display->has_cursor_plane);
 
-	if (data->display.is_atomic)
-		commit = COMMIT_ATOMIC;
-
 	for_each_pipe_with_valid_output(display, pipe, output) {
 		igt_plane_t *plane;
 		int i;
@@ -395,7 +336,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 		plane = igt_output_get_plane_type(output, plane_type);
 		igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
-		prepare_crtc(data, output, pipe, plane, commit);
+		prepare_crtc(data, output, pipe, plane);
 
 		for (i = 0; i < num_rectangle_types; i++) {
 			/* Unsupported on i915 */
@@ -415,7 +356,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 			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);
+			ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
 			if (test_bad_format) {
 				igt_assert_eq(ret, -EINVAL);
 				continue;
@@ -456,41 +397,28 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 		}
 
 		valid_tests++;
-		cleanup_crtc(data, output, plane);
 	}
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
 static void test_plane_rotation_exhaust_fences(data_t *data,
 					       igt_output_t *output,
-					       int plane_type)
+					       igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
 	uint32_t format = DRM_FORMAT_XRGB8888;
 	int bpp = igt_drm_format_to_bpp(format);
-	enum igt_commit_style commit = COMMIT_LEGACY;
 	int fd = data->gfx_fd;
-	igt_plane_t *plane;
 	drmModeModeInfo *mode;
-	data_t data2[MAX_FENCES+1] = {};
+	struct igt_fb fb[MAX_FENCES+1] = {};
 	unsigned int stride, size, w, h;
 	uint32_t gem_handle;
 	uint64_t total_aperture_size, total_fbs_size;
 	int i, ret;
 
-	plane = igt_output_get_plane_type(output, plane_type);
 	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
-	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
-		commit = COMMIT_UNIVERSAL;
-
-	if (plane_type == DRM_PLANE_TYPE_CURSOR)
-		igt_require(display->has_cursor_plane);
-
-	if (data->display.is_atomic)
-		commit = COMMIT_ATOMIC;
-
 	mode = igt_output_get_mode(output);
 	w = mode->hdisplay;
 	h = mode->vdisplay;
@@ -509,7 +437,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 	igt_require(total_fbs_size < total_aperture_size * 0.9);
 
 	igt_plane_set_fb(plane, NULL);
-	igt_display_commit(display);
+	igt_display_commit2(display, COMMIT_ATOMIC);
 
 	for (i = 0; i < MAX_FENCES + 1; i++) {
 		gem_handle = gem_create(fd, size);
@@ -522,20 +450,20 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 		ret = (__kms_addfb(fd, gem_handle, w, h, stride,
 		       format, tiling, NULL,
 		       LOCAL_DRM_MODE_FB_MODIFIERS,
-		       &data2[i].fb.fb_id));
+		       &fb[i].fb_id));
 		if (ret) {
 			igt_warn("failed to create framebuffer\n");
 			goto err_alloc;
 		}
 
-		data2[i].fb.width = w;
-		data2[i].fb.height = h;
-		data2[i].fb.gem_handle = gem_handle;
+		fb[i].width = w;
+		fb[i].height = h;
+		fb[i].gem_handle = gem_handle;
 
-		igt_plane_set_fb(plane, &data2[i].fb);
+		igt_plane_set_fb(plane, &fb[i]);
 		igt_plane_set_rotation(plane, IGT_ROTATION_0);
 
-		ret = igt_display_try_commit2(display, commit);
+		igt_display_commit2(display, COMMIT_ATOMIC);
 		if (ret) {
 			igt_warn("failed to commit unrotated fb\n");
 			goto err_commit;
@@ -544,7 +472,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 		igt_plane_set_rotation(plane, IGT_ROTATION_90);
 		igt_plane_set_size(plane, h, w);
 
-		igt_display_commit2(display, commit);
+		igt_display_commit2(display, COMMIT_ATOMIC);
 		if (ret) {
 			igt_warn("failed to commit hardware rotated fb: %i\n", ret);
 			goto err_commit;
@@ -557,19 +485,9 @@ err_alloc:
 
 	i--;
 err_commit:
-	igt_plane_set_fb(plane, NULL);
-	igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
-	if (commit < COMMIT_ATOMIC)
-		igt_display_commit2(display, commit);
-
-	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
-
 	for (; i >= 0; i--)
-		igt_remove_fb(fd, &data2[i].fb);
+		igt_remove_fb(fd, &fb[i]);
 
-	kmstest_restore_vt_mode();
 	igt_assert_eq(ret, 0);
 }
 
@@ -726,9 +644,10 @@ igt_main
 		igt_require(gen >= 9);
 
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
-			igt_output_set_pipe(output, pipe);
+			igt_plane_t *primary = &data.display.pipes[pipe].planes[0];
+			prepare_crtc(&data, output, pipe, primary);
 
-			test_plane_rotation_exhaust_fences(&data, output, DRM_PLANE_TYPE_PRIMARY);
+			test_plane_rotation_exhaust_fences(&data, output, primary);
 
 			valid_tests++;
 			break;
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for tests: Cleanups and NV12 preparations.
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (8 preceding siblings ...)
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
@ 2018-02-01 16:04 ` Patchwork
  2018-02-01 19:07 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
  10 siblings, 0 replies; 24+ messages in thread
From: Patchwork @ 2018-02-01 16:04 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: igt-dev

== Series Details ==

Series: tests: Cleanups and NV12 preparations.
URL   : https://patchwork.freedesktop.org/series/37488/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
902b754804ff76fbbf048ff889a95a4d7c0da5e6 tests/perf: fix report validity check on gen10+

with latest DRM-Tip kernel build CI_DRM_3711
4244f989341c drm-tip: 2018y-02m-01d-12h-39m-55s UTC integration manifest

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

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:418s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:426s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:372s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:498s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:285s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:482s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:471s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:464s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:579s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:410s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:277s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:512s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:393s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:399s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:416s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:448s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:418s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:459s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:501s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:453s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:500s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:577s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:431s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:527s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:491s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:496s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:416s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:427s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:528s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:396s
Blacklisted hosts:
fi-glk-dsi       total:288  pass:257  dwarn:1   dfail:0   fail:0   skip:30  time:470s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_849/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ Fi.CI.IGT: warning for tests: Cleanups and NV12 preparations.
  2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
                   ` (9 preceding siblings ...)
  2018-02-01 16:04 ` [igt-dev] ✓ Fi.CI.BAT: success for tests: Cleanups and NV12 preparations Patchwork
@ 2018-02-01 19:07 ` Patchwork
  10 siblings, 0 replies; 24+ messages in thread
From: Patchwork @ 2018-02-01 19:07 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: igt-dev

== Series Details ==

Series: tests: Cleanups and NV12 preparations.
URL   : https://patchwork.freedesktop.org/series/37488/
State : warning

== Summary ==

Test kms_flip:
        Subgroup 2x-flip-vs-expired-vblank-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#102887
        Subgroup plain-flip-ts-check:
                fail       -> PASS       (shard-hsw) fdo#100368
Test perf_pmu:
        Subgroup semaphore-wait-bcs0:
                pass       -> FAIL       (shard-apl) fdo#104829
Test gem_eio:
        Subgroup in-flight-contexts:
                fail       -> PASS       (shard-hsw) fdo#104676
Test gem_tiled_blits:
        Subgroup normal:
                pass       -> SKIP       (shard-apl)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                skip       -> PASS       (shard-snb) fdo#103375
Test kms_vblank:
        Subgroup pipe-a-accuracy-idle:
                fail       -> PASS       (shard-apl) fdo#102583
Test gem_tiled_swapping:
        Subgroup non-threaded:
                pass       -> SKIP       (shard-apl)
Test kms_sysfs_edid_timing:
                warn       -> PASS       (shard-apl) fdo#100047
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912

fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#104829 https://bugs.freedesktop.org/show_bug.cgi?id=104829
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-apl        total:2819 pass:1740 dwarn:1   dfail:0   fail:22  skip:1056 time:12376s
shard-hsw        total:2819 pass:1731 dwarn:1   dfail:0   fail:11  skip:1075 time:11593s
shard-snb        total:2819 pass:1326 dwarn:1   dfail:0   fail:10  skip:1482 time:6527s

== Logs ==

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

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

* Re: [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code Maarten Lankhorst
@ 2018-02-05 10:50   ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-05 10:50 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> fb3 is unused, and fb_id1/2 are also set in igt_framebuffer, so
> it doesn't need separate member values.
> 
> image_w/h are also unused and create_fb will always succeed, so
> more elimination of dead code.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_panel_fitting.c | 52 +++++++++++++++--------------------
> ------------
>  1 file changed, 16 insertions(+), 36 deletions(-)
> 
> diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
> index e4ea355611c3..e0ca6cca8e6a 100644
> --- a/tests/kms_panel_fitting.c
> +++ b/tests/kms_panel_fitting.c
> @@ -32,15 +32,8 @@ typedef struct {
>  	int drm_fd;
>  	igt_display_t display;
>  
> -	int image_w;
> -	int image_h;
> -
>  	struct igt_fb fb1;
>  	struct igt_fb fb2;
> -	struct igt_fb fb3;
> -	int fb_id1;
> -	int fb_id2;
> -	int fb_id3;
>  
>  	igt_plane_t *plane1;
>  	igt_plane_t *plane2;
> @@ -58,18 +51,17 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
>  	igt_output_set_pipe(output, pipe);
>  
>  	/* before allocating, free if any older fb */
> -	if (data->fb_id1) {
> +	if (data->fb1.fb_id) {
>  		igt_remove_fb(data->drm_fd, &data->fb1);
> -		data->fb_id1 = 0;
> +		data->fb1.fb_id = 0;
>  	}
>  
>  	/* allocate fb for plane 1 */
> -	data->fb_id1 = igt_create_pattern_fb(data->drm_fd,
> -						mode->hdisplay,
> mode->vdisplay,
> -						DRM_FORMAT_XRGB8888,
> -						LOCAL_DRM_FORMAT_MOD
> _NONE,
> -						&data->fb1);
> -	igt_assert(data->fb_id1);
> +	igt_create_pattern_fb(data->drm_fd,
> +			      mode->hdisplay, mode->vdisplay,
> +			      DRM_FORMAT_XRGB8888,
> +			      LOCAL_DRM_FORMAT_MOD_NONE,
> +			      &data->fb1);
>  
>  	/*
>  	 * We always set the primary plane to actually enable the
> pipe as
> @@ -91,17 +83,13 @@ static void cleanup_crtc(data_t *data,
> igt_output_t *output, igt_plane_t *plane)
>  {
>  	igt_display_t *display = &data->display;
>  
> -	if (data->fb_id1) {
> +	if (data->fb1.fb_id) {
>  		igt_remove_fb(data->drm_fd, &data->fb1);
> -		data->fb_id1 = 0;
> +		data->fb1.fb_id = 0;
>  	}
> -	if (data->fb_id2) {
> +	if (data->fb2.fb_id) {
>  		igt_remove_fb(data->drm_fd, &data->fb2);
> -		data->fb_id2 = 0;
> -	}
> -	if (data->fb_id3) {
> -		igt_remove_fb(data->drm_fd, &data->fb3);
> -		data->fb_id3 = 0;
> +		data->fb2.fb_id = 0;
>  	}
>  
>  	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> @@ -121,7 +109,6 @@ static void test_panel_fitting(data_t *d)
>  {
>  	igt_display_t *display = &d->display;
>  	igt_output_t *output;
> -	cairo_surface_t *image;
>  	enum pipe pipe;
>  	int valid_tests = 0;
>  
> @@ -146,18 +133,11 @@ static void test_panel_fitting(data_t *d)
>  		mode = igt_output_get_mode(output);
>  		native_mode = *mode;
>  
> -		/* allocate fb2 with image size */
> -		image =
> igt_cairo_image_surface_create_from_png(FILE_NAME);
> -		igt_assert(cairo_surface_status(image) ==
> CAIRO_STATUS_SUCCESS);
> -		d->image_w = cairo_image_surface_get_width(image);
> -		d->image_h = cairo_image_surface_get_height(image);
> -		cairo_surface_destroy(image);
> -
> -		d->fb_id2 = igt_create_image_fb(d->drm_fd, 0, 0,
> -						DRM_FORMAT_XRGB8888,
> -						LOCAL_DRM_FORMAT_MOD
> _NONE,
> -						FILE_NAME, &d->fb2);
> -		igt_assert(d->fb_id2);
> +		/* allocate fb2 with image */
> +		igt_create_image_fb(d->drm_fd, 0, 0,
> +				    DRM_FORMAT_XRGB8888,
> +				    LOCAL_DRM_FORMAT_MOD_NONE,
> +				    FILE_NAME, &d->fb2);
>  
>  		/* Set up display to enable panel fitting */
>  		mode->hdisplay = 640;
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/9] tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch.
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 2/9] tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch Maarten Lankhorst
@ 2018-02-05 10:53   ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-05 10:53 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> This check was missing, and caused a WARN_ON that dates back to
> the original design of atomic.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> Sent to see if it passes shards, doesn't need to be reviewed further.
I reviewed it anyway

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> 
>  tests/kms_atomic.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
> index 9204d7e18698..2e21b53b8c87 100644
> --- a/tests/kms_atomic.c
> +++ b/tests/kms_atomic.c
> @@ -485,6 +485,10 @@ static void plane_invalid_params(igt_pipe_t
> *pipe,
>  	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, pipe-
> >values[IGT_CRTC_MODE_ID]);
>  	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
>  
> +	/* Valid, but invalid because CRTC_ID is set. */
> +	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0);
> +	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
> +
>  	igt_plane_set_fb(plane, fb);
>  	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
>  
> @@ -501,6 +505,10 @@ static void plane_invalid_params(igt_pipe_t
> *pipe,
>  	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, pipe-
> >values[IGT_CRTC_MODE_ID]);
>  	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
>  
> +	/* Valid, but invalid because FB_ID is set. */
> +	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0);
> +	plane_commit_atomic_err(plane, ATOMIC_RELAX_NONE, EINVAL);
> +
>  	igt_plane_set_fb(plane, fb);
>  	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
>  
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation Maarten Lankhorst
@ 2018-02-05 11:14   ` Mika Kahola
  2018-02-05 11:15     ` Mika Kahola
  0 siblings, 1 reply; 24+ messages in thread
From: Mika Kahola @ 2018-02-05 11:14 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> This will allow us to test NV12 as well, when available.
> 
Reviewed-by: Mika Kahola <mika.kahola@kolumbus.fi>

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_plane_scaling.c | 46 +++++++++++++++++++++++++++++------
> -----------
>  1 file changed, 29 insertions(+), 17 deletions(-)
> 
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index d32f3441e8c9..18a42035fb3e 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -164,25 +164,13 @@ static const igt_rotation_t rotations[] = {
>  	IGT_ROTATION_270,
>  };
>  
> -static void test_scaler_with_rotation_pipe(data_t *d, enum pipe
> pipe,
> -					   igt_output_t *output)
> +static bool can_rotate(unsigned format)
>  {
> -	igt_display_t *display = &d->display;
> -	igt_plane_t *plane;
> -
> -	igt_output_set_pipe(output, pipe);
> -	for_each_plane_on_pipe(display, pipe, plane) {
> -		if (plane->type == DRM_PLANE_TYPE_CURSOR)
> -			continue;
> +	if (format == DRM_FORMAT_C8 ||
> +	    format == DRM_FORMAT_RGB565)
> +		return false;
>  
> -		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
> -			igt_rotation_t rot = rotations[i];
> -
> -			check_scaling_pipe_plane_rot(d, plane,
> DRM_FORMAT_XRGB8888,
> -						     LOCAL_I915_FORM
> AT_MOD_Y_TILED,
> -						     pipe, output,
> rot);
> -		}
> -	}
> +	return true;
>  }
>  
>  static bool can_draw(uint32_t drm_format)
> @@ -199,6 +187,30 @@ static bool can_draw(uint32_t drm_format)
>  	return false;
>  }
>  
> +static void test_scaler_with_rotation_pipe(data_t *d, enum pipe
> pipe,
> +					   igt_output_t *output)
> +{
> +	igt_display_t *display = &d->display;
> +	igt_plane_t *plane;
> +
> +	igt_output_set_pipe(output, pipe);
> +	for_each_plane_on_pipe(display, pipe, plane) {
> +		if (plane->type == DRM_PLANE_TYPE_CURSOR)
> +			continue;
> +
> +		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
> +			igt_rotation_t rot = rotations[i];
> +			for (int j = 0; j < plane->drm_plane-
> >count_formats; j++) {
> +				unsigned format = plane->drm_plane-
> >formats[j];
> +				if (can_draw(format) &&
> can_rotate(format))
> +					check_scaling_pipe_plane_rot
> (d, plane, format,
> +								    
>  LOCAL_I915_FORMAT_MOD_Y_TILED,
> +								    
>  pipe, output, rot);
> +			}
> +		}
> +	}
> +}
> +
>  static const uint64_t tilings[] = {
>  	LOCAL_DRM_FORMAT_MOD_NONE,
>  	LOCAL_I915_FORMAT_MOD_X_TILED,
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation
  2018-02-05 11:14   ` Mika Kahola
@ 2018-02-05 11:15     ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-05 11:15 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Mon, 2018-02-05 at 13:14 +0200, Mika Kahola wrote:
> On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> > 
> > This will allow us to test NV12 as well, when available.
> > 
Oops, typo in email address. Now fixed.

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> 
> > 
> > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com
> > >
> > ---
> >  tests/kms_plane_scaling.c | 46 +++++++++++++++++++++++++++++------
> > -----------
> >  1 file changed, 29 insertions(+), 17 deletions(-)
> > 
> > diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> > index d32f3441e8c9..18a42035fb3e 100644
> > --- a/tests/kms_plane_scaling.c
> > +++ b/tests/kms_plane_scaling.c
> > @@ -164,25 +164,13 @@ static const igt_rotation_t rotations[] = {
> >  	IGT_ROTATION_270,
> >  };
> >  
> > -static void test_scaler_with_rotation_pipe(data_t *d, enum pipe
> > pipe,
> > -					   igt_output_t *output)
> > +static bool can_rotate(unsigned format)
> >  {
> > -	igt_display_t *display = &d->display;
> > -	igt_plane_t *plane;
> > -
> > -	igt_output_set_pipe(output, pipe);
> > -	for_each_plane_on_pipe(display, pipe, plane) {
> > -		if (plane->type == DRM_PLANE_TYPE_CURSOR)
> > -			continue;
> > +	if (format == DRM_FORMAT_C8 ||
> > +	    format == DRM_FORMAT_RGB565)
> > +		return false;
> >  
> > -		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
> > -			igt_rotation_t rot = rotations[i];
> > -
> > -			check_scaling_pipe_plane_rot(d, plane,
> > DRM_FORMAT_XRGB8888,
> > -						     LOCAL_I915_FO
> > RM
> > AT_MOD_Y_TILED,
> > -						     pipe, output,
> > rot);
> > -		}
> > -	}
> > +	return true;
> >  }
> >  
> >  static bool can_draw(uint32_t drm_format)
> > @@ -199,6 +187,30 @@ static bool can_draw(uint32_t drm_format)
> >  	return false;
> >  }
> >  
> > +static void test_scaler_with_rotation_pipe(data_t *d, enum pipe
> > pipe,
> > +					   igt_output_t *output)
> > +{
> > +	igt_display_t *display = &d->display;
> > +	igt_plane_t *plane;
> > +
> > +	igt_output_set_pipe(output, pipe);
> > +	for_each_plane_on_pipe(display, pipe, plane) {
> > +		if (plane->type == DRM_PLANE_TYPE_CURSOR)
> > +			continue;
> > +
> > +		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
> > +			igt_rotation_t rot = rotations[i];
> > +			for (int j = 0; j < plane->drm_plane-
> > > 
> > > count_formats; j++) {
> > +				unsigned format = plane-
> > >drm_plane-
> > > 
> > > formats[j];
> > +				if (can_draw(format) &&
> > can_rotate(format))
> > +					check_scaling_pipe_plane_r
> > ot
> > (d, plane, format,
> > +								  
> >   
> >  LOCAL_I915_FORMAT_MOD_Y_TILED,
> > +								  
> >   
> >  pipe, output, rot);
> > +			}
> > +		}
> > +	}
> > +}
> > +
> >  static const uint64_t tilings[] = {
> >  	LOCAL_DRM_FORMAT_MOD_NONE,
> >  	LOCAL_I915_FORMAT_MOD_X_TILED,
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 4/9] tests/kms_plane_scaling: Test all pixel formats with clamping and clipping too
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 4/9] tests/kms_plane_scaling: Test all pixel formats with clamping and clipping too Maarten Lankhorst
@ 2018-02-05 11:47   ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-05 11:47 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> Run across all combinations of pixel formats to ensure better
> testing.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_plane_scaling.c | 61 +++++++++++++++++++++++++++++++++--
> ------------
>  1 file changed, 43 insertions(+), 18 deletions(-)
> 
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 18a42035fb3e..208f9262f84b 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -58,14 +58,10 @@ static int get_num_scalers(uint32_t devid, enum
> pipe pipe)
>  		return 1;
>  }
>  
> -static void cleanup_crtc(data_t *data)
> +static void cleanup_fbs(data_t *data)
>  {
>  	int i;
>  
> -	igt_display_reset(&data->display);
> -	igt_pipe_crc_free(data->pipe_crc);
> -	data->pipe_crc = NULL;
> -
>  	for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
>  		if (!data->fb[i].fb_id)
>  			continue;
> @@ -75,6 +71,15 @@ static void cleanup_crtc(data_t *data)
>  	}
>  }
>  
> +static void cleanup_crtc(data_t *data)
> +{
> +	igt_display_reset(&data->display);
> +	igt_pipe_crc_free(data->pipe_crc);
> +	data->pipe_crc = NULL;
> +
> +	cleanup_fbs(data);
> +}
> +
>  static void prepare_crtc(data_t *data, igt_output_t *output, enum
> pipe pipe,
>  			igt_plane_t *plane, drmModeModeInfo *mode)
>  {
> @@ -401,28 +406,20 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe
> pipe, igt_output_t *output)
>  }
>  
>  static void
> -test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe
> pipe, igt_output_t *output)
> +__test_scaler_with_clipping_clamping_scenario(data_t *d,
> drmModeModeInfo *mode,
> +					      uint32_t f1, uint32_t
> f2)
>  {
> -	drmModeModeInfo *mode;
> -
> -	igt_require(get_num_scalers(d->devid, pipe) >= 2);
> -
> -	mode = igt_output_get_mode(output);
> -	d->plane1 = &d->display.pipes[pipe].planes[0];
> -	prepare_crtc(d, output, pipe, d->plane1, mode);
> +	cleanup_fbs(d);
>  
>  	igt_create_pattern_fb(d->drm_fd,
> -			      mode->hdisplay, mode->vdisplay,
> -			      DRM_FORMAT_XRGB8888,
> +			      mode->hdisplay, mode->vdisplay, f1,
>  			      LOCAL_I915_FORMAT_MOD_X_TILED, &d-
> >fb[1]);
>  
>  	igt_create_pattern_fb(d->drm_fd,
> -			      mode->hdisplay, mode->vdisplay,
> -			      DRM_FORMAT_XRGB8888,
> +			      mode->hdisplay, mode->vdisplay, f2,
>  			      LOCAL_I915_FORMAT_MOD_Y_TILED, &d-
> >fb[2]);
>  
>  	igt_plane_set_fb(d->plane1, &d->fb[1]);
> -	d->plane2 = igt_output_get_plane(output, 1);
>  	igt_plane_set_fb(d->plane2, &d->fb[2]);
>  
>  	igt_fb_set_position(&d->fb[1], d->plane1, 0, 0);
> @@ -440,6 +437,34 @@
> test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe
> pipe, igt_outpu
>  	igt_display_commit2(&d->display, COMMIT_ATOMIC);
>  }
>  
> +static void
> +test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe
> pipe, igt_output_t *output)
> +{
> +	drmModeModeInfo *mode;
> +
> +	igt_require(get_num_scalers(d->devid, pipe) >= 2);
> +
> +	mode = igt_output_get_mode(output);
> +	d->plane1 = &d->display.pipes[pipe].planes[0];
> +	d->plane2 = &d->display.pipes[pipe].planes[1];
> +	prepare_crtc(d, output, pipe, d->plane1, mode);
> +
> +	for (int i = 0; i < d->plane1->drm_plane->count_formats;
> i++) {
> +		unsigned f1 = d->plane1->drm_plane->formats[i];
> +		if (!can_draw(f1))
> +			continue;
> +
> +		for (int j = 0; j < d->plane2->drm_plane-
> >count_formats; j++) {
> +			unsigned f2 = d->plane2->drm_plane-
> >formats[j];
> +
> +			if (!can_draw(f2))
> +				continue;
> +
> +			__test_scaler_with_clipping_clamping_scenari
> o(d, mode, f1, f2);
> +		}
> +	}
> +}
> +
>  static void find_connected_pipe(igt_display_t *display, bool second,
> enum pipe *pipe, igt_output_t **output)
>  {
>  	enum pipe first = PIPE_NONE;
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 5/9] tests/kms_rotation_crc: Fix bad-tiling testcase.
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 5/9] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
@ 2018-02-06 10:50   ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-06 10:50 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> bad-tiling test didn't work, LOCAL_DRM_FORMAT_MODE_NONE == 0, so
> the fb was created with tiling = Y, but because test_bad_format
> was set but override_tiling wasn't, we fell through to the success
> case. Always assume failure if test_bad_format is set, and pass X
> tiled for fb, so the format override works.
> 
> Also clear variables after subtests in main, so if the next subtest
> doesn't run we still clear the variables.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_rotation_crc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index f65562bae9eb..c402da068ae0 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -423,7 +423,7 @@ static void __test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_fo
>  				igt_plane_set_size(plane, data-
> >fb.height, data->fb.width);
>  
>  			ret = igt_display_try_commit2(display,
> commit);
> -			if (test_bad_format && (data->override_fmt
> || data->override_tiling)) {
> +			if (test_bad_format) {
>  				igt_assert_eq(ret, -EINVAL);
>  				continue;
>  			}
> @@ -787,6 +787,7 @@ igt_main
>  			test_plane_rotation(&data, subtest->plane);
>  		}
>  	}
> +	data.flips = 0;
>  
>  	igt_subtest_f("sprite-rotation-90-pos-100-0") {
>  		igt_require(gen >= 9);
> @@ -795,23 +796,24 @@ igt_main
>  		data.pos_y = 0;
>  		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
>  	}
> +	data.pos_x = 0,
> +	data.pos_y = 0;
>  
>  	igt_subtest_f("bad-pixel-format") {
>  		igt_require(gen >= 9);
> -		data.pos_x = 0,
> -		data.pos_y = 0;
>  		data.rotation = IGT_ROTATION_90;
>  		data.override_fmt = DRM_FORMAT_RGB565;
>  		test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
>  	}
> +	data.override_fmt = 0;
>  
>  	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;
> +		data.override_tiling =
> LOCAL_I915_FORMAT_MOD_X_TILED;
>  		test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
>  	}
> +	data.override_tiling = 0;
>  
>  	igt_subtest_f("primary-rotation-90-Y-tiled") {
>  		enum pipe pipe;
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 6/9] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 6/9] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
@ 2018-02-06 10:57   ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-06 10:57 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> Instead of 2 functions doing the same thing, consolidate to a single
> function.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_rotation_crc.c | 22 ++++++----------------
>  1 file changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index c402da068ae0..70eb6d24b466 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -368,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, bool
> test_bad_format)
> +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;
> @@ -468,16 +468,6 @@ static void __test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_fo
>  	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)
> @@ -784,7 +774,7 @@ igt_main
>  				    gen >= 9);
>  			data.rotation = subtest->rot;
>  			data.flips = subtest->flips;
> -			test_plane_rotation(&data, subtest->plane);
> +			test_plane_rotation(&data, subtest->plane,
> false);
>  		}
>  	}
>  	data.flips = 0;
> @@ -794,7 +784,7 @@ igt_main
>  		data.rotation = IGT_ROTATION_90;
>  		data.pos_x = 100,
>  		data.pos_y = 0;
> -		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
> +		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY,
> false);
>  	}
>  	data.pos_x = 0,
>  	data.pos_y = 0;
> @@ -803,7 +793,7 @@ igt_main
>  		igt_require(gen >= 9);
>  		data.rotation = IGT_ROTATION_90;
>  		data.override_fmt = DRM_FORMAT_RGB565;
> -		test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> +		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY,
> true);
>  	}
>  	data.override_fmt = 0;
>  
> @@ -811,7 +801,7 @@ igt_main
>  		igt_require(gen >= 9);
>  		data.rotation = IGT_ROTATION_90;
>  		data.override_tiling =
> LOCAL_I915_FORMAT_MOD_X_TILED;
> -		test_bad_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY);
> +		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY,
> true);
>  	}
>  	data.override_tiling = 0;
>  
> @@ -846,7 +836,7 @@ igt_main
>  			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);
> +			test_plane_rotation(&data,
> DRM_PLANE_TYPE_PRIMARY, false);
>  		}
>  	}
>  
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 7/9] tests/kms_rotation_crc: Always run the flip tests when available.
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 7/9] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
@ 2018-02-06 11:39   ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-06 11:39 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> The -flip tests are the same, but with a pageflip at the end,
> since the test is otherwise the same, run the test once with flips
> always enabled when possible.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_rotation_crc.c | 106 +++++++++++++++--------------------
> ------------
>  1 file changed, 34 insertions(+), 72 deletions(-)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 70eb6d24b466..cc1a9bfe655e 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -43,7 +43,6 @@ typedef struct {
>  	int pos_y;
>  	uint32_t override_fmt;
>  	uint64_t override_tiling;
> -	bool flips;
>  	int devid;
>  } data_t;
>  
> @@ -260,7 +259,7 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  	/*
>  	 * Create a reference software rotated flip framebuffer.
>  	 */
> -	if (data->flips) {
> +	if (plane->type == DRM_PLANE_TYPE_PRIMARY || display-
> >is_atomic) {
>  		igt_create_fb(data->gfx_fd, ref_w, ref_h,
> pixel_format, tiling,
>  			      &data->fb_flip);
>  		paint_squares(data, data->rotation, &data->fb_flip,
> @@ -272,6 +271,15 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  				    display->is_atomic ?
>  				    COMMIT_ATOMIC :
> COMMIT_UNIVERSAL);
>  		igt_pipe_crc_collect_crc(data->pipe_crc, &data-
> >flip_crc);
> +
> +		/*
> +		 * Prepare the non-rotated flip fb.
> +		 */
> +		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> +		igt_create_fb(data->gfx_fd, w, h, pixel_format,
> tiling,
> +			      &data->fb_flip);
> +		paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
> +			      flip_opacity);
>  	}
>  
>  	/*
> @@ -308,18 +316,6 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  
>  	if (plane->type != DRM_PLANE_TYPE_CURSOR)
>  		igt_plane_set_position(plane, data->pos_x, data-
> >pos_y);
> -
> -	/*
> -	 * Prepare the non-rotated flip fb.
> -	 */
> -	if (data->flips) {
> -		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> -		igt_create_fb(data->gfx_fd, w, h, pixel_format,
> tiling,
> -			      &data->fb_flip);
> -		paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
> -			      flip_opacity);
> -	}
> -
>  }
>  
>  static void cleanup_crtc(data_t *data, igt_output_t *output,
> igt_plane_t *plane)
> @@ -378,9 +374,6 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
>  	enum igt_commit_style commit = COMMIT_LEGACY;
>  	int ret;
>  
> -	if (data->flips && plane_type != DRM_PLANE_TYPE_PRIMARY)
> -		igt_require(data->display.is_atomic);
> -
>  	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
>  		commit = COMMIT_UNIVERSAL;
>  
> @@ -439,7 +432,7 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
>  			 * If flips are requested flip to a
> different fb and
>  			 * check CRC against that one as well.
>  			 */
> -			if (data->flips) {
> +			if (data->fb_flip.fb_id) {
>  				igt_plane_set_fb(plane, &data-
> >fb_flip);
>  				if (data->rotation ==
> IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270)
>  					igt_plane_set_size(plane,
> data->fb.height, data->fb.width);
> @@ -688,63 +681,37 @@ static const char *tiling_test_str(uint64_t
> tiling)
>  	}
>  }
>  
> -static const char *flip_test_str(unsigned flips)
> -{
> -	if (flips)
> -		return "-flip";
> -	else
> -		return "";
> -}
> -
>  igt_main
>  {
>  	struct rot_subtest {
>  		unsigned plane;
>  		igt_rotation_t rot;
> -		bool flips;
>  	} *subtest, subtests[] = {
> -		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 0 },
> -		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 0 },
> -		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270, 0 },
> -		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90, 1 },
> -		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180, 1 },
> -		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270, 1 },
> -		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90, 0 },
> -		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180, 0 },
> -		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270, 0 },
> -		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90, 1 },
> -		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180, 1 },
> -		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270, 1 },
> -		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180, 0 },
> -		{ 0, 0, 0}
> +		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_90 },
> +		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_180 },
> +		{ DRM_PLANE_TYPE_PRIMARY, IGT_ROTATION_270 },
> +		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_90 },
> +		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_180 },
> +		{ DRM_PLANE_TYPE_OVERLAY, IGT_ROTATION_270 },
> +		{ DRM_PLANE_TYPE_CURSOR, IGT_ROTATION_180 },
> +		{ 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 }
> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_0 },
> +		{ LOCAL_I915_FORMAT_MOD_X_TILED, IGT_ROTATION_180 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_0 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_90 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_180 },
> +		{ LOCAL_I915_FORMAT_MOD_Y_TILED, IGT_ROTATION_270 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_0 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_90 },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_180
> },
> +		{ LOCAL_I915_FORMAT_MOD_Yf_TILED, IGT_ROTATION_270
> },
> +		{ 0, 0 }
>  	};
>  
>  	data_t data = {};
> @@ -765,19 +732,16 @@ igt_main
>  	}
>  
>  	for (subtest = subtests; subtest->rot; subtest++) {
> -		igt_subtest_f("%s-rotation-%s%s",
> +		igt_subtest_f("%s-rotation-%s",
>  			      plane_test_str(subtest->plane),
> -			      rot_test_str(subtest->rot),
> -			      flip_test_str(subtest->flips)) {
> +			      rot_test_str(subtest->rot)) {
>  			igt_require(!(subtest->rot &
>  				    (IGT_ROTATION_90 |
> IGT_ROTATION_270)) ||
>  				    gen >= 9);
>  			data.rotation = subtest->rot;
> -			data.flips = subtest->flips;
>  			test_plane_rotation(&data, subtest->plane,
> false);
>  		}
>  	}
> -	data.flips = 0;
>  
>  	igt_subtest_f("sprite-rotation-90-pos-100-0") {
>  		igt_require(gen >= 9);
> @@ -826,16 +790,14 @@ igt_main
>  	}
>  
>  	for (reflect_x = reflect_x_subtests; reflect_x->tiling;
> reflect_x++) {
> -		igt_subtest_f("primary-%s-reflect-x-%s%s",
> +		igt_subtest_f("primary-%s-reflect-x-%s",
>  			      tiling_test_str(reflect_x->tiling),
> -			      rot_test_str(reflect_x->rot),
> -			      flip_test_str(reflect_x->flips)) {
> +			      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, false);
>  		}
>  	}
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 8/9] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled.
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 8/9] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
@ 2018-02-06 13:01   ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-06 13:01 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> This is already tested by the rotation tests, which require Y-tiled
> for 90° and 270° rotations.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_rotation_crc.c | 84 --------------------------------------
> ----------
>  1 file changed, 84 deletions(-)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index cc1a9bfe655e..52a85fb62f9f 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -461,70 +461,6 @@ static void test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_form
>  	igt_require_f(valid_tests, "no valid crtc/connector
> combinations found\n");
>  }
>  
> -static void test_plane_rotation_ytiled_obj(data_t *data,
> -					   igt_output_t *output,
> -					   int plane_type)
> -{
> -	igt_display_t *display = &data->display;
> -	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> -	uint32_t format = DRM_FORMAT_XRGB8888;
> -	int bpp = igt_drm_format_to_bpp(format);
> -	enum igt_commit_style commit = COMMIT_LEGACY;
> -	int fd = data->gfx_fd;
> -	igt_plane_t *plane;
> -	drmModeModeInfo *mode;
> -	unsigned int stride, size, w, h;
> -	uint32_t gem_handle;
> -	int ret;
> -
> -	plane = igt_output_get_plane_type(output, plane_type);
> -	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
> -
> -	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
> -		commit = COMMIT_UNIVERSAL;
> -
> -	if (plane_type == DRM_PLANE_TYPE_CURSOR)
> -		igt_require(display->has_cursor_plane);
> -
> -	if (data->display.is_atomic)
> -		commit = COMMIT_ATOMIC;
> -
> -	mode = igt_output_get_mode(output);
> -	w = mode->hdisplay;
> -	h = mode->vdisplay;
> -
> -	for (stride = 512; stride < (w * bpp / 8); stride *= 2)
> -		;
> -	for (size = 1024*1024; size < stride * h; size *= 2)
> -		;
> -
> -	gem_handle = gem_create(fd, size);
> -	ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y,
> stride);
> -	igt_assert_eq(ret, 0);
> -
> -	do_or_die(__kms_addfb(fd, gem_handle, w, h, stride,
> -		  format, tiling, NULL, LOCAL_DRM_MODE_FB_MODIFIERS,
> -		  &data->fb.fb_id));
> -	data->fb.width = w;
> -	data->fb.height = h;
> -	data->fb.gem_handle = gem_handle;
> -
> -	igt_plane_set_fb(plane, NULL);
> -	igt_display_commit(display);
> -
> -	igt_plane_set_rotation(plane, data->rotation);
> -	igt_plane_set_fb(plane, &data->fb);
> -	igt_plane_set_size(plane, h, w);
> -
> -	ret = igt_display_try_commit2(display, commit);
> -
> -	igt_output_set_pipe(output, PIPE_NONE);
> -
> -	kmstest_restore_vt_mode();
> -	igt_remove_fb(fd, &data->fb);
> -	igt_assert_eq(ret, 0);
> -}
> -
>  static void test_plane_rotation_exhaust_fences(data_t *data,
>  					       igt_output_t *output,
>  					       int plane_type)
> @@ -769,26 +705,6 @@ igt_main
>  	}
>  	data.override_tiling = 0;
>  
> -	igt_subtest_f("primary-rotation-90-Y-tiled") {
> -		enum pipe pipe;
> -		igt_output_t *output;
> -		int valid_tests = 0;
> -
> -		igt_require(gen >= 9);
> -		data.rotation = IGT_ROTATION_90;
> -
> -		for_each_pipe_with_valid_output(&data.display, pipe,
> output) {
> -			igt_output_set_pipe(output, pipe);
> -
> -			test_plane_rotation_ytiled_obj(&data,
> output, DRM_PLANE_TYPE_PRIMARY);
> -
> -			valid_tests++;
> -			break;
> -		}
> -
> -		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),
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic.
  2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
@ 2018-02-07  8:55   ` Mika Kahola
  2018-02-07  9:46     ` Maarten Lankhorst
  0 siblings, 1 reply; 24+ messages in thread
From: Mika Kahola @ 2018-02-07  8:55 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> This won't clean up resources between subtests, so if subtests fail
> the next subtest will clean up everything. This allows all subtests
> even if one fails.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_rotation_crc.c | 213 +++++++++++++++--------------------
> ------------
>  1 file changed, 66 insertions(+), 147 deletions(-)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 52a85fb62f9f..a0fb734d02f6 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -33,7 +33,6 @@ typedef struct {
>  	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;
>  	igt_crc_t flip_crc;
> @@ -122,68 +121,50 @@ paint_squares(data_t *data, igt_rotation_t
> rotation,
>  	igt_put_cairo_ctx(data->gfx_fd, fb, cr);
>  }
>  
> -static void prepare_crtc(data_t *data, igt_output_t *output, enum
> pipe pipe,
> -			 igt_plane_t *plane, enum igt_commit_style
> commit)
> +static void remove_fbs(data_t *data)
>  {
> -	drmModeModeInfo *mode;
> -	unsigned int w, h;
> -	uint64_t tiling = data->override_tiling ?:
> LOCAL_DRM_FORMAT_MOD_NONE;
> -	uint32_t pixel_format = data->override_fmt ?:
> DRM_FORMAT_XRGB8888;
> -	igt_display_t *display = &data->display;
> -	igt_plane_t *primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> +	if (data->fb.fb_id)
> +		igt_remove_fb(data->gfx_fd, &data->fb);
>  
> -	igt_output_set_pipe(output, pipe);
> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +	if (data->fb_reference.fb_id)
> +		igt_remove_fb(data->gfx_fd, &data->fb_reference);
>  
> -	/* create the pipe_crc object for this pipe */
> -	igt_pipe_crc_free(data->pipe_crc);
> -	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
> -
> -	mode = igt_output_get_mode(output);
> +	if (data->fb_unrotated.fb_id)
> +		igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
>  
> -	w = mode->hdisplay;
> -	h = mode->vdisplay;
> -
> -	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
> &data->fb_modeset);
> +	if (data->fb_flip.fb_id)
> +		igt_remove_fb(data->gfx_fd, &data->fb_flip);
>  
> -	/*
> -	 * With igt_display_commit2 and COMMIT_UNIVERSAL, we call
> just the
> -	 * setplane without a modeset. So, to be able to call
> -	 * igt_display_commit and ultimately setcrtc to do the first
> modeset,
> -	 * we create an fb covering the crtc and call commit
> -	 *
> -	 * It's also a good idea to set a primary fb on the primary
> plane
> -	 * regardless, to force a underrun when watermarks are
> allocated
> -	 * incorrectly for other planes.
> -	 */
> -	igt_plane_set_fb(primary, &data->fb_modeset);
> +	data->fb_flip.fb_id = data->fb_reference.fb_id = data-
> >fb_unrotated.fb_id = data->fb.fb_id = 0;
> +}
>  
> -	if (commit < COMMIT_ATOMIC) {
> -		igt_plane_clear_prop_changed(primary,
> IGT_PLANE_ROTATION);
> -		igt_display_commit(display);
> +static void cleanup_crtc(data_t *data)
> +{
> +	igt_display_t *display = &data->display;
>  
> -		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> -			igt_plane_set_prop_changed(primary,
> IGT_PLANE_ROTATION);
> -	}
> +	igt_pipe_crc_free(data->pipe_crc);
> +	data->pipe_crc = NULL;
>  
> -	igt_plane_set_fb(plane, NULL);
> +	remove_fbs(data);
>  
> -	igt_display_commit2(display, commit);
> +	igt_display_reset(display);
>  }
>  
> -static void remove_fbs(data_t *data)
> +static void prepare_crtc(data_t *data, igt_output_t *output, enum
> pipe pipe,
> +			 igt_plane_t *plane)
>  {
> -	if (!data->fb.fb_id)
> -		return;
> +	igt_display_t *display = &data->display;
>  
> -	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);
> +	cleanup_crtc(data);
>  
> -	if (data->fb_flip.fb_id)
> -		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> +	igt_output_set_pipe(output, pipe);
> +	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> +
> +	/* create the pipe_crc object for this pipe */
> +	igt_pipe_crc_free(data->pipe_crc);
> +	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
>  
> -	data->fb_flip.fb_id = data->fb.fb_id = 0;
> +	igt_display_commit2(display, COMMIT_ATOMIC);
>  }
>  
>  enum rectangle_type {
> @@ -206,7 +187,7 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  
>  	if (data->fb.fb_id) {
>  		igt_plane_set_fb(plane, NULL);
> -		igt_display_commit2(display, display->is_atomic ?
> COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> +		igt_display_commit2(display, COMMIT_ATOMIC);
Should we keep the legacy commit here or should we have a requirement
for this test that it runs only atomic?
>  
>  		remove_fbs(data);
>  	}
> @@ -259,28 +240,24 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  	/*
>  	 * Create a reference software rotated flip framebuffer.
>  	 */
> -	if (plane->type == DRM_PLANE_TYPE_PRIMARY || display-
> >is_atomic) {
> -		igt_create_fb(data->gfx_fd, ref_w, ref_h,
> pixel_format, tiling,
> -			      &data->fb_flip);
> -		paint_squares(data, data->rotation, &data->fb_flip,
> -			      flip_opacity);
> -		igt_plane_set_fb(plane, &data->fb_flip);
> -		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);
> -		igt_pipe_crc_collect_crc(data->pipe_crc, &data-
> >flip_crc);
> -
> -		/*
> -		 * Prepare the non-rotated flip fb.
> -		 */
> -		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> -		igt_create_fb(data->gfx_fd, w, h, pixel_format,
> tiling,
> -			      &data->fb_flip);
> -		paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
> -			      flip_opacity);
> -	}
> +	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
> tiling,
> +		      &data->fb_flip);
> +	paint_squares(data, data->rotation, &data->fb_flip,
> +		      flip_opacity);
> +	igt_plane_set_fb(plane, &data->fb_flip);
> +	if (plane->type != DRM_PLANE_TYPE_CURSOR)
> +		igt_plane_set_position(plane, data->pos_x, data-
> >pos_y);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +	igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
> +
> +	/*
> +	  * Prepare the non-rotated flip fb.
> +	  */
> +	igt_remove_fb(data->gfx_fd, &data->fb_flip);
> +	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
> +		      &data->fb_flip);
> +	paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
> +		      flip_opacity);
>  
>  	/*
>  	 * Create a reference CRC for a software-rotated fb.
> @@ -292,7 +269,7 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  	igt_plane_set_fb(plane, &data->fb_reference);
>  	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);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
>  
>  	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>  
> @@ -305,7 +282,7 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  	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);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
>  
>  	/*
>  	 * Prepare the plane with an non-rotated fb let the hw
> rotate it.
> @@ -318,35 +295,6 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  		igt_plane_set_position(plane, data->pos_x, data-
> >pos_y);
>  }
>  
> -static void cleanup_crtc(data_t *data, igt_output_t *output,
> igt_plane_t *plane)
> -{
> -	igt_display_t *display = &data->display;
> -
> -	igt_pipe_crc_free(data->pipe_crc);
> -	data->pipe_crc = NULL;
> -
> -	remove_fbs(data);
> -
> -	igt_remove_fb(data->gfx_fd, &data->fb_modeset);
> -
> -	/* XXX: see the note in prepare_crtc() */
> -	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> -		igt_plane_t *primary;
> -
> -		primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> -		igt_plane_set_fb(primary, NULL);
> -	}
> -
> -	igt_plane_set_fb(plane, NULL);
> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> -
> -	igt_display_commit2(display, COMMIT_UNIVERSAL);
> -
> -	igt_output_set_pipe(output, PIPE_ANY);
> -
> -	igt_display_commit(display);
> -}
> -
>  static void wait_for_pageflip(int fd)
>  {
>  	drmEventContext evctx = { .version = 2 };
> @@ -371,18 +319,11 @@ static void test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_form
>  	enum pipe pipe;
>  	int valid_tests = 0;
>  	igt_crc_t crc_output;
> -	enum igt_commit_style commit = COMMIT_LEGACY;
>  	int ret;
>  
> -	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
> -		commit = COMMIT_UNIVERSAL;
> -
>  	if (plane_type == DRM_PLANE_TYPE_CURSOR)
>  		igt_require(display->has_cursor_plane);
>  
> -	if (data->display.is_atomic)
> -		commit = COMMIT_ATOMIC;
> -
>  	for_each_pipe_with_valid_output(display, pipe, output) {
>  		igt_plane_t *plane;
>  		int i;
> @@ -395,7 +336,7 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
>  		plane = igt_output_get_plane_type(output,
> plane_type);
>  		igt_require(igt_plane_has_prop(plane,
> IGT_PLANE_ROTATION));
>  
> -		prepare_crtc(data, output, pipe, plane, commit);
> +		prepare_crtc(data, output, pipe, plane);
>  
>  		for (i = 0; i < num_rectangle_types; i++) {
>  			/* Unsupported on i915 */
> @@ -415,7 +356,7 @@ static void test_plane_rotation(data_t *data, int
> plane_type, bool test_bad_form
>  			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);
> +			ret = igt_display_try_commit2(display,
> COMMIT_ATOMIC);
>  			if (test_bad_format) {
>  				igt_assert_eq(ret, -EINVAL);
>  				continue;
> @@ -456,41 +397,28 @@ static void test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_form
>  		}
>  
>  		valid_tests++;
> -		cleanup_crtc(data, output, plane);
>  	}
>  	igt_require_f(valid_tests, "no valid crtc/connector
> combinations found\n");
>  }
>  
>  static void test_plane_rotation_exhaust_fences(data_t *data,
>  					       igt_output_t *output,
> -					       int plane_type)
> +					       igt_plane_t *plane)
>  {
>  	igt_display_t *display = &data->display;
>  	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
>  	uint32_t format = DRM_FORMAT_XRGB8888;
>  	int bpp = igt_drm_format_to_bpp(format);
> -	enum igt_commit_style commit = COMMIT_LEGACY;
>  	int fd = data->gfx_fd;
> -	igt_plane_t *plane;
>  	drmModeModeInfo *mode;
> -	data_t data2[MAX_FENCES+1] = {};
> +	struct igt_fb fb[MAX_FENCES+1] = {};
>  	unsigned int stride, size, w, h;
>  	uint32_t gem_handle;
>  	uint64_t total_aperture_size, total_fbs_size;
>  	int i, ret;
>  
> -	plane = igt_output_get_plane_type(output, plane_type);
>  	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
>  
> -	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
> DRM_PLANE_TYPE_CURSOR)
> -		commit = COMMIT_UNIVERSAL;
> -
> -	if (plane_type == DRM_PLANE_TYPE_CURSOR)
> -		igt_require(display->has_cursor_plane);
> -
> -	if (data->display.is_atomic)
> -		commit = COMMIT_ATOMIC;
> -
>  	mode = igt_output_get_mode(output);
>  	w = mode->hdisplay;
>  	h = mode->vdisplay;
> @@ -509,7 +437,7 @@ static void
> test_plane_rotation_exhaust_fences(data_t *data,
>  	igt_require(total_fbs_size < total_aperture_size * 0.9);
>  
>  	igt_plane_set_fb(plane, NULL);
> -	igt_display_commit(display);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
>  
>  	for (i = 0; i < MAX_FENCES + 1; i++) {
>  		gem_handle = gem_create(fd, size);
> @@ -522,20 +450,20 @@ static void
> test_plane_rotation_exhaust_fences(data_t *data,
>  		ret = (__kms_addfb(fd, gem_handle, w, h, stride,
>  		       format, tiling, NULL,
>  		       LOCAL_DRM_MODE_FB_MODIFIERS,
> -		       &data2[i].fb.fb_id));
> +		       &fb[i].fb_id));
>  		if (ret) {
>  			igt_warn("failed to create framebuffer\n");
>  			goto err_alloc;
>  		}
>  
> -		data2[i].fb.width = w;
> -		data2[i].fb.height = h;
> -		data2[i].fb.gem_handle = gem_handle;
> +		fb[i].width = w;
> +		fb[i].height = h;
> +		fb[i].gem_handle = gem_handle;
>  
> -		igt_plane_set_fb(plane, &data2[i].fb);
> +		igt_plane_set_fb(plane, &fb[i]);
>  		igt_plane_set_rotation(plane, IGT_ROTATION_0);
>  
> -		ret = igt_display_try_commit2(display, commit);
> +		igt_display_commit2(display, COMMIT_ATOMIC);
>  		if (ret) {
>  			igt_warn("failed to commit unrotated fb\n");
>  			goto err_commit;
> @@ -544,7 +472,7 @@ static void
> test_plane_rotation_exhaust_fences(data_t *data,
>  		igt_plane_set_rotation(plane, IGT_ROTATION_90);
>  		igt_plane_set_size(plane, h, w);
>  
> -		igt_display_commit2(display, commit);
> +		igt_display_commit2(display, COMMIT_ATOMIC);
>  		if (ret) {
>  			igt_warn("failed to commit hardware rotated
> fb: %i\n", ret);
>  			goto err_commit;
> @@ -557,19 +485,9 @@ err_alloc:
>  
>  	i--;
>  err_commit:
> -	igt_plane_set_fb(plane, NULL);
> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> -
> -	if (commit < COMMIT_ATOMIC)
> -		igt_display_commit2(display, commit);
> -
> -	igt_output_set_pipe(output, PIPE_NONE);
> -	igt_display_commit2(display, display->is_atomic ?
> COMMIT_ATOMIC : COMMIT_LEGACY);
> -
>  	for (; i >= 0; i--)
> -		igt_remove_fb(fd, &data2[i].fb);
> +		igt_remove_fb(fd, &fb[i]);
>  
> -	kmstest_restore_vt_mode();
>  	igt_assert_eq(ret, 0);
>  }
>  
> @@ -726,9 +644,10 @@ igt_main
>  		igt_require(gen >= 9);
>  
>  		for_each_pipe_with_valid_output(&data.display, pipe,
> output) {
> -			igt_output_set_pipe(output, pipe);
> +			igt_plane_t *primary =
> &data.display.pipes[pipe].planes[0];
> +			prepare_crtc(&data, output, pipe, primary);
>  
> -			test_plane_rotation_exhaust_fences(&data,
> output, DRM_PLANE_TYPE_PRIMARY);
> +			test_plane_rotation_exhaust_fences(&data,
> output, primary);
>  
>  			valid_tests++;
>  			break;
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic.
  2018-02-07  8:55   ` Mika Kahola
@ 2018-02-07  9:46     ` Maarten Lankhorst
  2018-02-07 10:37       ` Mika Kahola
  0 siblings, 1 reply; 24+ messages in thread
From: Maarten Lankhorst @ 2018-02-07  9:46 UTC (permalink / raw)
  To: mika.kahola, igt-dev

Op 07-02-18 om 09:55 schreef Mika Kahola:
> On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
>> This won't clean up resources between subtests, so if subtests fail
>> the next subtest will clean up everything. This allows all subtests
>> even if one fails.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>  tests/kms_rotation_crc.c | 213 +++++++++++++++--------------------
>> ------------
>>  1 file changed, 66 insertions(+), 147 deletions(-)
>>
>> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
>> index 52a85fb62f9f..a0fb734d02f6 100644
>> --- a/tests/kms_rotation_crc.c
>> +++ b/tests/kms_rotation_crc.c
>> @@ -33,7 +33,6 @@ typedef struct {
>>  	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;
>>  	igt_crc_t flip_crc;
>> @@ -122,68 +121,50 @@ paint_squares(data_t *data, igt_rotation_t
>> rotation,
>>  	igt_put_cairo_ctx(data->gfx_fd, fb, cr);
>>  }
>>  
>> -static void prepare_crtc(data_t *data, igt_output_t *output, enum
>> pipe pipe,
>> -			 igt_plane_t *plane, enum igt_commit_style
>> commit)
>> +static void remove_fbs(data_t *data)
>>  {
>> -	drmModeModeInfo *mode;
>> -	unsigned int w, h;
>> -	uint64_t tiling = data->override_tiling ?:
>> LOCAL_DRM_FORMAT_MOD_NONE;
>> -	uint32_t pixel_format = data->override_fmt ?:
>> DRM_FORMAT_XRGB8888;
>> -	igt_display_t *display = &data->display;
>> -	igt_plane_t *primary = igt_output_get_plane_type(output,
>> DRM_PLANE_TYPE_PRIMARY);
>> +	if (data->fb.fb_id)
>> +		igt_remove_fb(data->gfx_fd, &data->fb);
>>  
>> -	igt_output_set_pipe(output, pipe);
>> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> +	if (data->fb_reference.fb_id)
>> +		igt_remove_fb(data->gfx_fd, &data->fb_reference);
>>  
>> -	/* create the pipe_crc object for this pipe */
>> -	igt_pipe_crc_free(data->pipe_crc);
>> -	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
>> INTEL_PIPE_CRC_SOURCE_AUTO);
>> -
>> -	mode = igt_output_get_mode(output);
>> +	if (data->fb_unrotated.fb_id)
>> +		igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
>>  
>> -	w = mode->hdisplay;
>> -	h = mode->vdisplay;
>> -
>> -	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
>> &data->fb_modeset);
>> +	if (data->fb_flip.fb_id)
>> +		igt_remove_fb(data->gfx_fd, &data->fb_flip);
>>  
>> -	/*
>> -	 * With igt_display_commit2 and COMMIT_UNIVERSAL, we call
>> just the
>> -	 * setplane without a modeset. So, to be able to call
>> -	 * igt_display_commit and ultimately setcrtc to do the first
>> modeset,
>> -	 * we create an fb covering the crtc and call commit
>> -	 *
>> -	 * It's also a good idea to set a primary fb on the primary
>> plane
>> -	 * regardless, to force a underrun when watermarks are
>> allocated
>> -	 * incorrectly for other planes.
>> -	 */
>> -	igt_plane_set_fb(primary, &data->fb_modeset);
>> +	data->fb_flip.fb_id = data->fb_reference.fb_id = data-
>>> fb_unrotated.fb_id = data->fb.fb_id = 0;
>> +}
>>  
>> -	if (commit < COMMIT_ATOMIC) {
>> -		igt_plane_clear_prop_changed(primary,
>> IGT_PLANE_ROTATION);
>> -		igt_display_commit(display);
>> +static void cleanup_crtc(data_t *data)
>> +{
>> +	igt_display_t *display = &data->display;
>>  
>> -		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
>> -			igt_plane_set_prop_changed(primary,
>> IGT_PLANE_ROTATION);
>> -	}
>> +	igt_pipe_crc_free(data->pipe_crc);
>> +	data->pipe_crc = NULL;
>>  
>> -	igt_plane_set_fb(plane, NULL);
>> +	remove_fbs(data);
>>  
>> -	igt_display_commit2(display, commit);
>> +	igt_display_reset(display);
>>  }
>>  
>> -static void remove_fbs(data_t *data)
>> +static void prepare_crtc(data_t *data, igt_output_t *output, enum
>> pipe pipe,
>> +			 igt_plane_t *plane)
>>  {
>> -	if (!data->fb.fb_id)
>> -		return;
>> +	igt_display_t *display = &data->display;
>>  
>> -	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);
>> +	cleanup_crtc(data);
>>  
>> -	if (data->fb_flip.fb_id)
>> -		igt_remove_fb(data->gfx_fd, &data->fb_flip);
>> +	igt_output_set_pipe(output, pipe);
>> +	igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> +
>> +	/* create the pipe_crc object for this pipe */
>> +	igt_pipe_crc_free(data->pipe_crc);
>> +	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
>> INTEL_PIPE_CRC_SOURCE_AUTO);
>>  
>> -	data->fb_flip.fb_id = data->fb.fb_id = 0;
>> +	igt_display_commit2(display, COMMIT_ATOMIC);
>>  }
>>  
>>  enum rectangle_type {
>> @@ -206,7 +187,7 @@ static void prepare_fbs(data_t *data,
>> igt_output_t *output,
>>  
>>  	if (data->fb.fb_id) {
>>  		igt_plane_set_fb(plane, NULL);
>> -		igt_display_commit2(display, display->is_atomic ?
>> COMMIT_ATOMIC : COMMIT_UNIVERSAL);
>> +		igt_display_commit2(display, COMMIT_ATOMIC);
> Should we keep the legacy commit here or should we have a requirement
> for this test that it runs only atomic?
Hey,

Only the 180° tests won't run on gen4 without i915.nuclear_pageflip=1, at least until gen3 wm patch series is finally merged. But they are never run in CI (shards) anyway .
So in practice the requirement doesn't matter and if we do care then we should get those in finally...

~Maarten

>>  
>>  		remove_fbs(data);
>>  	}
>> @@ -259,28 +240,24 @@ static void prepare_fbs(data_t *data,
>> igt_output_t *output,
>>  	/*
>>  	 * Create a reference software rotated flip framebuffer.
>>  	 */
>> -	if (plane->type == DRM_PLANE_TYPE_PRIMARY || display-
>>> is_atomic) {
>> -		igt_create_fb(data->gfx_fd, ref_w, ref_h,
>> pixel_format, tiling,
>> -			      &data->fb_flip);
>> -		paint_squares(data, data->rotation, &data->fb_flip,
>> -			      flip_opacity);
>> -		igt_plane_set_fb(plane, &data->fb_flip);
>> -		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);
>> -		igt_pipe_crc_collect_crc(data->pipe_crc, &data-
>>> flip_crc);
>> -
>> -		/*
>> -		 * Prepare the non-rotated flip fb.
>> -		 */
>> -		igt_remove_fb(data->gfx_fd, &data->fb_flip);
>> -		igt_create_fb(data->gfx_fd, w, h, pixel_format,
>> tiling,
>> -			      &data->fb_flip);
>> -		paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
>> -			      flip_opacity);
>> -	}
>> +	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
>> tiling,
>> +		      &data->fb_flip);
>> +	paint_squares(data, data->rotation, &data->fb_flip,
>> +		      flip_opacity);
>> +	igt_plane_set_fb(plane, &data->fb_flip);
>> +	if (plane->type != DRM_PLANE_TYPE_CURSOR)
>> +		igt_plane_set_position(plane, data->pos_x, data-
>>> pos_y);
>> +	igt_display_commit2(display, COMMIT_ATOMIC);
>> +	igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
>> +
>> +	/*
>> +	  * Prepare the non-rotated flip fb.
>> +	  */
>> +	igt_remove_fb(data->gfx_fd, &data->fb_flip);
>> +	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
>> +		      &data->fb_flip);
>> +	paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
>> +		      flip_opacity);
>>  
>>  	/*
>>  	 * Create a reference CRC for a software-rotated fb.
>> @@ -292,7 +269,7 @@ static void prepare_fbs(data_t *data,
>> igt_output_t *output,
>>  	igt_plane_set_fb(plane, &data->fb_reference);
>>  	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);
>> +	igt_display_commit2(display, COMMIT_ATOMIC);
>>  
>>  	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
>>  
>> @@ -305,7 +282,7 @@ static void prepare_fbs(data_t *data,
>> igt_output_t *output,
>>  	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);
>> +	igt_display_commit2(display, COMMIT_ATOMIC);
>>  
>>  	/*
>>  	 * Prepare the plane with an non-rotated fb let the hw
>> rotate it.
>> @@ -318,35 +295,6 @@ static void prepare_fbs(data_t *data,
>> igt_output_t *output,
>>  		igt_plane_set_position(plane, data->pos_x, data-
>>> pos_y);
>>  }
>>  
>> -static void cleanup_crtc(data_t *data, igt_output_t *output,
>> igt_plane_t *plane)
>> -{
>> -	igt_display_t *display = &data->display;
>> -
>> -	igt_pipe_crc_free(data->pipe_crc);
>> -	data->pipe_crc = NULL;
>> -
>> -	remove_fbs(data);
>> -
>> -	igt_remove_fb(data->gfx_fd, &data->fb_modeset);
>> -
>> -	/* XXX: see the note in prepare_crtc() */
>> -	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
>> -		igt_plane_t *primary;
>> -
>> -		primary = igt_output_get_plane_type(output,
>> DRM_PLANE_TYPE_PRIMARY);
>> -		igt_plane_set_fb(primary, NULL);
>> -	}
>> -
>> -	igt_plane_set_fb(plane, NULL);
>> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> -
>> -	igt_display_commit2(display, COMMIT_UNIVERSAL);
>> -
>> -	igt_output_set_pipe(output, PIPE_ANY);
>> -
>> -	igt_display_commit(display);
>> -}
>> -
>>  static void wait_for_pageflip(int fd)
>>  {
>>  	drmEventContext evctx = { .version = 2 };
>> @@ -371,18 +319,11 @@ static void test_plane_rotation(data_t *data,
>> int plane_type, bool test_bad_form
>>  	enum pipe pipe;
>>  	int valid_tests = 0;
>>  	igt_crc_t crc_output;
>> -	enum igt_commit_style commit = COMMIT_LEGACY;
>>  	int ret;
>>  
>> -	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
>> DRM_PLANE_TYPE_CURSOR)
>> -		commit = COMMIT_UNIVERSAL;
>> -
>>  	if (plane_type == DRM_PLANE_TYPE_CURSOR)
>>  		igt_require(display->has_cursor_plane);
>>  
>> -	if (data->display.is_atomic)
>> -		commit = COMMIT_ATOMIC;
>> -
>>  	for_each_pipe_with_valid_output(display, pipe, output) {
>>  		igt_plane_t *plane;
>>  		int i;
>> @@ -395,7 +336,7 @@ static void test_plane_rotation(data_t *data, int
>> plane_type, bool test_bad_form
>>  		plane = igt_output_get_plane_type(output,
>> plane_type);
>>  		igt_require(igt_plane_has_prop(plane,
>> IGT_PLANE_ROTATION));
>>  
>> -		prepare_crtc(data, output, pipe, plane, commit);
>> +		prepare_crtc(data, output, pipe, plane);
>>  
>>  		for (i = 0; i < num_rectangle_types; i++) {
>>  			/* Unsupported on i915 */
>> @@ -415,7 +356,7 @@ static void test_plane_rotation(data_t *data, int
>> plane_type, bool test_bad_form
>>  			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);
>> +			ret = igt_display_try_commit2(display,
>> COMMIT_ATOMIC);
>>  			if (test_bad_format) {
>>  				igt_assert_eq(ret, -EINVAL);
>>  				continue;
>> @@ -456,41 +397,28 @@ static void test_plane_rotation(data_t *data,
>> int plane_type, bool test_bad_form
>>  		}
>>  
>>  		valid_tests++;
>> -		cleanup_crtc(data, output, plane);
>>  	}
>>  	igt_require_f(valid_tests, "no valid crtc/connector
>> combinations found\n");
>>  }
>>  
>>  static void test_plane_rotation_exhaust_fences(data_t *data,
>>  					       igt_output_t *output,
>> -					       int plane_type)
>> +					       igt_plane_t *plane)
>>  {
>>  	igt_display_t *display = &data->display;
>>  	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
>>  	uint32_t format = DRM_FORMAT_XRGB8888;
>>  	int bpp = igt_drm_format_to_bpp(format);
>> -	enum igt_commit_style commit = COMMIT_LEGACY;
>>  	int fd = data->gfx_fd;
>> -	igt_plane_t *plane;
>>  	drmModeModeInfo *mode;
>> -	data_t data2[MAX_FENCES+1] = {};
>> +	struct igt_fb fb[MAX_FENCES+1] = {};
>>  	unsigned int stride, size, w, h;
>>  	uint32_t gem_handle;
>>  	uint64_t total_aperture_size, total_fbs_size;
>>  	int i, ret;
>>  
>> -	plane = igt_output_get_plane_type(output, plane_type);
>>  	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
>>  
>> -	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type ==
>> DRM_PLANE_TYPE_CURSOR)
>> -		commit = COMMIT_UNIVERSAL;
>> -
>> -	if (plane_type == DRM_PLANE_TYPE_CURSOR)
>> -		igt_require(display->has_cursor_plane);
>> -
>> -	if (data->display.is_atomic)
>> -		commit = COMMIT_ATOMIC;
>> -
>>  	mode = igt_output_get_mode(output);
>>  	w = mode->hdisplay;
>>  	h = mode->vdisplay;
>> @@ -509,7 +437,7 @@ static void
>> test_plane_rotation_exhaust_fences(data_t *data,
>>  	igt_require(total_fbs_size < total_aperture_size * 0.9);
>>  
>>  	igt_plane_set_fb(plane, NULL);
>> -	igt_display_commit(display);
>> +	igt_display_commit2(display, COMMIT_ATOMIC);
>>  
>>  	for (i = 0; i < MAX_FENCES + 1; i++) {
>>  		gem_handle = gem_create(fd, size);
>> @@ -522,20 +450,20 @@ static void
>> test_plane_rotation_exhaust_fences(data_t *data,
>>  		ret = (__kms_addfb(fd, gem_handle, w, h, stride,
>>  		       format, tiling, NULL,
>>  		       LOCAL_DRM_MODE_FB_MODIFIERS,
>> -		       &data2[i].fb.fb_id));
>> +		       &fb[i].fb_id));
>>  		if (ret) {
>>  			igt_warn("failed to create framebuffer\n");
>>  			goto err_alloc;
>>  		}
>>  
>> -		data2[i].fb.width = w;
>> -		data2[i].fb.height = h;
>> -		data2[i].fb.gem_handle = gem_handle;
>> +		fb[i].width = w;
>> +		fb[i].height = h;
>> +		fb[i].gem_handle = gem_handle;
>>  
>> -		igt_plane_set_fb(plane, &data2[i].fb);
>> +		igt_plane_set_fb(plane, &fb[i]);
>>  		igt_plane_set_rotation(plane, IGT_ROTATION_0);
>>  
>> -		ret = igt_display_try_commit2(display, commit);
>> +		igt_display_commit2(display, COMMIT_ATOMIC);
>>  		if (ret) {
>>  			igt_warn("failed to commit unrotated fb\n");
>>  			goto err_commit;
>> @@ -544,7 +472,7 @@ static void
>> test_plane_rotation_exhaust_fences(data_t *data,
>>  		igt_plane_set_rotation(plane, IGT_ROTATION_90);
>>  		igt_plane_set_size(plane, h, w);
>>  
>> -		igt_display_commit2(display, commit);
>> +		igt_display_commit2(display, COMMIT_ATOMIC);
>>  		if (ret) {
>>  			igt_warn("failed to commit hardware rotated
>> fb: %i\n", ret);
>>  			goto err_commit;
>> @@ -557,19 +485,9 @@ err_alloc:
>>  
>>  	i--;
>>  err_commit:
>> -	igt_plane_set_fb(plane, NULL);
>> -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
>> -
>> -	if (commit < COMMIT_ATOMIC)
>> -		igt_display_commit2(display, commit);
>> -
>> -	igt_output_set_pipe(output, PIPE_NONE);
>> -	igt_display_commit2(display, display->is_atomic ?
>> COMMIT_ATOMIC : COMMIT_LEGACY);
>> -
>>  	for (; i >= 0; i--)
>> -		igt_remove_fb(fd, &data2[i].fb);
>> +		igt_remove_fb(fd, &fb[i]);
>>  
>> -	kmstest_restore_vt_mode();
>>  	igt_assert_eq(ret, 0);
>>  }
>>  
>> @@ -726,9 +644,10 @@ igt_main
>>  		igt_require(gen >= 9);
>>  
>>  		for_each_pipe_with_valid_output(&data.display, pipe,
>> output) {
>> -			igt_output_set_pipe(output, pipe);
>> +			igt_plane_t *primary =
>> &data.display.pipes[pipe].planes[0];
>> +			prepare_crtc(&data, output, pipe, primary);
>>  
>> -			test_plane_rotation_exhaust_fences(&data,
>> output, DRM_PLANE_TYPE_PRIMARY);
>> +			test_plane_rotation_exhaust_fences(&data,
>> output, primary);
>>  
>>  			valid_tests++;
>>  			break;


_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic.
  2018-02-07  9:46     ` Maarten Lankhorst
@ 2018-02-07 10:37       ` Mika Kahola
  0 siblings, 0 replies; 24+ messages in thread
From: Mika Kahola @ 2018-02-07 10:37 UTC (permalink / raw)
  To: Maarten Lankhorst, igt-dev

On Wed, 2018-02-07 at 10:46 +0100, Maarten Lankhorst wrote:
> Op 07-02-18 om 09:55 schreef Mika Kahola:
> > 
> > On Thu, 2018-02-01 at 16:39 +0100, Maarten Lankhorst wrote:
> > > 
> > > This won't clean up resources between subtests, so if subtests
> > > fail
> > > the next subtest will clean up everything. This allows all
> > > subtests
> > > even if one fails.
> > > 
> > > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.c
> > > om>
> > > ---
> > >  tests/kms_rotation_crc.c | 213 +++++++++++++++----------------
> > > ----
> > > ------------
> > >  1 file changed, 66 insertions(+), 147 deletions(-)
> > > 
> > > diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> > > index 52a85fb62f9f..a0fb734d02f6 100644
> > > --- a/tests/kms_rotation_crc.c
> > > +++ b/tests/kms_rotation_crc.c
> > > @@ -33,7 +33,6 @@ typedef struct {
> > >  	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;
> > >  	igt_crc_t flip_crc;
> > > @@ -122,68 +121,50 @@ paint_squares(data_t *data, igt_rotation_t
> > > rotation,
> > >  	igt_put_cairo_ctx(data->gfx_fd, fb, cr);
> > >  }
> > >  
> > > -static void prepare_crtc(data_t *data, igt_output_t *output,
> > > enum
> > > pipe pipe,
> > > -			 igt_plane_t *plane, enum
> > > igt_commit_style
> > > commit)
> > > +static void remove_fbs(data_t *data)
> > >  {
> > > -	drmModeModeInfo *mode;
> > > -	unsigned int w, h;
> > > -	uint64_t tiling = data->override_tiling ?:
> > > LOCAL_DRM_FORMAT_MOD_NONE;
> > > -	uint32_t pixel_format = data->override_fmt ?:
> > > DRM_FORMAT_XRGB8888;
> > > -	igt_display_t *display = &data->display;
> > > -	igt_plane_t *primary = igt_output_get_plane_type(output,
> > > DRM_PLANE_TYPE_PRIMARY);
> > > +	if (data->fb.fb_id)
> > > +		igt_remove_fb(data->gfx_fd, &data->fb);
> > >  
> > > -	igt_output_set_pipe(output, pipe);
> > > -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> > > +	if (data->fb_reference.fb_id)
> > > +		igt_remove_fb(data->gfx_fd, &data-
> > > >fb_reference);
> > >  
> > > -	/* create the pipe_crc object for this pipe */
> > > -	igt_pipe_crc_free(data->pipe_crc);
> > > -	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> > > INTEL_PIPE_CRC_SOURCE_AUTO);
> > > -
> > > -	mode = igt_output_get_mode(output);
> > > +	if (data->fb_unrotated.fb_id)
> > > +		igt_remove_fb(data->gfx_fd, &data-
> > > >fb_unrotated);
> > >  
> > > -	w = mode->hdisplay;
> > > -	h = mode->vdisplay;
> > > -
> > > -	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
> > > &data->fb_modeset);
> > > +	if (data->fb_flip.fb_id)
> > > +		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> > >  
> > > -	/*
> > > -	 * With igt_display_commit2 and COMMIT_UNIVERSAL, we
> > > call
> > > just the
> > > -	 * setplane without a modeset. So, to be able to call
> > > -	 * igt_display_commit and ultimately setcrtc to do the
> > > first
> > > modeset,
> > > -	 * we create an fb covering the crtc and call commit
> > > -	 *
> > > -	 * It's also a good idea to set a primary fb on the
> > > primary
> > > plane
> > > -	 * regardless, to force a underrun when watermarks are
> > > allocated
> > > -	 * incorrectly for other planes.
> > > -	 */
> > > -	igt_plane_set_fb(primary, &data->fb_modeset);
> > > +	data->fb_flip.fb_id = data->fb_reference.fb_id = data-
> > > > 
> > > > fb_unrotated.fb_id = data->fb.fb_id = 0;
> > > +}
> > >  
> > > -	if (commit < COMMIT_ATOMIC) {
> > > -		igt_plane_clear_prop_changed(primary,
> > > IGT_PLANE_ROTATION);
> > > -		igt_display_commit(display);
> > > +static void cleanup_crtc(data_t *data)
> > > +{
> > > +	igt_display_t *display = &data->display;
> > >  
> > > -		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> > > -			igt_plane_set_prop_changed(primary,
> > > IGT_PLANE_ROTATION);
> > > -	}
> > > +	igt_pipe_crc_free(data->pipe_crc);
> > > +	data->pipe_crc = NULL;
> > >  
> > > -	igt_plane_set_fb(plane, NULL);
> > > +	remove_fbs(data);
> > >  
> > > -	igt_display_commit2(display, commit);
> > > +	igt_display_reset(display);
> > >  }
> > >  
> > > -static void remove_fbs(data_t *data)
> > > +static void prepare_crtc(data_t *data, igt_output_t *output,
> > > enum
> > > pipe pipe,
> > > +			 igt_plane_t *plane)
> > >  {
> > > -	if (!data->fb.fb_id)
> > > -		return;
> > > +	igt_display_t *display = &data->display;
> > >  
> > > -	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);
> > > +	cleanup_crtc(data);
> > >  
> > > -	if (data->fb_flip.fb_id)
> > > -		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> > > +	igt_output_set_pipe(output, pipe);
> > > +	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> > > +
> > > +	/* create the pipe_crc object for this pipe */
> > > +	igt_pipe_crc_free(data->pipe_crc);
> > > +	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> > > INTEL_PIPE_CRC_SOURCE_AUTO);
> > >  
> > > -	data->fb_flip.fb_id = data->fb.fb_id = 0;
> > > +	igt_display_commit2(display, COMMIT_ATOMIC);
> > >  }
> > >  
> > >  enum rectangle_type {
> > > @@ -206,7 +187,7 @@ static void prepare_fbs(data_t *data,
> > > igt_output_t *output,
> > >  
> > >  	if (data->fb.fb_id) {
> > >  		igt_plane_set_fb(plane, NULL);
> > > -		igt_display_commit2(display, display->is_atomic
> > > ?
> > > COMMIT_ATOMIC : COMMIT_UNIVERSAL);
> > > +		igt_display_commit2(display, COMMIT_ATOMIC);
> > Should we keep the legacy commit here or should we have a
> > requirement
> > for this test that it runs only atomic?
> Hey,
> 
> Only the 180° tests won't run on gen4 without
> i915.nuclear_pageflip=1, at least until gen3 wm patch series is
> finally merged. But they are never run in CI (shards) anyway .
> So in practice the requirement doesn't matter and if we do care then
> we should get those in finally...

Ok. Let's discard this. Otherwise, the patch looks good.

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> 
> ~Maarten
> 
> > 
> > > 
> > >  
> > >  		remove_fbs(data);
> > >  	}
> > > @@ -259,28 +240,24 @@ static void prepare_fbs(data_t *data,
> > > igt_output_t *output,
> > >  	/*
> > >  	 * Create a reference software rotated flip framebuffer.
> > >  	 */
> > > -	if (plane->type == DRM_PLANE_TYPE_PRIMARY || display-
> > > > 
> > > > is_atomic) {
> > > -		igt_create_fb(data->gfx_fd, ref_w, ref_h,
> > > pixel_format, tiling,
> > > -			      &data->fb_flip);
> > > -		paint_squares(data, data->rotation, &data-
> > > >fb_flip,
> > > -			      flip_opacity);
> > > -		igt_plane_set_fb(plane, &data->fb_flip);
> > > -		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);
> > > -		igt_pipe_crc_collect_crc(data->pipe_crc, &data-
> > > > 
> > > > flip_crc);
> > > -
> > > -		/*
> > > -		 * Prepare the non-rotated flip fb.
> > > -		 */
> > > -		igt_remove_fb(data->gfx_fd, &data->fb_flip);
> > > -		igt_create_fb(data->gfx_fd, w, h, pixel_format,
> > > tiling,
> > > -			      &data->fb_flip);
> > > -		paint_squares(data, IGT_ROTATION_0, &data-
> > > >fb_flip,
> > > -			      flip_opacity);
> > > -	}
> > > +	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
> > > tiling,
> > > +		      &data->fb_flip);
> > > +	paint_squares(data, data->rotation, &data->fb_flip,
> > > +		      flip_opacity);
> > > +	igt_plane_set_fb(plane, &data->fb_flip);
> > > +	if (plane->type != DRM_PLANE_TYPE_CURSOR)
> > > +		igt_plane_set_position(plane, data->pos_x, data-
> > > > 
> > > > pos_y);
> > > +	igt_display_commit2(display, COMMIT_ATOMIC);
> > > +	igt_pipe_crc_collect_crc(data->pipe_crc, &data-
> > > >flip_crc);
> > > +
> > > +	/*
> > > +	  * Prepare the non-rotated flip fb.
> > > +	  */
> > > +	igt_remove_fb(data->gfx_fd, &data->fb_flip);
> > > +	igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling,
> > > +		      &data->fb_flip);
> > > +	paint_squares(data, IGT_ROTATION_0, &data->fb_flip,
> > > +		      flip_opacity);
> > >  
> > >  	/*
> > >  	 * Create a reference CRC for a software-rotated fb.
> > > @@ -292,7 +269,7 @@ static void prepare_fbs(data_t *data,
> > > igt_output_t *output,
> > >  	igt_plane_set_fb(plane, &data->fb_reference);
> > >  	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);
> > > +	igt_display_commit2(display, COMMIT_ATOMIC);
> > >  
> > >  	igt_pipe_crc_collect_crc(data->pipe_crc, &data-
> > > >ref_crc);
> > >  
> > > @@ -305,7 +282,7 @@ static void prepare_fbs(data_t *data,
> > > igt_output_t *output,
> > >  	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);
> > > +	igt_display_commit2(display, COMMIT_ATOMIC);
> > >  
> > >  	/*
> > >  	 * Prepare the plane with an non-rotated fb let the hw
> > > rotate it.
> > > @@ -318,35 +295,6 @@ static void prepare_fbs(data_t *data,
> > > igt_output_t *output,
> > >  		igt_plane_set_position(plane, data->pos_x, data-
> > > > 
> > > > pos_y);
> > >  }
> > >  
> > > -static void cleanup_crtc(data_t *data, igt_output_t *output,
> > > igt_plane_t *plane)
> > > -{
> > > -	igt_display_t *display = &data->display;
> > > -
> > > -	igt_pipe_crc_free(data->pipe_crc);
> > > -	data->pipe_crc = NULL;
> > > -
> > > -	remove_fbs(data);
> > > -
> > > -	igt_remove_fb(data->gfx_fd, &data->fb_modeset);
> > > -
> > > -	/* XXX: see the note in prepare_crtc() */
> > > -	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> > > -		igt_plane_t *primary;
> > > -
> > > -		primary = igt_output_get_plane_type(output,
> > > DRM_PLANE_TYPE_PRIMARY);
> > > -		igt_plane_set_fb(primary, NULL);
> > > -	}
> > > -
> > > -	igt_plane_set_fb(plane, NULL);
> > > -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> > > -
> > > -	igt_display_commit2(display, COMMIT_UNIVERSAL);
> > > -
> > > -	igt_output_set_pipe(output, PIPE_ANY);
> > > -
> > > -	igt_display_commit(display);
> > > -}
> > > -
> > >  static void wait_for_pageflip(int fd)
> > >  {
> > >  	drmEventContext evctx = { .version = 2 };
> > > @@ -371,18 +319,11 @@ static void test_plane_rotation(data_t
> > > *data,
> > > int plane_type, bool test_bad_form
> > >  	enum pipe pipe;
> > >  	int valid_tests = 0;
> > >  	igt_crc_t crc_output;
> > > -	enum igt_commit_style commit = COMMIT_LEGACY;
> > >  	int ret;
> > >  
> > > -	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type
> > > ==
> > > DRM_PLANE_TYPE_CURSOR)
> > > -		commit = COMMIT_UNIVERSAL;
> > > -
> > >  	if (plane_type == DRM_PLANE_TYPE_CURSOR)
> > >  		igt_require(display->has_cursor_plane);
> > >  
> > > -	if (data->display.is_atomic)
> > > -		commit = COMMIT_ATOMIC;
> > > -
> > >  	for_each_pipe_with_valid_output(display, pipe, output) {
> > >  		igt_plane_t *plane;
> > >  		int i;
> > > @@ -395,7 +336,7 @@ static void test_plane_rotation(data_t *data,
> > > int
> > > plane_type, bool test_bad_form
> > >  		plane = igt_output_get_plane_type(output,
> > > plane_type);
> > >  		igt_require(igt_plane_has_prop(plane,
> > > IGT_PLANE_ROTATION));
> > >  
> > > -		prepare_crtc(data, output, pipe, plane, commit);
> > > +		prepare_crtc(data, output, pipe, plane);
> > >  
> > >  		for (i = 0; i < num_rectangle_types; i++) {
> > >  			/* Unsupported on i915 */
> > > @@ -415,7 +356,7 @@ static void test_plane_rotation(data_t *data,
> > > int
> > > plane_type, bool test_bad_form
> > >  			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);
> > > +			ret = igt_display_try_commit2(display,
> > > COMMIT_ATOMIC);
> > >  			if (test_bad_format) {
> > >  				igt_assert_eq(ret, -EINVAL);
> > >  				continue;
> > > @@ -456,41 +397,28 @@ static void test_plane_rotation(data_t
> > > *data,
> > > int plane_type, bool test_bad_form
> > >  		}
> > >  
> > >  		valid_tests++;
> > > -		cleanup_crtc(data, output, plane);
> > >  	}
> > >  	igt_require_f(valid_tests, "no valid crtc/connector
> > > combinations found\n");
> > >  }
> > >  
> > >  static void test_plane_rotation_exhaust_fences(data_t *data,
> > >  					       igt_output_t
> > > *output,
> > > -					       int plane_type)
> > > +					       igt_plane_t
> > > *plane)
> > >  {
> > >  	igt_display_t *display = &data->display;
> > >  	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
> > >  	uint32_t format = DRM_FORMAT_XRGB8888;
> > >  	int bpp = igt_drm_format_to_bpp(format);
> > > -	enum igt_commit_style commit = COMMIT_LEGACY;
> > >  	int fd = data->gfx_fd;
> > > -	igt_plane_t *plane;
> > >  	drmModeModeInfo *mode;
> > > -	data_t data2[MAX_FENCES+1] = {};
> > > +	struct igt_fb fb[MAX_FENCES+1] = {};
> > >  	unsigned int stride, size, w, h;
> > >  	uint32_t gem_handle;
> > >  	uint64_t total_aperture_size, total_fbs_size;
> > >  	int i, ret;
> > >  
> > > -	plane = igt_output_get_plane_type(output, plane_type);
> > >  	igt_require(igt_plane_has_prop(plane,
> > > IGT_PLANE_ROTATION));
> > >  
> > > -	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type
> > > ==
> > > DRM_PLANE_TYPE_CURSOR)
> > > -		commit = COMMIT_UNIVERSAL;
> > > -
> > > -	if (plane_type == DRM_PLANE_TYPE_CURSOR)
> > > -		igt_require(display->has_cursor_plane);
> > > -
> > > -	if (data->display.is_atomic)
> > > -		commit = COMMIT_ATOMIC;
> > > -
> > >  	mode = igt_output_get_mode(output);
> > >  	w = mode->hdisplay;
> > >  	h = mode->vdisplay;
> > > @@ -509,7 +437,7 @@ static void
> > > test_plane_rotation_exhaust_fences(data_t *data,
> > >  	igt_require(total_fbs_size < total_aperture_size * 0.9);
> > >  
> > >  	igt_plane_set_fb(plane, NULL);
> > > -	igt_display_commit(display);
> > > +	igt_display_commit2(display, COMMIT_ATOMIC);
> > >  
> > >  	for (i = 0; i < MAX_FENCES + 1; i++) {
> > >  		gem_handle = gem_create(fd, size);
> > > @@ -522,20 +450,20 @@ static void
> > > test_plane_rotation_exhaust_fences(data_t *data,
> > >  		ret = (__kms_addfb(fd, gem_handle, w, h, stride,
> > >  		       format, tiling, NULL,
> > >  		       LOCAL_DRM_MODE_FB_MODIFIERS,
> > > -		       &data2[i].fb.fb_id));
> > > +		       &fb[i].fb_id));
> > >  		if (ret) {
> > >  			igt_warn("failed to create
> > > framebuffer\n");
> > >  			goto err_alloc;
> > >  		}
> > >  
> > > -		data2[i].fb.width = w;
> > > -		data2[i].fb.height = h;
> > > -		data2[i].fb.gem_handle = gem_handle;
> > > +		fb[i].width = w;
> > > +		fb[i].height = h;
> > > +		fb[i].gem_handle = gem_handle;
> > >  
> > > -		igt_plane_set_fb(plane, &data2[i].fb);
> > > +		igt_plane_set_fb(plane, &fb[i]);
> > >  		igt_plane_set_rotation(plane, IGT_ROTATION_0);
> > >  
> > > -		ret = igt_display_try_commit2(display, commit);
> > > +		igt_display_commit2(display, COMMIT_ATOMIC);
> > >  		if (ret) {
> > >  			igt_warn("failed to commit unrotated
> > > fb\n");
> > >  			goto err_commit;
> > > @@ -544,7 +472,7 @@ static void
> > > test_plane_rotation_exhaust_fences(data_t *data,
> > >  		igt_plane_set_rotation(plane, IGT_ROTATION_90);
> > >  		igt_plane_set_size(plane, h, w);
> > >  
> > > -		igt_display_commit2(display, commit);
> > > +		igt_display_commit2(display, COMMIT_ATOMIC);
> > >  		if (ret) {
> > >  			igt_warn("failed to commit hardware
> > > rotated
> > > fb: %i\n", ret);
> > >  			goto err_commit;
> > > @@ -557,19 +485,9 @@ err_alloc:
> > >  
> > >  	i--;
> > >  err_commit:
> > > -	igt_plane_set_fb(plane, NULL);
> > > -	igt_plane_set_rotation(plane, IGT_ROTATION_0);
> > > -
> > > -	if (commit < COMMIT_ATOMIC)
> > > -		igt_display_commit2(display, commit);
> > > -
> > > -	igt_output_set_pipe(output, PIPE_NONE);
> > > -	igt_display_commit2(display, display->is_atomic ?
> > > COMMIT_ATOMIC : COMMIT_LEGACY);
> > > -
> > >  	for (; i >= 0; i--)
> > > -		igt_remove_fb(fd, &data2[i].fb);
> > > +		igt_remove_fb(fd, &fb[i]);
> > >  
> > > -	kmstest_restore_vt_mode();
> > >  	igt_assert_eq(ret, 0);
> > >  }
> > >  
> > > @@ -726,9 +644,10 @@ igt_main
> > >  		igt_require(gen >= 9);
> > >  
> > >  		for_each_pipe_with_valid_output(&data.display,
> > > pipe,
> > > output) {
> > > -			igt_output_set_pipe(output, pipe);
> > > +			igt_plane_t *primary =
> > > &data.display.pipes[pipe].planes[0];
> > > +			prepare_crtc(&data, output, pipe,
> > > primary);
> > >  
> > > -			test_plane_rotation_exhaust_fences(&data
> > > ,
> > > output, DRM_PLANE_TYPE_PRIMARY);
> > > +			test_plane_rotation_exhaust_fences(&data
> > > ,
> > > output, primary);
> > >  
> > >  			valid_tests++;
> > >  			break;
> 
-- 
Mika Kahola - Intel OTC

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-02-07 10:37 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code Maarten Lankhorst
2018-02-05 10:50   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 2/9] tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch Maarten Lankhorst
2018-02-05 10:53   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation Maarten Lankhorst
2018-02-05 11:14   ` Mika Kahola
2018-02-05 11:15     ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 4/9] tests/kms_plane_scaling: Test all pixel formats with clamping and clipping too Maarten Lankhorst
2018-02-05 11:47   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 5/9] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
2018-02-06 10:50   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 6/9] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
2018-02-06 10:57   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 7/9] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
2018-02-06 11:39   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 8/9] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
2018-02-06 13:01   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
2018-02-07  8:55   ` Mika Kahola
2018-02-07  9:46     ` Maarten Lankhorst
2018-02-07 10:37       ` Mika Kahola
2018-02-01 16:04 ` [igt-dev] ✓ Fi.CI.BAT: success for tests: Cleanups and NV12 preparations Patchwork
2018-02-01 19:07 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork

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.