diff options
author | Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> | 2021-01-07 17:51:53 +0200 |
---|---|---|
committer | Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> | 2021-01-08 13:11:08 +0200 |
commit | 83c67075a066cbb8a2e4929c18b5e5f4d921aa59 (patch) | |
tree | 680ffe7d21e4df51f2d9122d2f9a77ff4f17d1cb /tests/kms_rotation_crc.c | |
parent | 77a72b9fa5a1dd57e3f8cbde360d1097804615e8 (diff) |
tests/kms_rotation_crc: avoid recalculating refecence crcs
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>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
Diffstat (limited to 'tests/kms_rotation_crc.c')
-rw-r--r-- | tests/kms_rotation_crc.c | 88 |
1 files changed, 52 insertions, 36 deletions
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index ffcc2cc2..be27103f 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,43 +273,50 @@ 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. */ igt_create_fb(data->gfx_fd, w, h, pixel_format, tiling, &data->fb); @@ -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); |