All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>,
	rodrigo.vivi@intel.com
Subject: [igt-dev] [PATCH i-g-t 15/20] tests/psr: Eliminate storing pointers for igt_plane_type.
Date: Tue, 10 Apr 2018 19:37:27 -0700	[thread overview]
Message-ID: <20180411023732.32362-15-dhinakaran.pandiyan@intel.com> (raw)
In-Reply-To: <20180411023732.32362-1-dhinakaran.pandiyan@intel.com>

After the initial plane setup, only the test plane is required. One
exception is clean_up where the primary is required, but a call to
igt_output_get_plane_type() can get us that.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 tests/kms_psr_sink_crc.c | 73 +++++++++++++++++++++---------------------------
 1 file changed, 32 insertions(+), 41 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index c9197c9d..f22edb48 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -62,14 +62,13 @@ static const char *op_str(enum operations op)
 typedef struct {
 	int drm_fd;
 	int debugfs_fd;
-	int test_plane;
 	enum operations op;
 	uint32_t devid;
 	uint32_t crtc_id;
 	igt_display_t display;
 	drm_intel_bufmgr *bufmgr;
 	struct igt_fb fb_green, fb_white;
-	igt_plane_t *primary, *sprite, *cursor;
+	igt_plane_t *test_plane;
 	int mod_size;
 	int mod_stride;
 	drmModeModeInfo *mode;
@@ -268,7 +267,7 @@ static bool drrs_disabled(data_t *data)
 static void run_test(data_t *data)
 {
 	uint32_t handle = data->fb_white.gem_handle;
-	igt_plane_t *test_plane;
+	igt_plane_t *test_plane = data->test_plane;
 	void *ptr;
 	char ref_crc[CRC_LEN];
 	char crc[CRC_LEN];
@@ -288,18 +287,13 @@ static void run_test(data_t *data)
 	assert_or_manual(is_green(ref_crc), "screen GREEN");
 
 	/* Setting a secondary fb/plane */
-	switch (data->test_plane) {
-	case DRM_PLANE_TYPE_PRIMARY: default: test_plane = data->primary; break;
-	case DRM_PLANE_TYPE_OVERLAY: test_plane = data->sprite; break;
-	case DRM_PLANE_TYPE_CURSOR: test_plane = data->cursor; break;
-	}
 	igt_plane_set_fb(test_plane, &data->fb_white);
 	igt_display_commit(&data->display);
 
 	/* Confirm it is not Green anymore */
 	igt_assert(wait_psr_entry(data));
 	get_sink_crc(data, ref_crc);
-	if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
+	if (test_plane->type == DRM_PLANE_TYPE_PRIMARY)
 		assert_or_manual(!is_green(ref_crc), "screen WHITE");
 	else
 		assert_or_manual(!is_green(ref_crc), "GREEN background with WHITE box");
@@ -358,21 +352,22 @@ static void run_test(data_t *data)
 }
 
 static void test_cleanup(data_t *data) {
-	igt_plane_set_fb(data->primary, NULL);
-	if (data->test_plane == DRM_PLANE_TYPE_OVERLAY)
-		igt_plane_set_fb(data->sprite, NULL);
-	if (data->test_plane == DRM_PLANE_TYPE_CURSOR)
-		igt_plane_set_fb(data->cursor, NULL);
+	igt_plane_t *primary;
 
+	primary = igt_output_get_plane_type(data->output,
+					    DRM_PLANE_TYPE_PRIMARY);
+	igt_plane_set_fb(primary, NULL);
+	igt_plane_set_fb(data->test_plane, NULL);
 	igt_display_commit(&data->display);
 
 	igt_remove_fb(data->drm_fd, &data->fb_green);
 	igt_remove_fb(data->drm_fd, &data->fb_white);
 }
 
-static void setup_test_plane(data_t *data)
+static void setup_test_plane(data_t *data, int test_plane)
 {
 	uint32_t white_h, white_v;
+	igt_plane_t *primary, *sprite, *cursor;
 
 	igt_create_color_fb(data->drm_fd,
 			    data->mode->hdisplay, data->mode->vdisplay,
@@ -381,8 +376,10 @@ static void setup_test_plane(data_t *data)
 			    0.0, 1.0, 0.0,
 			    &data->fb_green);
 
-	data->primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
-	igt_plane_set_fb(data->primary, NULL);
+	primary = igt_output_get_plane_type(data->output,
+					    DRM_PLANE_TYPE_PRIMARY);
+	igt_plane_set_fb(primary, NULL);
+	data->test_plane = primary;
 
 	white_h = data->mode->hdisplay;
 	white_v = data->mode->vdisplay;
@@ -391,16 +388,14 @@ static void setup_test_plane(data_t *data)
 	data->mod_size = white_h * white_v;
 	data->mod_stride = white_h * 4;
 
-	switch (data->test_plane) {
+	switch (test_plane) {
 	case DRM_PLANE_TYPE_OVERLAY:
-		data->sprite = igt_output_get_plane_type(data->output,
-						    DRM_PLANE_TYPE_OVERLAY);
-		igt_plane_set_fb(data->sprite, NULL);
-		/* To make it different for human eyes let's make
-		 * sprite visible in only one quarter of the primary
-		 */
+		sprite = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_OVERLAY);
+		igt_plane_set_fb(sprite, NULL);
 		white_h = white_h/2;
 		white_v = white_v/2;
+		data->test_plane = sprite;
 	case DRM_PLANE_TYPE_PRIMARY:
 		igt_create_color_fb(data->drm_fd,
 				    white_h, white_v,
@@ -410,20 +405,21 @@ static void setup_test_plane(data_t *data)
 				    &data->fb_white);
 		break;
 	case DRM_PLANE_TYPE_CURSOR:
-		data->cursor = igt_output_get_plane_type(data->output,
-						    DRM_PLANE_TYPE_CURSOR);
-		igt_plane_set_fb(data->cursor, NULL);
+		cursor = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_CURSOR);
+		igt_plane_set_fb(cursor, NULL);
 		create_cursor_fb(data);
-		igt_plane_set_position(data->cursor, 0, 0);
+		igt_plane_set_position(cursor, 0, 0);
 
 		/* Cursor is 64 x 64, ignoring pitch and bbp again */
 		data->mod_size = 64 * 64;
+		data->test_plane = cursor;
 		break;
 	}
 
 	igt_display_commit(&data->display);
 
-	igt_plane_set_fb(data->primary, &data->fb_green);
+	igt_plane_set_fb(primary, &data->fb_green);
 	igt_display_commit(&data->display);
 }
 
