All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_pipe_crc_basic: Add flip tests to ensure basic CRC sanity checking, v2.
Date: Mon, 25 Feb 2019 19:25:31 +0200	[thread overview]
Message-ID: <20190225172531.GH20097@intel.com> (raw)
In-Reply-To: <20190225151300.2631-1-maarten.lankhorst@linux.intel.com>

On Mon, Feb 25, 2019 at 04:13:00PM +0100, Maarten Lankhorst wrote:
> Warn if a CRC for every unique color will end up being identical, it's
> not counted as a test failure because intel might not handle it correctly.
> 
> After this, flip and dirtyfb a number of times to ensure that basic CRC
> reading works as intended.
> 
> Changes since v1:
> - Fix calling when output is NULL.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  tests/kms_pipe_crc_basic.c | 87 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 84 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
> index 36ce624e4e9e..8a1b4208da29 100644
> --- a/tests/kms_pipe_crc_basic.c
> +++ b/tests/kms_pipe_crc_basic.c
> @@ -29,7 +29,7 @@
>  #include <stdio.h>
>  #include <string.h>
>  #include <fcntl.h>
> -
> +#include "igt_rand.h"
>  
>  typedef struct {
>  	int drm_fd;
> @@ -41,9 +41,15 @@ typedef struct {
>  static struct {
>  	double r, g, b;
>  	igt_crc_t crc;
> -} colors[2] = {
> +} colors[] = {
> +	{ .r = 0.0, .g = 0.0, .b = 0.0 },
> +	{ .r = 0.0, .g = 0.0, .b = 1.0 },
>  	{ .r = 0.0, .g = 1.0, .b = 0.0 },
>  	{ .r = 0.0, .g = 1.0, .b = 1.0 },
> +	{ .r = 1.0, .g = 0.0, .b = 0.0 },
> +	{ .r = 1.0, .g = 0.0, .b = 1.0 },
> +	{ .r = 1.0, .g = 1.0, .b = 0.0 },
> +	{ .r = 1.0, .g = 1.0, .b = 1.0 },
>  };
>  
>  static void test_bad_source(data_t *data)
> @@ -153,10 +159,82 @@ static void test_read_crc(data_t *data, enum pipe pipe, unsigned flags)
>  	}
>  }
>  
> -data_t data = {0, };
> +static void test_flip_crc(data_t *data, enum pipe pipe)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_output_t *output = igt_get_single_output_for_pipe(display, pipe);
> +	igt_plane_t *primary;
> +	drmModeModeInfo *mode;
> +	igt_crc_t ref_crcs[ARRAY_SIZE(colors)], crc;
> +	int c, i, j;
> +	struct igt_fb fbs[ARRAY_SIZE(colors)] = {};
> +	igt_pipe_crc_t *pipe_crc;
> +	unsigned seed = 0x1234567 * (pipe + 1);
> +	int prev;
> +
> +	igt_skip_on(pipe >= display->n_pipes);
> +	igt_require_f(output, "No connector found for pipe %s\n",
> +		      kmstest_pipe_name(pipe));
> +
> +	igt_display_reset(display);
> +	igt_output_set_pipe(output, pipe);
> +	mode = igt_output_get_mode(output);
> +	primary = igt_output_get_plane(output, 0);
> +
> +	for (c = 0; c < ARRAY_SIZE(colors); c++) {
> +		igt_create_color_fb(display->drm_fd,
> +				    mode->hdisplay, mode->vdisplay,
> +				    DRM_FORMAT_XRGB8888,
> +				    LOCAL_DRM_FORMAT_MOD_NONE,
> +				    colors[c].r,
> +				    colors[c].g,
> +				    colors[c].b,
> +				    &fbs[c]);
> +
> +		igt_plane_set_fb(primary, &fbs[c]);
> +		igt_display_commit2(display, c ? COMMIT_UNIVERSAL : COMMIT_LEGACY);
> +		if (!c)
> +			pipe_crc = igt_pipe_crc_new(display->drm_fd, pipe,
> +						    INTEL_PIPE_CRC_SOURCE_AUTO);
> +
> +		igt_pipe_crc_collect_crc(pipe_crc, &ref_crcs[c]);
> +
> +		for (j = c - 1; j >= 0; j--)
> +			igt_warn_on_f(igt_check_crc_equal(&ref_crcs[c], &ref_crcs[j]),
> +				"Identical CRC for very different colors, %g %g %g vs %g %g %g\n",
> +				colors[c].r, colors[c].g, colors[c].b,
> +				colors[j].r, colors[j].g, colors[j].b);
> +	}
> +
> +	igt_pipe_crc_start(pipe_crc);
> +
> +	prev = c;
> +	for (i = 0; i < 10 * ARRAY_SIZE(colors); i++) {
> +		c = hars_petruska_f54_1_random(&seed) % ARRAY_SIZE(colors);
> +		igt_debug("Testing color %g %g %g with %s\n",
> +			  colors[c].r, colors[c].g, colors[c].b,
> +			  c == prev ? "dirtyfb" : "commit");
> +
> +		if (c != prev) {
> +			igt_plane_set_fb(primary, &fbs[c]);
> +			igt_display_commit2(display, COMMIT_UNIVERSAL);
> +		} else {
> +			igt_dirty_fb(display->drm_fd, &fbs[c]);
> +			igt_wait_for_vblank(display->drm_fd, pipe);
> +		}
> +
> +		igt_pipe_crc_get_current(display->drm_fd, pipe_crc, &crc);

When flipping it might be nice to check every crc to make sure
there are no bad ones in the middle of the sequence.

> +		igt_assert_crc_equal(&ref_crcs[c], &crc);
> +		prev = c;
> +	}
> +
> +	for (c = 0; c < ARRAY_SIZE(colors); c++)
> +		igt_remove_fb(display->drm_fd, &fbs[c]);
> +}
>  
>  igt_main
>  {
> +	data_t data = {};
>  	enum pipe pipe;
>  
>  	igt_fixture {
> @@ -210,6 +288,9 @@ igt_main
>  
>  			igt_disallow_hang(data.drm_fd, hang);
>  		}
> +
> +		igt_subtest_f("flip-crc-pipe-%s", kmstest_pipe_name(pipe))
> +			test_flip_crc(&data, pipe);
>  	}
>  
>  	igt_fixture {
> -- 
> 2.20.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-02-25 17:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 13:02 [igt-dev] [PATCH i-g-t 1/4] tests/kms_pipe_crc_basic: Use for_each_pipe_static() Maarten Lankhorst
2019-02-25 13:02 ` [igt-dev] [PATCH i-g-t 2/4] tests/kms_pipe_crc_basic: Only test a single output per pipe Maarten Lankhorst
2019-02-25 17:21   ` Ville Syrjälä
2019-02-27 14:30     ` Maarten Lankhorst
2019-02-25 13:02 ` [igt-dev] [PATCH i-g-t 3/4] tests/kms_pipe_crc_basic: Add flip tests to ensure basic CRC sanity checking Maarten Lankhorst
2019-02-25 15:13   ` [igt-dev] [PATCH i-g-t] tests/kms_pipe_crc_basic: Add flip tests to ensure basic CRC sanity checking, v2 Maarten Lankhorst
2019-02-25 17:25     ` Ville Syrjälä [this message]
2019-02-25 13:02 ` [igt-dev] [PATCH i-g-t 4/4] HACK: Add pipe_crc_basic to ff Maarten Lankhorst
2019-02-25 14:29 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests/kms_pipe_crc_basic: Use for_each_pipe_static() Patchwork
2019-02-25 15:46 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests/kms_pipe_crc_basic: Use for_each_pipe_static(). (rev2) Patchwork
2019-02-25 17:18 ` [igt-dev] [PATCH i-g-t 1/4] tests/kms_pipe_crc_basic: Use for_each_pipe_static() Ville Syrjälä
2019-02-25 17:32 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] " Patchwork
2019-02-25 21:09 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] tests/kms_pipe_crc_basic: Use for_each_pipe_static(). (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190225172531.GH20097@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.