Skip to contentSkip to conversation

tests/kms_plane_multiple: Fix reference CRC

PATCH In review Mika Kahola 2 participants 3 messages Aug 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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

---
 tests/kms_plane_multiple.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)
tests/kms_plane_multiple.c +9 -16
index f6c6223..4bc26b7 100644
@@ -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++;
 	}
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#1 lore raw

Before merge, please add:
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101907

Quoted 129 lines

-----Original Message-----
From: Kahola, Mika
Sent: Thursday, August 3, 2017 9:54 AM
To: [email protected]
Cc: [email protected]; Latvala, Petri <[email protected]>; Lofstedt, Marta <[email protected]>
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

---
 tests/kms_plane_multiple.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)
tests/kms_plane_multiple.c index renamed from tests/kms_plane_multiple.c +0 -0

f6c6223..4bc26b7 100644

tests/kms_plane_multiple.c +1 -6
@@ -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 */)
 {
tests/kms_plane_multiple.c +3 -4
 	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);

tests/kms_plane_multiple.c +3 -3
 		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;
tests/kms_plane_multiple.c +1 -2
 	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,

tests/kms_plane_multiple.c +1 -2
 		igt_assert_eq(n, MAX_CRCS);
 
-		igt_assert_crc_equal(&test.reference_crc, crc);
+		igt_assert_crc_equal(ref, crc);
 
 		i++;
 	}
--
Quoted 1 line

2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 5 lines · Marta

Before merge, please add:
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101907

OK. I'll update the commit message.

Cheers,
Mika

Quoted 141 lines
Quoted 141 lines

-----Original Message-----
From: Kahola, Mika
Sent: Thursday, August 3, 2017 9:54 AM
To: [email protected]
Cc: [email protected]; Latvala, Petri <[email protected]>; Lofstedt, Marta
<[email protected]>
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

---
 tests/kms_plane_multiple.c | 25 +++++++++----------------

 1 file changed, 9 insertions(+), 16 deletions(-)
(quoted diff) +0 -0

b/tests/kms_plane_multiple.c index
f6c6223..4bc26b7 100644

tests/kms_plane_multiple.c +0 -5
@@ -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,

tests/kms_plane_multiple.c +0 -1
-	      color_t *color, uint64_t tiling, igt_crc_t *crc /*

out */)

tests/kms_plane_multiple.c +1 -0
+	      color_t *color, uint64_t tiling, igt_crc_t **crc /*

out */)
 {
  drmModeModeInfo *mode;
  igt_plane_t *primary;

tests/kms_plane_multiple.c +1 -1
@@ -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);

 }

tests/kms_plane_multiple.c +2 -3
@@ -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);

tests/kms_plane_multiple.c +1 -1
-		igt_assert_crc_equal(&test.reference_crc, crc);
+		igt_assert_crc_equal(ref, crc);

  i++;
  }

tests/kms_plane_multiple.c +0 -0
@@ -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) {

tests/kms_plane_multiple.c +0 -1
-	test_position_t test = { .data = data };

  color_t blue  = { 0.0f, 0.0f, 1.0f };

tests/kms_plane_multiple.c +2 -1
-	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;

tests/kms_plane_multiple.c +1 -2
@@ -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);

Quoted 7 lines
Quoted 7 lines
tests/kms_plane_multiple.c +1 -1
-		igt_assert_crc_equal(&test.reference_crc, crc);
+		igt_assert_crc_equal(ref, crc);

  i++;
  }
--
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx