public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH v2 3/4] kms_plane: Split helpers creating reference FB and capturing CRC
Date: Tue,  6 Mar 2018 18:52:14 +0200	[thread overview]
Message-ID: <20180306165215.16490-4-imre.deak@intel.com> (raw)
In-Reply-To: <20180306165215.16490-1-imre.deak@intel.com>

Split creating a reference FB and capturing the CRC for it into separate
functions, so in a follow-up patch we can reuse the CRC capture function
for a reference FB created in a different way.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 tests/kms_plane.c | 50 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 1d1bc198..5bd3249a 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -61,11 +61,9 @@ static void test_fini(data_t *data)
 }
 
 static void
-test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe,
-	      color_t *fb_color, igt_crc_t *crc /* out */)
+test_grab_crc_for_fb(data_t *data, igt_output_t *output, enum pipe pipe,
+		     igt_fb_t *fb, igt_crc_t *crc /* out */)
 {
-	struct igt_fb fb;
-	drmModeModeInfo *mode;
 	igt_plane_t *primary;
 	char *crc_str;
 	int ret;
@@ -74,13 +72,7 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	primary = igt_output_get_plane(output, 0);
 
-	mode = igt_output_get_mode(output);
-	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
-			    DRM_FORMAT_XRGB8888,
-			    LOCAL_DRM_FORMAT_MOD_NONE,
-			    fb_color->red, fb_color->green, fb_color->blue,
-			    &fb);
-	igt_plane_set_fb(primary, &fb);
+	igt_plane_set_fb(primary, fb);
 
 	ret = igt_display_try_commit2(&data->display, COMMIT_LEGACY);
 	igt_skip_on(ret != 0);
@@ -89,14 +81,24 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	igt_plane_set_fb(primary, NULL);
 
-	igt_remove_fb(data->drm_fd, &fb);
-
 	crc_str = igt_crc_to_string(crc);
-	igt_debug("CRC for a (%.02f,%.02f,%.02f) fb: %s\n", fb_color->red,
-		  fb_color->green, fb_color->blue, crc_str);
+	igt_debug("CRC for fb: %s\n", crc_str);
 	free(crc_str);
 }
 
+static void
+test_create_fb_for_output(data_t *data, igt_output_t *output, color_t *fb_color,
+			  igt_fb_t *fb)
+{
+	drmModeModeInfo *mode = igt_output_get_mode(output);
+
+	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    fb_color->red, fb_color->green, fb_color->blue,
+			    fb);
+}
+
 /*
  * Plane position test.
  *   - We start by grabbing a reference CRC of a full green fb being scanned
@@ -222,11 +224,15 @@ test_plane_position(data_t *data, enum pipe pipe, unsigned int flags)
 
 	for_each_valid_output_on_pipe(&data->display, pipe, output) {
 		int n_planes = data->display.pipes[pipe].n_planes;
+		igt_fb_t reference_fb;
 		igt_crc_t reference_crc;
 
 		test_init(data, pipe);
 
-		test_grab_crc(data, output, pipe, &green, &reference_crc);
+		test_create_fb_for_output(data, output, &green, &reference_fb);
+		test_grab_crc_for_fb(data, output, pipe, &reference_fb,
+				     &reference_crc);
+		igt_remove_fb(data->drm_fd, &reference_fb);
 
 		for (int plane = 1; plane < n_planes; plane++)
 			test_plane_position_with_output(data, pipe, plane,
@@ -343,13 +349,21 @@ test_plane_panning(data_t *data, enum pipe pipe, unsigned int flags)
 
 	for_each_valid_output_on_pipe(&data->display, pipe, output) {
 		int n_planes = data->display.pipes[pipe].n_planes;
+		igt_fb_t red_fb;
+		igt_fb_t blue_fb;
 		igt_crc_t red_crc;
 		igt_crc_t blue_crc;
 
 		test_init(data, pipe);
 
-		test_grab_crc(data, output, pipe, &red, &red_crc);
-		test_grab_crc(data, output, pipe, &blue, &blue_crc);
+		test_create_fb_for_output(data, output, &red, &red_fb);
+		test_create_fb_for_output(data, output, &blue, &blue_fb);
+
+		test_grab_crc_for_fb(data, output, pipe, &red_fb, &red_crc);
+		test_grab_crc_for_fb(data, output, pipe, &blue_fb, &blue_crc);
+
+		igt_remove_fb(data->drm_fd, &blue_fb);
+		igt_remove_fb(data->drm_fd, &red_fb);
 
 		for (int plane = 1; plane < n_planes; plane++)
 			test_plane_panning_with_output(data, pipe, plane,
-- 
2.13.2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-03-06 16:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 16:52 [igt-dev] [PATCH i-g-t v2 0/4] kms_plane: Add clipping subtests Imre Deak
2018-03-06 16:52 ` [igt-dev] [PATCH v2 1/4] kms_plane: Remove redundant modeset after CRC capture Imre Deak
2018-09-05 16:27   ` [igt-dev] [PATCH i-g-t v3 0/5] kms_plane: Add clipping subtests Gwan-gyeong Mun
2018-09-05 16:27     ` [igt-dev] [PATCH i-g-t v3 1/5] kms_plane: Remove redundant modeset after CRC capture Gwan-gyeong Mun
2018-09-05 16:27     ` [igt-dev] [PATCH i-g-t v3 2/5] lib: Export helpers to get rotation/tiling strings Gwan-gyeong Mun
2018-09-05 16:27     ` [igt-dev] [PATCH i-g-t v3 3/5] kms_plane: Split helpers creating reference FB and capturing CRC Gwan-gyeong Mun
2018-09-05 16:27     ` [igt-dev] [PATCH i-g-t v3 4/5] kms_plane: Add a helper of capturing CRC with commit style Gwan-gyeong Mun
2018-09-05 16:27     ` [igt-dev] [PATCH i-g-t v3 5/5] kms_plane: Add clipping subtests Gwan-gyeong Mun
2018-03-06 16:52 ` [igt-dev] [PATCH v2 2/4] lib: Export helpers to get rotation/tiling strings Imre Deak
2018-03-06 16:52 ` Imre Deak [this message]
2018-03-06 16:52 ` [igt-dev] [PATCH v2 4/4] kms_plane: Add clipping subtests Imre Deak
2018-03-06 17:47 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-03-06 22:24 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
2018-03-07 17:03 ` [igt-dev] [PATCH i-g-t v2 0/4] " Daniel Vetter
2018-03-07 17:29   ` Imre Deak
2018-03-07 20:44     ` Daniel Vetter
2018-03-08 12:35       ` Imre Deak

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=20180306165215.16490-4-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=igt-dev@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