@@ -489,13 +485,13 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest("basic") {
-		setup_test_plane(&data);
+		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
 		igt_assert(wait_psr_entry(&data));
 		test_cleanup(&data);
 	}
 
 	igt_subtest("no_drrs") {
-		setup_test_plane(&data);
+		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
 		igt_assert(wait_psr_entry(&data));
 		igt_assert(drrs_disabled(&data));
 		test_cleanup(&data);
@@ -503,9 +499,8 @@ int main(int argc, char *argv[])
 
 	for (op = PAGE_FLIP; op <= RENDER; op++) {
 		igt_subtest_f("primary_%s", op_str(op)) {
-			data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 			data.op = op;
-			setup_test_plane(&data);
+			setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
 			igt_assert(wait_psr_entry(&data));
 			run_test(&data);
 			test_cleanup(&data);
@@ -514,9 +509,8 @@ int main(int argc, char *argv[])
 
 	for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) {
 		igt_subtest_f("sprite_%s", op_str(op)) {
-			data.test_plane = DRM_PLANE_TYPE_OVERLAY;
 			data.op = op;
-			setup_test_plane(&data);
+			setup_test_plane(&data, DRM_PLANE_TYPE_OVERLAY);
 			igt_assert(wait_psr_entry(&data));
 			run_test(&data);
 			test_cleanup(&data);
@@ -525,9 +519,8 @@ int main(int argc, char *argv[])
 
 	for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) {
 		igt_subtest_f("cursor_%s", op_str(op)) {
-			data.test_plane = DRM_PLANE_TYPE_CURSOR;
 			data.op = op;
-			setup_test_plane(&data);
+			setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
 			igt_assert(wait_psr_entry(&data));
 			run_test(&data);
 			test_cleanup(&data);
@@ -535,9 +528,8 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest_f("dpms") {
-		data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 		data.op = RENDER;
-		setup_test_plane(&data);
+		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
 		igt_assert(wait_psr_entry(&data));
 		dpms_off_on(data);
 		run_test(&data);
@@ -545,9 +537,8 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest_f("suspend") {
-		data.test_plane = DRM_PLANE_TYPE_CURSOR;
 		data.op = PLANE_ONOFF;
-		setup_test_plane(&data);
+		setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
 		igt_assert(wait_psr_entry(&data));
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
-- 
2.14.1

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

  parent reply	other threads:[~2018-04-11  2:38 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11  2:37 [igt-dev] [PATCH i-g-t 01/20] tests/psr: Print the reason for skipping when sink lacks PSR support Dhinakaran Pandiyan
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 02/20] tests/psr: Remove "psr_" prefix from basic and drrs subtests Dhinakaran Pandiyan
2018-04-13 10:57   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 03/20] tests/psr: Rename psr_active() to psr_enabled() Dhinakaran Pandiyan
2018-04-13 10:58   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 04/20] tests/psr: Store the debugfs file descriptor Dhinakaran Pandiyan
2018-04-13 10:58   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 05/20] tests/psr: Assert sink CRC length and make use of igt_sysfs_read() Dhinakaran Pandiyan
2018-04-13 10:59   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 06/20] tests/psr: Optimize check for green frame Dhinakaran Pandiyan
2018-04-13 10:59   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 07/20] tests/psr: Kill MMAP_GTT_WAITING Dhinakaran Pandiyan
2018-04-12 11:11   ` Katarzyna Dec
2018-04-16 21:44     ` Pandiyan, Dhinakaran
2018-04-23 23:01       ` Rodrigo Vivi
2018-04-16 22:08     ` Dhinakaran Pandiyan
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 08/20] tests/psr: Merge PSR dpms and suspend variants Dhinakaran Pandiyan
2018-04-12 11:20   ` Katarzyna Dec
2018-04-16 21:46     ` Pandiyan, Dhinakaran
2018-04-17  7:58       ` Katarzyna Dec
2018-04-23 23:03       ` Rodrigo Vivi
2018-04-16 22:10     ` Dhinakaran Pandiyan
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 09/20] tests/psr: Check for PSR entry more often and only for a second Dhinakaran Pandiyan
2018-04-12 11:25   ` Katarzyna Dec
2018-04-16 22:43     ` Dhinakaran Pandiyan
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 10/20] tests/psr: Remove delay between dpms toggle Dhinakaran Pandiyan
2018-04-12 11:26   ` Katarzyna Dec
2018-04-13  0:24     ` Dhinakaran Pandiyan
2018-04-13 11:05       ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 11/20] tests/psr: Check for drrs status only after checking for PSR Dhinakaran Pandiyan
2018-04-13 11:21   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 12/20] tests/sink_crc_basic: Debug print CRC values Dhinakaran Pandiyan
2018-04-13 11:22   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 13/20] tests/psr: Get rid of global variable running_with_psr_disabled Dhinakaran Pandiyan
2018-04-13 11:22   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 14/20] tests/psr: Make testing with sink CRC non-default Dhinakaran Pandiyan
2018-04-13 11:22   ` Katarzyna Dec
2018-04-11  2:37 ` Dhinakaran Pandiyan [this message]
2018-04-13 11:23   ` [igt-dev] [PATCH i-g-t 15/20] tests/psr: Eliminate storing pointers for igt_plane_type Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 16/20] tests/psr: Pass data_t pointer to dpms_off_on Dhinakaran Pandiyan
2018-04-13 11:23   ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 17/20] tests/psr: Prepare for using timestamps Dhinakaran Pandiyan
2018-04-12 12:50   ` Katarzyna Dec
2018-04-13  0:21     ` Dhinakaran Pandiyan
2018-04-13 11:33       ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 18/20] tests/psr: Check for timestamp support Dhinakaran Pandiyan
2018-04-12 12:52   ` Katarzyna Dec
2018-04-13  0:13     ` Dhinakaran Pandiyan
2018-04-13  0:13       ` Dhinakaran Pandiyan
2018-04-13 11:34       ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 19/20] tests/psr: Test PSR using interrupt timestamps Dhinakaran Pandiyan
2018-04-12 12:56   ` Katarzyna Dec
2018-04-16 22:49     ` [igt-dev] [PATCH i-g-t v2] " Dhinakaran Pandiyan
2018-04-17 12:53       ` Katarzyna Dec
2018-04-11  2:37 ` [igt-dev] [PATCH i-g-t 20/20] tests/psr: Add more PSR subtests to fast feedback list Dhinakaran Pandiyan
2018-04-11  8:42   ` Petri Latvala
2018-04-11 16:14     ` Pandiyan, Dhinakaran
2018-04-13  9:16       ` Petri Latvala
2018-04-15  1:13         ` Dhinakaran Pandiyan
2018-04-23 23:06           ` Rodrigo Vivi
2018-04-23 23:58             ` Dhinakaran Pandiyan
2018-04-24  9:34               ` Petri Latvala
2018-04-24 15:32                 ` Saarinen, Jani
2018-04-24 17:48                   ` Dhinakaran Pandiyan
2018-04-24 21:28                     ` Rodrigo Vivi
2018-04-25  8:34                       ` Petri Latvala
2018-04-25 17:56                         ` Pandiyan, Dhinakaran
2018-04-25 20:15                           ` Rodrigo Vivi
2018-04-11  3:07 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/20] tests/psr: Print the reason for skipping when sink lacks PSR support Patchwork
2018-04-11  3:53 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
2018-04-12 11:08 ` [igt-dev] [PATCH i-g-t 01/20] " Katarzyna Dec
2018-04-12 13:03 ` Katarzyna Dec
2018-04-13 10:57 ` Katarzyna Dec
2018-04-16 23:10 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,01/20] tests/psr: Print the reason for skipping when sink lacks PSR support (rev2) Patchwork
2018-04-25 21:00 ` Patchwork
2018-04-26  8:40   ` Petri Latvala
2018-05-09 23:41     ` Dhinakaran Pandiyan
2018-04-26  9:58 ` 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=20180411023732.32362-15-dhinakaran.pandiyan@intel.com \
    --to=dhinakaran.pandiyan@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=rodrigo.vivi@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.