[igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes.

Mika Kahola mika.kahola at intel.com
Mon Feb 12 13:09:50 UTC 2018


On Tue, 2018-02-06 at 11:14 +0100, Maarten Lankhorst wrote:
> The test is modified to test all pixel formats on a plane, unless
> the pixel format is overridden by the subtest.
> 
> Attempting to test all pixel formats requires even more runtime and
> the overhead of toggling crc collection to capture a single CRC
> becomes significant, so keep the crc collection enabled during the
> entire test.
> 
> This reduces the runtime from ~24s to ~16s per subtest on SKL.
> 

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

> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
>  tests/kms_rotation_crc.c | 129 ++++++++++++++++++++++++++++---------
> ----------
>  1 file changed, 77 insertions(+), 52 deletions(-)
> 
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 18c3e13431db..0cd5c6e52b57 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -153,9 +153,10 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
>  
>  	/* 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);
>  
>  	igt_display_commit2(display, COMMIT_ATOMIC);
> +	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
> +	igt_pipe_crc_start(data->pipe_crc);
>  }
>  
>  enum rectangle_type {
> @@ -167,7 +168,7 @@ enum rectangle_type {
>  };
>  
>  static void prepare_fbs(data_t *data, igt_output_t *output,
> -			igt_plane_t *plane, enum rectangle_type
> rect)
> +			igt_plane_t *plane, enum rectangle_type
> rect, uint32_t format)
>  {
>  	drmModeModeInfo *mode;
>  	igt_display_t *display = &data->display;
> @@ -234,7 +235,8 @@ 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);
>  	igt_display_commit2(display, COMMIT_ATOMIC);
> -	igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
> +	igt_pipe_crc_drain(data->pipe_crc);
> +	igt_pipe_crc_get_single(data->pipe_crc, &data->flip_crc);
>  
>  	/*
>  	  * Prepare the non-rotated flip fb.
> @@ -257,7 +259,8 @@ static void prepare_fbs(data_t *data,
> igt_output_t *output,
>  		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->ref_crc);
> +	igt_pipe_crc_drain(data->pipe_crc);
> +	igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
>  
>  	/*
>  	 * Prepare the non-rotated reference fb.
> @@ -298,21 +301,77 @@ static void wait_for_pageflip(int fd)
>  	igt_assert(drmHandleEvent(fd, &evctx) == 0);
>  }
>  
> +static void test_single_case(data_t *data, enum pipe pipe,
> +			     igt_output_t *output, igt_plane_t
> *plane,
> +			     enum rectangle_type rect,
> +			     uint32_t format, bool test_bad_format)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_crc_t crc_output;
> +	int ret;
> +
> +	igt_debug("Testing case %i on pipe %s, format %s\n", rect,
> kmstest_pipe_name(pipe), igt_format_str(format));
> +	prepare_fbs(data, output, plane, rect, format);
> +
> +	igt_plane_set_rotation(plane, data->rotation);
> +	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_ATOMIC);
> +	if (test_bad_format) {
> +		igt_assert_eq(ret, -EINVAL);
> +		return;
> +	}
> +
> +	/* Verify commit was ok. */
> +	igt_assert_eq(ret, 0);
> +
> +	/* Check CRC */
> +	igt_pipe_crc_drain(data->pipe_crc);
> +	igt_pipe_crc_get_single(data->pipe_crc, &crc_output);
> +	igt_assert_crc_equal(&data->ref_crc, &crc_output);
> +
> +	/*
> +	 * If flips are requested flip to a different fb and
> +	 * check CRC against that one as well.
> +	 */
> +	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);
> +
> +		if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> +			igt_display_commit_atomic(display,
> DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
> +		} else {
> +			ret = drmModePageFlip(data->gfx_fd,
> +					output->config.crtc-
> >crtc_id,
> +					data->fb_flip.fb_id,
> +					DRM_MODE_PAGE_FLIP_EVENT,
> +					NULL);
> +			igt_assert_eq(ret, 0);
> +		}
> +		wait_for_pageflip(data->gfx_fd);
> +		igt_pipe_crc_drain(data->pipe_crc);
> +		igt_pipe_crc_get_single(data->pipe_crc,
> &crc_output);
> +		igt_assert_crc_equal(&data->flip_crc,
> +				     &crc_output);
> +	}
> +}
> +
>  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;
>  	enum pipe pipe;
> -	int valid_tests = 0;
> -	igt_crc_t crc_output;
> -	int ret;
>  
>  	if (plane_type == DRM_PLANE_TYPE_CURSOR)
>  		igt_require(display->has_cursor_plane);
>  
> +	igt_display_require_output(display);
> +
>  	for_each_pipe_with_valid_output(display, pipe, output) {
>  		igt_plane_t *plane;
> -		int i;
> +		int i, j;
>  
>  		if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
>  			continue;
> @@ -335,56 +394,22 @@ static void test_plane_rotation(data_t *data,
> int plane_type, bool test_bad_form
>  			    i != rectangle &&
> intel_gen(intel_get_drm_devid(data->gfx_fd)) < 9)
>  				continue;
>  
> -			igt_debug("Testing case %i on pipe %s\n", i,
> kmstest_pipe_name(pipe));
> -			prepare_fbs(data, output, plane, i);
> -
> -			igt_plane_set_rotation(plane, data-
> >rotation);
> -			if (data->rotation & (IGT_ROTATION_90 |
> IGT_ROTATION_270))
> -				igt_plane_set_size(plane, data-
> >fb.height, data->fb.width);
> +			if (!data->override_fmt) {
> +				for (j = 0; j < plane->drm_plane-
> >count_formats; j++) {
> +					uint32_t format = plane-
> >drm_plane->formats[j];
>  
> -			ret = igt_display_try_commit2(display,
> COMMIT_ATOMIC);
> -			if (test_bad_format) {
> -				igt_assert_eq(ret, -EINVAL);
> -				continue;
> -			}
> +					if
> (!igt_fb_supported_format(format))
> +						continue;
>  
> -			/* Verify commit was ok. */
> -			igt_assert_eq(ret, 0);
> -
> -			/* Check CRC */
> -			igt_pipe_crc_collect_crc(data->pipe_crc,
> &crc_output);
> -			igt_assert_crc_equal(&data->ref_crc,
> &crc_output);
> -
> -			/*
> -			 * If flips are requested flip to a
> different fb and
> -			 * check CRC against that one as well.
> -			 */
> -			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);
> -
> -				if (plane_type !=
> DRM_PLANE_TYPE_PRIMARY) {
> -					igt_display_commit_atomic(di
> splay, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
> -				} else {
> -					ret = drmModePageFlip(data-
> >gfx_fd,
> -							output-
> >config.crtc->crtc_id,
> -							data-
> >fb_flip.fb_id,
> -							DRM_MODE_PAG
> E_FLIP_EVENT,
> -							NULL);
> -					igt_assert_eq(ret, 0);
> +					test_single_case(data, pipe,
> output, plane, i,
> +							 format,
> test_bad_format);
>  				}
> -				wait_for_pageflip(data->gfx_fd);
> -				igt_pipe_crc_collect_crc(data-
> >pipe_crc,
> -							 &crc_output
> );
> -				igt_assert_crc_equal(&data-
> >flip_crc,
> -						     &crc_output);
> +			} else {
> +				test_single_case(data, pipe, output,
> plane, i,
> +						 data->override_fmt, 
> test_bad_format);
>  			}
>  		}
> -
> -		valid_tests++;
>  	}
> -	igt_require_f(valid_tests, "no valid crtc/connector
> combinations found\n");
>  }
>  
>  static void test_plane_rotation_exhaust_fences(data_t *data,
-- 
Mika Kahola - Intel OTC



More information about the igt-dev mailing list