All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] tests/kms_rotation_crc: avoid recalculating refecence crcs
@ 2021-01-05  8:25 Juha-Pekka Heikkila
  2021-01-05  8:25 ` [igt-dev] [PATCH i-g-t 2/2] HAX remove rotation tests from blacklist Juha-Pekka Heikkila
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Juha-Pekka Heikkila @ 2021-01-05  8:25 UTC (permalink / raw)
  To: igt-dev

Get those reference crcs only once since they stay the same.

This reduces generic rotation tests execution time on my ICL from 26s to 14s

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_rotation_crc.c | 88 +++++++++++++++++++++++-----------------
 1 file changed, 50 insertions(+), 38 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index ffcc2cc2e..e160bd901 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -49,6 +49,14 @@ struct p_point{
 	float_t y;
 };
 
+enum rectangle_type {
+	rectangle,
+	square,
+	portrait,
+	landscape,
+	num_rectangle_types /* must be last */
+};
+
 typedef struct {
 	int gfx_fd;
 	igt_display_t display;
@@ -70,6 +78,12 @@ typedef struct {
 
 	bool use_native_resolution;
 	bool extended;
+
+	struct crc_rect_tag {
+		bool valid;
+		igt_crc_t ref_crc;
+		igt_crc_t flip_crc;
+	} crc_rect[num_rectangle_types];
 } data_t;
 
 typedef struct {
@@ -190,14 +204,6 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 		igt_pipe_crc_start(data->pipe_crc);
 }
 
-enum rectangle_type {
-	rectangle,
-	square,
-	portrait,
-	landscape,
-	num_rectangle_types /* must be last */
-};
-
 static void prepare_fbs(data_t *data, igt_output_t *output,
 			igt_plane_t *plane, enum rectangle_type rect, uint32_t format)
 {
@@ -266,43 +272,46 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	 */
 	igt_require(igt_display_has_format_mod(display, pixel_format, tiling));
 
-	/*
-	 * Create a reference software rotated flip framebuffer.
-	 */
-	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);
+	if (!data->crc_rect[rect].valid) {
+		/*
+		* Create a reference software rotated flip framebuffer.
+		*/
+		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_get_current(display->drm_fd, data->pipe_crc, &data->flip_crc);
+		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->crc_rect[rect].flip_crc);
+		igt_remove_fb(data->gfx_fd, &data->fb_flip);
+
+		/*
+		* Create a reference CRC for a software-rotated fb.
+		*/
+		igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
+			data->override_tiling ?: LOCAL_DRM_FORMAT_MOD_NONE, &data->fb_reference);
+		paint_squares(data, data->rotation, &data->fb_reference, 1.0);
+
+		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, COMMIT_ATOMIC);
+
+		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->crc_rect[rect].ref_crc);
+		data->crc_rect[rect].valid = true;
+	}
 
 	/*
 	  * 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.
-	 */
-	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
-		      data->override_tiling ?: LOCAL_DRM_FORMAT_MOD_NONE, &data->fb_reference);
-	paint_squares(data, data->rotation, &data->fb_reference, 1.0);
-
-	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, COMMIT_ATOMIC);
-
-	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->ref_crc);
-
 	/*
 	 * Prepare the plane with an non-rotated fb let the hw rotate it.
 	 */
@@ -341,7 +350,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 
 	/* Check CRC */
 	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
-	igt_assert_crc_equal(&data->ref_crc, &crc_output);
+	igt_assert_crc_equal(&data->crc_rect[rect].ref_crc, &crc_output);
 
 	/*
 	 * If flips are requested flip to a different fb and
@@ -364,8 +373,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 		}
 		kmstest_wait_for_pageflip(data->gfx_fd);
 		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
-		igt_assert_crc_equal(&data->flip_crc,
-				     &crc_output);
+		igt_assert_crc_equal(&data->crc_rect[rect].flip_crc, &crc_output);
 	}
 }
 
@@ -396,6 +404,10 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	enum pipe pipe;
+	int c;
+
+	for (c = 0; c < num_rectangle_types; c++)
+		data->crc_rect[c].valid = false;
 
 	if (plane_type == DRM_PLANE_TYPE_CURSOR)
 		igt_require(display->has_cursor_plane);
-- 
2.28.0

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [igt-dev] [PATCH i-g-t 1/2] tests/kms_rotation_crc: avoid recalculating refecence crcs
@ 2021-01-07 15:51 Juha-Pekka Heikkila
  2021-01-07 16:40 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
  0 siblings, 1 reply; 8+ messages in thread
From: Juha-Pekka Heikkila @ 2021-01-07 15:51 UTC (permalink / raw)
  To: igt-dev

Get those reference crcs only once since they stay the same.

v2: Need to make exception for HSW, there crcs seem to vary across
rendering pipes.

This reduces generic rotation tests execution time on my ICL from 26s to 14s

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_rotation_crc.c | 88 ++++++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 36 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index ffcc2cc2e..be27103fa 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -49,6 +49,14 @@ struct p_point{
 	float_t y;
 };
 
+enum rectangle_type {
+	rectangle,
+	square,
+	portrait,
+	landscape,
+	num_rectangle_types /* must be last */
+};
+
 typedef struct {
 	int gfx_fd;
 	igt_display_t display;
@@ -70,6 +78,12 @@ typedef struct {
 
 	bool use_native_resolution;
 	bool extended;
+
+	struct crc_rect_tag {
+		bool valid;
+		igt_crc_t ref_crc;
+		igt_crc_t flip_crc;
+	} crc_rect[num_rectangle_types];
 } data_t;
 
 typedef struct {
@@ -190,14 +204,6 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 		igt_pipe_crc_start(data->pipe_crc);
 }
 
-enum rectangle_type {
-	rectangle,
-	square,
-	portrait,
-	landscape,
-	num_rectangle_types /* must be last */
-};
-
 static void prepare_fbs(data_t *data, igt_output_t *output,
 			igt_plane_t *plane, enum rectangle_type rect, uint32_t format)
 {
@@ -267,42 +273,49 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	igt_require(igt_display_has_format_mod(display, pixel_format, tiling));
 
 	/*
-	 * Create a reference software rotated flip framebuffer.
+	 * HSW will need to have those CRCs calculated each time, it
+	 * seems to behave different from other platforms.
 	 */
-	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);
+	if (!data->crc_rect[rect].valid || IS_HASWELL(data->devid)) {
+		/*
+		* Create a reference software rotated flip framebuffer.
+		*/
+		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_get_current(display->drm_fd, data->pipe_crc, &data->flip_crc);
+		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->crc_rect[rect].flip_crc);
+		igt_remove_fb(data->gfx_fd, &data->fb_flip);
+
+		/*
+		* Create a reference CRC for a software-rotated fb.
+		*/
+		igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
+			data->override_tiling ?: LOCAL_DRM_FORMAT_MOD_NONE, &data->fb_reference);
+		paint_squares(data, data->rotation, &data->fb_reference, 1.0);
+
+		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, COMMIT_ATOMIC);
+
+		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->crc_rect[rect].ref_crc);
+		data->crc_rect[rect].valid = true;
+	}
 
 	/*
 	  * 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.
-	 */
-	igt_create_fb(data->gfx_fd, ref_w, ref_h, pixel_format,
-		      data->override_tiling ?: LOCAL_DRM_FORMAT_MOD_NONE, &data->fb_reference);
-	paint_squares(data, data->rotation, &data->fb_reference, 1.0);
-
-	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, COMMIT_ATOMIC);
-
-	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->ref_crc);
-
 	/*
 	 * Prepare the plane with an non-rotated fb let the hw rotate it.
 	 */
@@ -341,7 +354,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 
 	/* Check CRC */
 	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
-	igt_assert_crc_equal(&data->ref_crc, &crc_output);
+	igt_assert_crc_equal(&data->crc_rect[rect].ref_crc, &crc_output);
 
 	/*
 	 * If flips are requested flip to a different fb and
@@ -364,8 +377,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 		}
 		kmstest_wait_for_pageflip(data->gfx_fd);
 		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
-		igt_assert_crc_equal(&data->flip_crc,
-				     &crc_output);
+		igt_assert_crc_equal(&data->crc_rect[rect].flip_crc, &crc_output);
 	}
 }
 
@@ -396,6 +408,10 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	enum pipe pipe;
+	int c;
+
+	for (c = 0; c < num_rectangle_types; c++)
+		data->crc_rect[c].valid = false;
 
 	if (plane_type == DRM_PLANE_TYPE_CURSOR)
 		igt_require(display->has_cursor_plane);
-- 
2.28.0

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

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

end of thread, other threads:[~2021-01-07 16:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05  8:25 [igt-dev] [PATCH i-g-t 1/2] tests/kms_rotation_crc: avoid recalculating refecence crcs Juha-Pekka Heikkila
2021-01-05  8:25 ` [igt-dev] [PATCH i-g-t 2/2] HAX remove rotation tests from blacklist Juha-Pekka Heikkila
2021-01-05 11:24 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_rotation_crc: avoid recalculating refecence crcs Patchwork
2021-01-05 13:53 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-01-05 15:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_rotation_crc: avoid recalculating refecence crcs (rev2) Patchwork
2021-01-05 21:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-01-06  4:40 ` [igt-dev] [PATCH i-g-t 1/2] tests/kms_rotation_crc: avoid recalculating refecence crcs Karthik B S
2021-01-07 15:51 Juha-Pekka Heikkila
2021-01-07 16:40 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " 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.