diff mbox

[i-g-t,v2] tests/kms_plane_multiple: Fix reference CRC

Message ID 1501743258-8971-1-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola Aug. 3, 2017, 6:54 a.m. UTC
kms_plane_multiple wrongly expected that igt lib function would modify the
passed igt_crc_t* object. You should use igt_crc_t** instead. This patch
fixes this anomaly in the test.

While at it, remove unnecesary struct for test data as we only need
reference CRC here.

The problem was caught by CI system and at least affects on HSW platform.

V2: Don't change function that collects CRC for reference CRC
    Fix CRC pointers
    Remove unnecessary struct for holding test data

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_plane_multiple.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

Comments

Marta Lofstedt Aug. 3, 2017, 7:11 a.m. UTC | #1
Before merge, please add:
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101907

Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>

> -----Original Message-----
> From: Kahola, Mika
> Sent: Thursday, August 3, 2017 9:54 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: daniel@ffwll.ch; Latvala, Petri <petri.latvala@intel.com>; Lofstedt, Marta
> <marta.lofstedt@intel.com>
> Subject: [PATCH i-g-t v2] tests/kms_plane_multiple: Fix reference CRC
> 
> kms_plane_multiple wrongly expected that igt lib function would modify the
> passed igt_crc_t* object. You should use igt_crc_t** instead. This patch fixes
> this anomaly in the test.
> 
> While at it, remove unnecesary struct for test data as we only need
> reference CRC here.
> 
> The problem was caught by CI system and at least affects on HSW platform.
> 
> V2: Don't change function that collects CRC for reference CRC
>     Fix CRC pointers
>     Remove unnecessary struct for holding test data
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  tests/kms_plane_multiple.c | 25 +++++++++----------------
>  1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c index
> f6c6223..4bc26b7 100644
> --- a/tests/kms_plane_multiple.c
> +++ b/tests/kms_plane_multiple.c
> @@ -51,11 +51,6 @@ typedef struct {
>  	struct igt_fb *fb;
>  } data_t;
> 
> -typedef struct {
> -	data_t *data;
> -	igt_crc_t reference_crc;
> -} test_position_t;
> -
>  /* Command line parameters. */
>  struct {
>  	int iterations;
> @@ -106,7 +101,7 @@ static void test_fini(data_t *data, igt_output_t
> *output, int n_planes)
> 
>  static void
>  test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool
> atomic,
> -	      color_t *color, uint64_t tiling, igt_crc_t *crc /* out */)
> +	      color_t *color, uint64_t tiling, igt_crc_t **crc /* out */)
>  {
>  	drmModeModeInfo *mode;
>  	igt_plane_t *primary;
> @@ -132,7 +127,7 @@ test_grab_crc(data_t *data, igt_output_t *output,
> enum pipe pipe, bool atomic,
>  	igt_skip_on(ret != 0);
> 
>  	igt_pipe_crc_start(data->pipe_crc);
> -	n = igt_pipe_crc_get_crcs(data->pipe_crc, 1, &crc);
> +	n = igt_pipe_crc_get_crcs(data->pipe_crc, 1, crc);
>  	igt_assert_eq(n, 1);
>  }
> 
> @@ -251,8 +246,8 @@ test_atomic_plane_position_with_output(data_t
> *data, enum pipe pipe,  {
>  	char buf[256];
>  	struct drm_event *e = (void *)buf;
> -	test_position_t test = { .data = data };
>  	color_t blue  = { 0.0f, 0.0f, 1.0f };
> +	igt_crc_t *ref = NULL;
>  	igt_crc_t *crc = NULL;
>  	unsigned int vblank_start, vblank_stop;
>  	int i, n, ret;
> @@ -275,8 +270,7 @@ test_atomic_plane_position_with_output(data_t
> *data, enum pipe pipe,
> 
>  	test_init(data, pipe, n_planes);
> 
> -	test_grab_crc(data, output, pipe, true, &blue, tiling,
> -		      &test.reference_crc);
> +	test_grab_crc(data, output, pipe, true, &blue, tiling, &ref);
> 
>  	i = 0;
>  	while (i < iterations || loop_forever) { @@ -303,7 +297,7 @@
> test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
>  		igt_assert(vblank_stop - vblank_start <=
> MAX_CRCS);
>  		igt_assert_eq(n, vblank_stop - vblank_start);
> 
> -		igt_assert_crc_equal(&test.reference_crc, crc);
> +		igt_assert_crc_equal(ref, crc);
> 
>  		i++;
>  	}
> @@ -318,9 +312,9 @@ test_legacy_plane_position_with_output(data_t
> *data, enum pipe pipe,
>  				       igt_output_t
> *output, int n_planes,
>  				       uint64_t tiling)
>  {
> -	test_position_t test = { .data = data };
>  	color_t blue  = { 0.0f, 0.0f, 1.0f };
> -	igt_crc_t *crc;
> +	igt_crc_t *ref = NULL;
> +	igt_crc_t *crc = NULL;
>  	int i, n;
>  	int iterations = opt.iterations < 1 ? 1 : opt.iterations;
>  	bool loop_forever;
> @@ -341,8 +335,7 @@ test_legacy_plane_position_with_output(data_t
> *data, enum pipe pipe,
> 
>  	test_init(data, pipe, n_planes);
> 
> -	test_grab_crc(data, output, pipe, false, &blue, tiling,
> -		      &test.reference_crc);
> +	test_grab_crc(data, output, pipe, false, &blue, tiling, &ref);
> 
>  	i = 0;
>  	while (i < iterations || loop_forever) { @@ -354,7 +347,7 @@
> test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
> 
>  		igt_assert_eq(n, MAX_CRCS);
> 
> -		igt_assert_crc_equal(&test.reference_crc, crc);
> +		igt_assert_crc_equal(ref, crc);
> 
>  		i++;
>  	}
> --
> 2.7.4
Mika Kahola Aug. 3, 2017, 7:26 a.m. UTC | #2
On Thu, 2017-08-03 at 10:11 +0300, Lofstedt, Marta wrote:
> Before merge, please add:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101907
> 
> Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
> 
OK. I'll update the commit message.

Cheers,
Mika

> > 
> > -----Original Message-----
> > From: Kahola, Mika
> > Sent: Thursday, August 3, 2017 9:54 AM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: daniel@ffwll.ch; Latvala, Petri <petri.latvala@intel.com>;
> > Lofstedt, Marta
> > <marta.lofstedt@intel.com>
> > Subject: [PATCH i-g-t v2] tests/kms_plane_multiple: Fix reference
> > CRC
> > 
> > kms_plane_multiple wrongly expected that igt lib function would
> > modify the
> > passed igt_crc_t* object. You should use igt_crc_t** instead. This
> > patch fixes
> > this anomaly in the test.
> > 
> > While at it, remove unnecesary struct for test data as we only need
> > reference CRC here.
> > 
> > The problem was caught by CI system and at least affects on HSW
> > platform.
> > 
> > V2: Don't change function that collects CRC for reference CRC
> >     Fix CRC pointers
> >     Remove unnecessary struct for holding test data
> > 
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  tests/kms_plane_multiple.c | 25 +++++++++----------------
> >  1 file changed, 9 insertions(+), 16 deletions(-)
> > 
> > diff --git a/tests/kms_plane_multiple.c
> > b/tests/kms_plane_multiple.c index
> > f6c6223..4bc26b7 100644
> > --- a/tests/kms_plane_multiple.c
> > +++ b/tests/kms_plane_multiple.c
> > @@ -51,11 +51,6 @@ typedef struct {
> >  	struct igt_fb *fb;
> >  } data_t;
> > 
> > -typedef struct {
> > -	data_t *data;
> > -	igt_crc_t reference_crc;
> > -} test_position_t;
> > -
> >  /* Command line parameters. */
> >  struct {
> >  	int iterations;
> > @@ -106,7 +101,7 @@ static void test_fini(data_t *data,
> > igt_output_t
> > *output, int n_planes)
> > 
> >  static void
> >  test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe,
> > bool
> > atomic,
> > -	      color_t *color, uint64_t tiling, igt_crc_t *crc /*
> > out */)
> > +	      color_t *color, uint64_t tiling, igt_crc_t **crc /*
> > out */)
> >  {
> >  	drmModeModeInfo *mode;
> >  	igt_plane_t *primary;
> > @@ -132,7 +127,7 @@ test_grab_crc(data_t *data, igt_output_t
> > *output,
> > enum pipe pipe, bool atomic,
> >  	igt_skip_on(ret != 0);
> > 
> >  	igt_pipe_crc_start(data->pipe_crc);
> > -	n = igt_pipe_crc_get_crcs(data->pipe_crc, 1, &crc);
> > +	n = igt_pipe_crc_get_crcs(data->pipe_crc, 1, crc);
> >  	igt_assert_eq(n, 1);
> >  }
> > 
> > @@ -251,8 +246,8 @@ test_atomic_plane_position_with_output(data_t
> > *data, enum pipe pipe,  {
> >  	char buf[256];
> >  	struct drm_event *e = (void *)buf;
> > -	test_position_t test = { .data = data };
> >  	color_t blue  = { 0.0f, 0.0f, 1.0f };
> > +	igt_crc_t *ref = NULL;
> >  	igt_crc_t *crc = NULL;
> >  	unsigned int vblank_start, vblank_stop;
> >  	int i, n, ret;
> > @@ -275,8 +270,7 @@ test_atomic_plane_position_with_output(data_t
> > *data, enum pipe pipe,
> > 
> >  	test_init(data, pipe, n_planes);
> > 
> > -	test_grab_crc(data, output, pipe, true, &blue, tiling,
> > -		      &test.reference_crc);
> > +	test_grab_crc(data, output, pipe, true, &blue, tiling,
> > &ref);
> > 
> >  	i = 0;
> >  	while (i < iterations || loop_forever) { @@ -303,7 +297,7
> > @@
> > test_atomic_plane_position_with_output(data_t *data, enum pipe
> > pipe,
> >  		igt_assert(vblank_stop - vblank_start <=
> > MAX_CRCS);
> >  		igt_assert_eq(n, vblank_stop - vblank_start);
> > 
> > -		igt_assert_crc_equal(&test.reference_crc, crc);
> > +		igt_assert_crc_equal(ref, crc);
> > 
> >  		i++;
> >  	}
> > @@ -318,9 +312,9 @@ test_legacy_plane_position_with_output(data_t
> > *data, enum pipe pipe,
> >  				       igt_output_t
> > *output, int n_planes,
> >  				       uint64_t tiling)
> >  {
> > -	test_position_t test = { .data = data };
> >  	color_t blue  = { 0.0f, 0.0f, 1.0f };
> > -	igt_crc_t *crc;
> > +	igt_crc_t *ref = NULL;
> > +	igt_crc_t *crc = NULL;
> >  	int i, n;
> >  	int iterations = opt.iterations < 1 ? 1 : opt.iterations;
> >  	bool loop_forever;
> > @@ -341,8 +335,7 @@ test_legacy_plane_position_with_output(data_t
> > *data, enum pipe pipe,
> > 
> >  	test_init(data, pipe, n_planes);
> > 
> > -	test_grab_crc(data, output, pipe, false, &blue, tiling,
> > -		      &test.reference_crc);
> > +	test_grab_crc(data, output, pipe, false, &blue, tiling,
> > &ref);
> > 
> >  	i = 0;
> >  	while (i < iterations || loop_forever) { @@ -354,7 +347,7
> > @@
> > test_legacy_plane_position_with_output(data_t *data, enum pipe
> > pipe,
> > 
> >  		igt_assert_eq(n, MAX_CRCS);
> > 
> > -		igt_assert_crc_equal(&test.reference_crc, crc);
> > +		igt_assert_crc_equal(ref, crc);
> > 
> >  		i++;
> >  	}
> > --
> > 2.7.4
diff mbox

Patch

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index f6c6223..4bc26b7 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -51,11 +51,6 @@  typedef struct {
 	struct igt_fb *fb;
 } data_t;
 
-typedef struct {
-	data_t *data;
-	igt_crc_t reference_crc;
-} test_position_t;
-
 /* Command line parameters. */
 struct {
 	int iterations;
@@ -106,7 +101,7 @@  static void test_fini(data_t *data, igt_output_t *output, int n_planes)
 
 static void
 test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
-	      color_t *color, uint64_t tiling, igt_crc_t *crc /* out */)
+	      color_t *color, uint64_t tiling, igt_crc_t **crc /* out */)
 {
 	drmModeModeInfo *mode;
 	igt_plane_t *primary;
@@ -132,7 +127,7 @@  test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
 	igt_skip_on(ret != 0);
 
 	igt_pipe_crc_start(data->pipe_crc);
-	n = igt_pipe_crc_get_crcs(data->pipe_crc, 1, &crc);
+	n = igt_pipe_crc_get_crcs(data->pipe_crc, 1, crc);
 	igt_assert_eq(n, 1);
 }
 
@@ -251,8 +246,8 @@  test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 {
 	char buf[256];
 	struct drm_event *e = (void *)buf;
-	test_position_t test = { .data = data };
 	color_t blue  = { 0.0f, 0.0f, 1.0f };
+	igt_crc_t *ref = NULL;
 	igt_crc_t *crc = NULL;
 	unsigned int vblank_start, vblank_stop;
 	int i, n, ret;
@@ -275,8 +270,7 @@  test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	test_init(data, pipe, n_planes);
 
-	test_grab_crc(data, output, pipe, true, &blue, tiling,
-		      &test.reference_crc);
+	test_grab_crc(data, output, pipe, true, &blue, tiling, &ref);
 
 	i = 0;
 	while (i < iterations || loop_forever) {
@@ -303,7 +297,7 @@  test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 		igt_assert(vblank_stop - vblank_start <= MAX_CRCS);
 		igt_assert_eq(n, vblank_stop - vblank_start);
 
-		igt_assert_crc_equal(&test.reference_crc, crc);
+		igt_assert_crc_equal(ref, crc);
 
 		i++;
 	}
@@ -318,9 +312,9 @@  test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
 				       igt_output_t *output, int n_planes,
 				       uint64_t tiling)
 {
-	test_position_t test = { .data = data };
 	color_t blue  = { 0.0f, 0.0f, 1.0f };
-	igt_crc_t *crc;
+	igt_crc_t *ref = NULL;
+	igt_crc_t *crc = NULL;
 	int i, n;
 	int iterations = opt.iterations < 1 ? 1 : opt.iterations;
 	bool loop_forever;
@@ -341,8 +335,7 @@  test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	test_init(data, pipe, n_planes);
 
-	test_grab_crc(data, output, pipe, false, &blue, tiling,
-		      &test.reference_crc);
+	test_grab_crc(data, output, pipe, false, &blue, tiling, &ref);
 
 	i = 0;
 	while (i < iterations || loop_forever) {
@@ -354,7 +347,7 @@  test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
 
 		igt_assert_eq(n, MAX_CRCS);
 
-		igt_assert_crc_equal(&test.reference_crc, crc);
+		igt_assert_crc_equal(ref, crc);
 
 		i++;
 	}