Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 i-g-t] test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc
Date: Tue, 12 Dec 2017 11:59:13 +0100	[thread overview]
Message-ID: <20171212105913.67610-1-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20171212104706.6784-1-arkadiusz.hiler@intel.com>

From: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

Compiler complained on crc_lowres and crc_hires2 being uninitialized
and indeed, display_commit_mode() seems to have intention of retruning
the value through the parameter that is only a single pointer.

This couses only the local copy of the pointer, the one inside
display_commit_mode(), to be overwritten.

Let's fix that!

Also add missing hires crc comparison (M. Kahola).

v2: make display_commit_mode return just the last CRC
v3: Don't do memory allocations, it's hard. (Maarten)

Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
So sorry, didn't like the memory allocations, hope this works.. else I'll commit v2..

tests/kms_plane_lowres.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 85d3145de4b6..f643bb4b0e8f 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -125,11 +125,12 @@ test_fini(data_t *data, igt_output_t *output, enum pipe pipe)
 	data->fb = NULL;
 }
 
-static int
+static void
 display_commit_mode(igt_display_t *display, igt_pipe_crc_t *pipe_crc,
-		    enum pipe pipe, int flags, igt_crc_t *crc)
+		    enum pipe pipe, int flags, igt_crc_t *out_crc)
 {
 	char buf[256];
+	igt_crc_t *crcs;
 	struct drm_event *e = (void *)buf;
 	unsigned int vblank_start, vblank_stop;
 	int n, ret;
@@ -148,10 +149,12 @@ display_commit_mode(igt_display_t *display, igt_pipe_crc_t *pipe_crc,
 	igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
 	igt_reset_timeout();
 
-	n = igt_pipe_crc_get_crcs(pipe_crc, vblank_stop - vblank_start, &crc);
+	n = igt_pipe_crc_get_crcs(pipe_crc, vblank_stop - vblank_start, &crcs);
 	igt_assert_eq(n, vblank_stop - vblank_start);
 
-	return n;
+	/* there is no need to return all the intermediary CRCs */
+	/* so let's return just the last one */
+	*out_crc = crcs[n-1];
 }
 
 static void
@@ -218,8 +221,8 @@ static void
 test_plane_position_with_output(data_t *data, enum pipe pipe,
 				igt_output_t *output, uint64_t modifier)
 {
-	igt_crc_t *crc_hires1, *crc_hires2;
-	igt_crc_t *crc_lowres;
+	igt_crc_t crc_hires1, crc_hires2, *crcs;
+	igt_crc_t crc_lowres;
 	drmModeModeInfo mode_lowres;
 	drmModeModeInfo *mode1, *mode2, *mode3;
 	int ret, n;
@@ -239,8 +242,10 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 	pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
 	igt_pipe_crc_start(pipe_crc);
 
-	n = igt_pipe_crc_get_crcs(pipe_crc, 1, &crc_hires1);
+	n = igt_pipe_crc_get_crcs(pipe_crc, 1, &crcs);
 	igt_assert_eq(1, n);
+	crc_hires1 = *crcs;
+	free(crcs);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, true);
 
@@ -252,7 +257,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	check_mode(&mode_lowres, mode2);
 
-	display_commit_mode(&data->display, pipe_crc, pipe, flags, crc_lowres);
+	display_commit_mode(&data->display, pipe_crc, pipe, flags, &crc_lowres);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, false);
 
@@ -264,10 +269,12 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	check_mode(mode1, mode3);
 
-	display_commit_mode(&data->display, pipe_crc, pipe, flags, crc_hires2);
+	display_commit_mode(&data->display, pipe_crc, pipe, flags, &crc_hires2);
 
 	igt_assert_plane_visible(data->drm_fd, pipe, true);
 
+	igt_assert_crc_equal(&crc_hires1, &crc_hires2);
+
 	igt_pipe_crc_stop(pipe_crc);
 	igt_pipe_crc_free(pipe_crc);
 
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-12-12 10:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 12:43 [PATCH i-g-t] test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc Arkadiusz Hiler
2017-12-01 13:07 ` ✗ Fi.CI.BAT: warning for " Patchwork
2017-12-04 14:15 ` ✓ Fi.CI.BAT: success " Patchwork
2017-12-04 15:43 ` ✗ Fi.CI.IGT: failure " Patchwork
2017-12-12 10:47 ` [PATCH i-g-t v2] " Arkadiusz Hiler
2017-12-12 10:59   ` Maarten Lankhorst [this message]
2017-12-12 11:10     ` [PATCH v3 i-g-t] " Petri Latvala
2017-12-12 12:10     ` Arkadiusz Hiler
2017-12-12 12:26       ` Arkadiusz Hiler
2017-12-12 13:19 ` ✓ Fi.CI.BAT: success for test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc (rev3) Patchwork
2017-12-12 15:52 ` ✗ Fi.CI.IGT: failure " 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=20171212105913.67610-1-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox