Skip to contentSkip to conversation

tests/kms_frontbuffer_tracking: convert macros to functions

PATCH In review Daniel Vetter 4 participants 6 messages Aug 14, 2017 – Sep 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_frontbuffer_tracking: convert macros to functions

Macros that should be C functions but aren't are really hard to read and confusing. Convert them over.

v2: Clean up commit message and keep printing the line numbers (Paulo).

v3: Actually git add (silly me).

---
 tests/kms_frontbuffer_tracking.c | 171 ++++++++++++++++++++-------------------
 1 file changed, 89 insertions(+), 82 deletions(-)
tests/kms_frontbuffer_tracking.c +89 -82
index e03524f1c45b..a068c8afb6d8 100644
@@ -1677,88 +1677,95 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags)
 	return flags;
 }
 
-#define do_crc_assertions(flags, mandatory_sink_crc) do {		\
-	int flags__ = (flags);						\
-	struct both_crcs crc_;						\
-									\
-	if (!opt.check_crc || (flags__ & DONT_ASSERT_CRC))		\
-		break;							\
-									\
-	collect_crcs(&crc_, mandatory_sink_crc);			\
-	print_crc("Calculated CRC:", &crc_);				\
-									\
-	igt_assert(wanted_crc);						\
-	igt_assert_crc_equal(&crc_.pipe, &wanted_crc->pipe);		\
-	if (mandatory_sink_crc)						\
-		assert_sink_crc_equal(&crc_.sink, &wanted_crc->sink);	\
-	else if (sink_crc.reliable &&					\
-		 !sink_crc_equal(&crc_.sink, &wanted_crc->sink))	\
-		igt_info("Sink CRC differ, but not required\n"); 	\
-} while (0)
-
-#define do_status_assertions(flags_) do {				\
-	if (!opt.check_status) {					\
-		/* Make sure we settle before continuing. */		\
-		sleep(1);						\
-		break;							\
-	}								\
-									\
-	if (flags_ & ASSERT_FBC_ENABLED) {				\
-		igt_require(!fbc_not_enough_stolen());			\
-		igt_require(!fbc_stride_not_supported());		\
-		if (!fbc_wait_until_enabled()) {			\
-			fbc_print_status();				\
-			igt_assert_f(false, "FBC disabled\n");		\
-		}							\
-									\
-		if (opt.fbc_check_compression)				\
-			igt_assert(fbc_wait_for_compression());		\
-	} else if (flags_ & ASSERT_FBC_DISABLED) {			\
-		igt_assert(!fbc_wait_until_enabled());			\
-	}								\
-									\
-	if (flags_ & ASSERT_PSR_ENABLED) {				\
-		if (!psr_wait_until_enabled()) {			\
-			psr_print_status();				\
-			igt_assert_f(false, "PSR disabled\n");		\
-		}							\
-	} else if (flags_ & ASSERT_PSR_DISABLED) {			\
-		igt_assert(!psr_wait_until_enabled());			\
-	}								\
-} while (0)
-
-#define do_assertions(flags) do {					\
-	int flags_ = adjust_assertion_flags(t, (flags));		\
-	bool mandatory_sink_crc = t->feature & FEATURE_PSR;		\
-									\
-	wait_user(2, "Paused before assertions.");			\
-									\
-	/* Check the CRC to make sure the drawing operations work	\
-	 * immediately, independently of the features being enabled. */	\
-	do_crc_assertions(flags_, mandatory_sink_crc);			\
-									\
-	/* Now we can flush things to make the test faster. */		\
-	do_flush(t);							\
-									\
-	do_status_assertions(flags_);					\
-									\
-	/* Check CRC again to make sure the compressed screen is ok,	\
-	 * except if we're not drawing on the primary screen. On this	\
-	 * case, the first check should be enough and a new CRC check	\
-	 * would only delay the test suite while adding no value to the	\
-	 * test suite. */						\
-	if (t->screen == SCREEN_PRIM)					\
-		do_crc_assertions(flags_, mandatory_sink_crc);		\
-									\
-	if (fbc.supports_last_action && opt.fbc_check_last_action) {	\
-		if (flags_ & ASSERT_LAST_ACTION_CHANGED)		\
-			igt_assert(fbc_last_action_changed());		\
-		else if (flags_ & ASSERT_NO_ACTION_CHANGE)		\
-			igt_assert(!fbc_last_action_changed());		\
-	}								\
-									\
-	wait_user(1, "Paused after assertions.");			\
-} while (0)
+static void do_crc_assertions(int flags, bool mandatory_sink_crc)
+{
+	struct both_crcs crc;
+
+	if (!opt.check_crc || (flags & DONT_ASSERT_CRC))
+		return;
+
+	collect_crcs(&crc, mandatory_sink_crc);
+	print_crc("Calculated CRC:", &crc);
+
+	igt_assert(wanted_crc);
+	igt_assert_crc_equal(&crc.pipe, &wanted_crc->pipe);
+	if (mandatory_sink_crc)
+		assert_sink_crc_equal(&crc.sink, &wanted_crc->sink);
+	else if (sink_crc.reliable &&
+		 !sink_crc_equal(&crc.sink, &wanted_crc->sink))
+		igt_info("Sink CRC differ, but not required\n");
+}
+
+static void do_status_assertions(int flags)
+{
+	if (!opt.check_status) {
+		/* Make sure we settle before continuing. */
+		sleep(1);
+		return;
+	}
+
+	if (flags & ASSERT_FBC_ENABLED) {
+		igt_require(!fbc_not_enough_stolen());
+		igt_require(!fbc_stride_not_supported());
+		if (!fbc_wait_until_enabled()) {
+			fbc_print_status();
+			igt_assert_f(false, "FBC disabled\n");
+		}
+
+		if (opt.fbc_check_compression)
+			igt_assert(fbc_wait_for_compression());
+	} else if (flags & ASSERT_FBC_DISABLED) {
+		igt_assert(!fbc_wait_until_enabled());
+	}
+
+	if (flags & ASSERT_PSR_ENABLED) {
+		if (!psr_wait_until_enabled()) {
+			psr_print_status();
+			igt_assert_f(false, "PSR disabled\n");
+		}
+	} else if (flags & ASSERT_PSR_DISABLED) {
+		igt_assert(!psr_wait_until_enabled());
+	}
+}
+
+static void __do_assertions(const struct test_mode *t, int flags,
+			    int line)
+{
+	flags = adjust_assertion_flags(t, flags);
+	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+
+	igt_debug("checking asserts in line %i\n", line);
+
+	wait_user(2, "Paused before assertions.");
+
+	/* Check the CRC to make sure the drawing operations work
+	 * immediately, independently of the features being enabled. */
+	do_crc_assertions(flags, mandatory_sink_crc);
+
+	/* Now we can flush things to make the test faster. */
+	do_flush(t);
+
+	do_status_assertions(flags);
+
+	/* Check CRC again to make sure the compressed screen is ok,
+	 * except if we're not drawing on the primary screen. On this
+	 * case, the first check should be enough and a new CRC check
+	 * would only delay the test suite while adding no value to the
+	 * test suite. */
+	if (t->screen == SCREEN_PRIM)
+		do_crc_assertions(flags, mandatory_sink_crc);
+
+	if (fbc.supports_last_action && opt.fbc_check_last_action) {
+		if (flags & ASSERT_LAST_ACTION_CHANGED)
+			igt_assert(fbc_last_action_changed());
+		else if (flags & ASSERT_NO_ACTION_CHANGE)
+			igt_assert(!fbc_last_action_changed());
+	}
+
+	wait_user(1, "Paused after assertions.");
+}
+
+#define do_assertions(__flags) __do_assertions(t, (__flags), __LINE__)
 
 static void enable_prim_screen_and_wait(const struct test_mode *t)
 {
Signature · 6 lines
2.5.5

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

✓ Fi.CI.BAT: success for tests/kms_frontbuffer_tracking: convert macros to functions (rev3)

== Series Details ==

== Series Details ==

Series: tests/kms_frontbuffer_tracking: convert macros to functions (rev3)
URL : https://patchwork.freedesktop.org/series/28389/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 0c514b0cb876fb578afb2bb0297579bc896251d8 configure.ac: bump libdrm requirement to 2.4.82

with latest DRM-Tip kernel build CI_DRM_2956
7a620d02bd0a drm-tip: 2017y-08m-14d-09h-26m-51s UTC integration manifest

Test gem_exec_parallel:

        Subgroup basic:
                fail       -> PASS       (fi-ilk-650) fdo#101735
Test gem_ringfill:
        Subgroup basic-default:
                skip       -> PASS       (fi-bsw-n3050) fdo#101915

fdo#101735 https://bugs.freedesktop.org/show_bug.cgi?id=101735
fdo#101915 https://bugs.freedesktop.org/show_bug.cgi?id=101915

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:443s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:432s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:353s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:551s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:510s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:520s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:512s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:612s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:442s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:418s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:419s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:501s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:478s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:471s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:583s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:595s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:525s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:462s
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:470s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:483s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:441s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:498s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:547s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:412s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_60/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Vetter

Em Seg, 2017-08-14 às 11:25 +0200, Daniel Vetter escreveu:

Quoted 10 lines

Macros that should be C functions but aren't are really hard to read and confusing. Convert them over.

v2: Clean up commit message and keep printing the line numbers (Paulo).

v3: Actually git add (silly me).

Thanks for doing that. Works for me this way:

But I'm still waiting for the patch that removes those bogus line numbers in every error message we print :).

Quoted 267 lines

---
 tests/kms_frontbuffer_tracking.c | 171 ++++++++++++++++++++---------
----------

 1 file changed, 89 insertions(+), 82 deletions(-)
tests/kms_frontbuffer_tracking.c +0 -0
index e03524f1c45b..a068c8afb6d8 100644
@@ -1677,88 +1677,95 @@ static int adjust_assertion_flags(const
 struct test_mode *t, int flags)
  	return flags;
  }


-#define do_crc_assertions(flags, mandatory_sink_crc) do { \

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags__ = (flags);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	struct both_crcs crc_;					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_crc || (flags__ & DONT_ASSERT_CRC))		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	collect_crcs(&crc_, mandatory_sink_crc);			

\

tests/kms_frontbuffer_tracking.c +0 -1
-	print_crc("Calculated CRC:", &crc_);				

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert(wanted_crc);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert_crc_equal(&crc_.pipe, &wanted_crc->pipe);		

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (mandatory_sink_crc)					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		assert_sink_crc_equal(&crc_.sink, &wanted_crc-
Quoted 1 line

sink); \

tests/kms_frontbuffer_tracking.c +0 -1
-	else if (sink_crc.reliable &&				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		 !sink_crc_equal(&crc_.sink, &wanted_crc->sink))	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_info("Sink CRC differ, but not required\n"); 	

\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_status_assertions(flags_) do {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_status) {					

\

tests/kms_frontbuffer_tracking.c +0 -1
-		/* Make sure we settle before continuing. */		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		sleep(1);						

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_FBC_ENABLED) {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_not_enough_stolen());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_stride_not_supported());		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!fbc_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			fbc_print_status();				

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "FBC disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (opt.fbc_check_compression)			
	\
tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_wait_for_compression());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_FBC_DISABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!fbc_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_PSR_ENABLED) {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!psr_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			psr_print_status();				

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "PSR disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_PSR_DISABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!psr_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_assertions(flags) do {					

\

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags_ = adjust_assertion_flags(t, (flags));		

\

tests/kms_frontbuffer_tracking.c +0 -1
-	bool mandatory_sink_crc = t->feature & FEATURE_PSR;		

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(2, "Paused before assertions.");			

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check the CRC to make sure the drawing operations work	

\

tests/kms_frontbuffer_tracking.c +0 -1
-	 * immediately, independently of the features being enabled.

*/ \

tests/kms_frontbuffer_tracking.c +0 -1
-	do_crc_assertions(flags_, mandatory_sink_crc);		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Now we can flush things to make the test faster. */	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	do_flush(t);							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	do_status_assertions(flags_);				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check CRC again to make sure the compressed screen is ok,
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	 * except if we're not drawing on the primary screen. On

this \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * case, the first check should be enough and a new CRC

check \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * would only delay the test suite while adding no value to

the \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * test suite. */						

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (t->screen == SCREEN_PRIM)				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		do_crc_assertions(flags_, mandatory_sink_crc);	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (fbc.supports_last_action && opt.fbc_check_last_action) {
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		if (flags_ & ASSERT_LAST_ACTION_CHANGED)		

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		else if (flags_ & ASSERT_NO_ACTION_CHANGE)		

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(!fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(1, "Paused after assertions.");			

\

tests/kms_frontbuffer_tracking.c +63 -1
-} while (0)
+static void do_crc_assertions(int flags, bool mandatory_sink_crc)
+{
+	struct both_crcs crc;
+
+	if (!opt.check_crc || (flags & DONT_ASSERT_CRC))
+		return;
+
+	collect_crcs(&crc, mandatory_sink_crc);
+	print_crc("Calculated CRC:", &crc);
+
+	igt_assert(wanted_crc);
+	igt_assert_crc_equal(&crc.pipe, &wanted_crc->pipe);
+	if (mandatory_sink_crc)
+		assert_sink_crc_equal(&crc.sink, &wanted_crc->sink);
+	else if (sink_crc.reliable &&
+		 !sink_crc_equal(&crc.sink, &wanted_crc->sink))
+		igt_info("Sink CRC differ, but not required\n");
+}
+
+static void do_status_assertions(int flags)
+{
+	if (!opt.check_status) {
+		/* Make sure we settle before continuing. */
+		sleep(1);
+		return;
+	}
+
+	if (flags & ASSERT_FBC_ENABLED) {
+		igt_require(!fbc_not_enough_stolen());
+		igt_require(!fbc_stride_not_supported());
+		if (!fbc_wait_until_enabled()) {
+			fbc_print_status();
+			igt_assert_f(false, "FBC disabled\n");
+		}
+
+		if (opt.fbc_check_compression)
+			igt_assert(fbc_wait_for_compression());
+	} else if (flags & ASSERT_FBC_DISABLED) {
+		igt_assert(!fbc_wait_until_enabled());
+	}
+
+	if (flags & ASSERT_PSR_ENABLED) {
+		if (!psr_wait_until_enabled()) {
+			psr_print_status();
+			igt_assert_f(false, "PSR disabled\n");
+		}
+	} else if (flags & ASSERT_PSR_DISABLED) {
+		igt_assert(!psr_wait_until_enabled());
+	}
+}
+
+static void __do_assertions(const struct test_mode *t, int flags,
+			    int line)
+{
+	flags = adjust_assertion_flags(t, flags);
+	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+
+	igt_debug("checking asserts in line %i\n", line);
+
+	wait_user(2, "Paused before assertions.");
+
+	/* Check the CRC to make sure the drawing operations work
+	 * immediately, independently of the features being enabled.

*/

tests/kms_frontbuffer_tracking.c +9 -0
+	do_crc_assertions(flags, mandatory_sink_crc);
+
+	/* Now we can flush things to make the test faster. */
+	do_flush(t);
+
+	do_status_assertions(flags);
+
+	/* Check CRC again to make sure the compressed screen is ok,
+	 * except if we're not drawing on the primary screen. On

this

tests/kms_frontbuffer_tracking.c +1 -0
+	 * case, the first check should be enough and a new CRC

check

tests/kms_frontbuffer_tracking.c +1 -0
+	 * would only delay the test suite while adding no value to

the

tests/kms_frontbuffer_tracking.c +15 -0
+	 * test suite. */
+	if (t->screen == SCREEN_PRIM)
+		do_crc_assertions(flags, mandatory_sink_crc);
+
+	if (fbc.supports_last_action && opt.fbc_check_last_action) {
+		if (flags & ASSERT_LAST_ACTION_CHANGED)
+			igt_assert(fbc_last_action_changed());
+		else if (flags & ASSERT_NO_ACTION_CHANGE)
+			igt_assert(!fbc_last_action_changed());
+	}
+
+	wait_user(1, "Paused after assertions.");
+}
+
+#define do_assertions(__flags) __do_assertions(t, (__flags),
Quoted 4 lines

__LINE__)

 static void enable_prim_screen_and_wait(const struct test_mode *t) {

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

#3 lore raw
Quoted 7 lines · Paulo Zanoni

Em Seg, 2017-08-14 às 11:25 +0200, Daniel Vetter escreveu:

Quoted 6 lines

Macros that should be C functions but aren't are really hard to read and confusing. Convert them over.

v2: Clean up commit message and keep printing the line numbers (Paulo).

Quoted 7 lines
Quoted 4 lines

v3: Actually git add (silly me).

Thanks for doing that. Works for me this way:

Thanks, pushed.

Quoted 2 lines

But I'm still waiting for the patch that removes those bogus line numbers in every error message we print :).

Hm, which bogus line numbers where?
-Daniel

Quoted 272 lines
Quoted 272 lines

---
 tests/kms_frontbuffer_tracking.c | 171 ++++++++++++++++++++---------
----------

 1 file changed, 89 insertions(+), 82 deletions(-)
tests/kms_frontbuffer_tracking.c +0 -0
index e03524f1c45b..a068c8afb6d8 100644
@@ -1677,88 +1677,95 @@ static int adjust_assertion_flags(const
 struct test_mode *t, int flags)
  	return flags;
  }


-#define do_crc_assertions(flags, mandatory_sink_crc) do { \

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags__ = (flags);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	struct both_crcs crc_;					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_crc || (flags__ & DONT_ASSERT_CRC))		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	collect_crcs(&crc_, mandatory_sink_crc);			

\

tests/kms_frontbuffer_tracking.c +0 -1
-	print_crc("Calculated CRC:", &crc_);				

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert(wanted_crc);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert_crc_equal(&crc_.pipe, &wanted_crc->pipe);		

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (mandatory_sink_crc)					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		assert_sink_crc_equal(&crc_.sink, &wanted_crc-
Quoted 1 line

sink); \

tests/kms_frontbuffer_tracking.c +0 -1
-	else if (sink_crc.reliable &&				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		 !sink_crc_equal(&crc_.sink, &wanted_crc->sink))	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_info("Sink CRC differ, but not required\n"); 	

\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_status_assertions(flags_) do {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_status) {					

\

tests/kms_frontbuffer_tracking.c +0 -1
-		/* Make sure we settle before continuing. */		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		sleep(1);						

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_FBC_ENABLED) {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_not_enough_stolen());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_stride_not_supported());		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!fbc_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			fbc_print_status();				

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "FBC disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (opt.fbc_check_compression)			
	\
tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_wait_for_compression());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_FBC_DISABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!fbc_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_PSR_ENABLED) {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!psr_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			psr_print_status();				

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "PSR disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_PSR_DISABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!psr_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_assertions(flags) do {					

\

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags_ = adjust_assertion_flags(t, (flags));		

\

tests/kms_frontbuffer_tracking.c +0 -1
-	bool mandatory_sink_crc = t->feature & FEATURE_PSR;		

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(2, "Paused before assertions.");			

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check the CRC to make sure the drawing operations work	

\

tests/kms_frontbuffer_tracking.c +0 -1
-	 * immediately, independently of the features being enabled.

*/ \

tests/kms_frontbuffer_tracking.c +0 -1
-	do_crc_assertions(flags_, mandatory_sink_crc);		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Now we can flush things to make the test faster. */	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	do_flush(t);							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	do_status_assertions(flags_);				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check CRC again to make sure the compressed screen is ok,
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	 * except if we're not drawing on the primary screen. On

this \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * case, the first check should be enough and a new CRC

check \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * would only delay the test suite while adding no value to

the \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * test suite. */						

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (t->screen == SCREEN_PRIM)				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		do_crc_assertions(flags_, mandatory_sink_crc);	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (fbc.supports_last_action && opt.fbc_check_last_action) {
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		if (flags_ & ASSERT_LAST_ACTION_CHANGED)		

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		else if (flags_ & ASSERT_NO_ACTION_CHANGE)		

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(!fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}								

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(1, "Paused after assertions.");			

\

tests/kms_frontbuffer_tracking.c +63 -1
-} while (0)
+static void do_crc_assertions(int flags, bool mandatory_sink_crc)
+{
+	struct both_crcs crc;
+
+	if (!opt.check_crc || (flags & DONT_ASSERT_CRC))
+		return;
+
+	collect_crcs(&crc, mandatory_sink_crc);
+	print_crc("Calculated CRC:", &crc);
+
+	igt_assert(wanted_crc);
+	igt_assert_crc_equal(&crc.pipe, &wanted_crc->pipe);
+	if (mandatory_sink_crc)
+		assert_sink_crc_equal(&crc.sink, &wanted_crc->sink);
+	else if (sink_crc.reliable &&
+		 !sink_crc_equal(&crc.sink, &wanted_crc->sink))
+		igt_info("Sink CRC differ, but not required\n");
+}
+
+static void do_status_assertions(int flags)
+{
+	if (!opt.check_status) {
+		/* Make sure we settle before continuing. */
+		sleep(1);
+		return;
+	}
+
+	if (flags & ASSERT_FBC_ENABLED) {
+		igt_require(!fbc_not_enough_stolen());
+		igt_require(!fbc_stride_not_supported());
+		if (!fbc_wait_until_enabled()) {
+			fbc_print_status();
+			igt_assert_f(false, "FBC disabled\n");
+		}
+
+		if (opt.fbc_check_compression)
+			igt_assert(fbc_wait_for_compression());
+	} else if (flags & ASSERT_FBC_DISABLED) {
+		igt_assert(!fbc_wait_until_enabled());
+	}
+
+	if (flags & ASSERT_PSR_ENABLED) {
+		if (!psr_wait_until_enabled()) {
+			psr_print_status();
+			igt_assert_f(false, "PSR disabled\n");
+		}
+	} else if (flags & ASSERT_PSR_DISABLED) {
+		igt_assert(!psr_wait_until_enabled());
+	}
+}
+
+static void __do_assertions(const struct test_mode *t, int flags,
+			    int line)
+{
+	flags = adjust_assertion_flags(t, flags);
+	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+
+	igt_debug("checking asserts in line %i\n", line);
+
+	wait_user(2, "Paused before assertions.");
+
+	/* Check the CRC to make sure the drawing operations work
+	 * immediately, independently of the features being enabled.

*/

tests/kms_frontbuffer_tracking.c +9 -0
+	do_crc_assertions(flags, mandatory_sink_crc);
+
+	/* Now we can flush things to make the test faster. */
+	do_flush(t);
+
+	do_status_assertions(flags);
+
+	/* Check CRC again to make sure the compressed screen is ok,
+	 * except if we're not drawing on the primary screen. On

this

tests/kms_frontbuffer_tracking.c +1 -0
+	 * case, the first check should be enough and a new CRC

check

tests/kms_frontbuffer_tracking.c +1 -0
+	 * would only delay the test suite while adding no value to

the

tests/kms_frontbuffer_tracking.c +15 -0
+	 * test suite. */
+	if (t->screen == SCREEN_PRIM)
+		do_crc_assertions(flags, mandatory_sink_crc);
+
+	if (fbc.supports_last_action && opt.fbc_check_last_action) {
+		if (flags & ASSERT_LAST_ACTION_CHANGED)
+			igt_assert(fbc_last_action_changed());
+		else if (flags & ASSERT_NO_ACTION_CHANGE)
+			igt_assert(!fbc_last_action_changed());
+	}
+
+	wait_user(1, "Paused after assertions.");
+}
+
+#define do_assertions(__flags) __do_assertions(t, (__flags),

__LINE__)

 static void enable_prim_screen_and_wait(const struct test_mode *t) {

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Em Seg, 2017-09-04 às 10:00 +0200, Daniel Vetter escreveu:

Quoted 16 lines · Paulo Zanoni
Quoted 7 lines

Em Seg, 2017-08-14 às 11:25 +0200, Daniel Vetter escreveu:

Quoted 6 lines

Macros that should be C functions but aren't are really hard to read and confusing. Convert them over.

v2: Clean up commit message and keep printing the line numbers (Paulo).

Quoted 7 lines
Quoted 4 lines

v3: Actually git add (silly me).

Thanks for doing that. Works for me this way:

Quoted 6 lines

Thanks, pushed.

Quoted 2 lines

But I'm still waiting for the patch that removes those bogus line numbers in every error message we print :).

Hm, which bogus line numbers where?

Every igt_log message is starts with:
(kms_frontbuffer_tracking:XXXX) where XXXX is a number that means nothing but looks like a line number, except that that line usually has nothing to do with the message.

Quoted 310 lines

-Daniel

Quoted 309 lines
Quoted 309 lines

---
 tests/kms_frontbuffer_tracking.c | 171 ++++++++++++++++++++-----
----
----------

 1 file changed, 89 insertions(+), 82 deletions(-)
tests/kms_frontbuffer_tracking.c +0 -0
index e03524f1c45b..a068c8afb6d8 100644
@@ -1677,88 +1677,95 @@ static int adjust_assertion_flags(const
 struct test_mode *t, int flags)
  	return flags;
  }


-#define do_crc_assertions(flags, mandatory_sink_crc) do {

\

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags__ = (flags);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	struct both_crcs crc_;					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_crc || (flags__ & DONT_ASSERT_CRC))	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	collect_crcs(&crc_, mandatory_sink_crc);			

\

tests/kms_frontbuffer_tracking.c +0 -1
-	print_crc("Calculated CRC:", &crc_);			

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert(wanted_crc);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert_crc_equal(&crc_.pipe, &wanted_crc->pipe);	

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (mandatory_sink_crc)					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		assert_sink_crc_equal(&crc_.sink, &wanted_crc-
Quoted 1 line

sink); \

tests/kms_frontbuffer_tracking.c +0 -1
-	else if (sink_crc.reliable &&				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		 !sink_crc_equal(&crc_.sink, &wanted_crc->sink))

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_info("Sink CRC differ, but not

required\n");
\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_status_assertions(flags_) do {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_status) {					

\

tests/kms_frontbuffer_tracking.c +0 -1
-		/* Make sure we settle before continuing. */	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		sleep(1);					

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_FBC_ENABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_not_enough_stolen());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_stride_not_supported());	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!fbc_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			fbc_print_status();			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "FBC disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}						

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (opt.fbc_check_compression)			
	\
tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_wait_for_compression());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_FBC_DISABLED) {		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!fbc_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_PSR_ENABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!psr_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			psr_print_status();			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "PSR disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}						

\

tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_PSR_DISABLED) {		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!psr_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_assertions(flags) do {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags_ = adjust_assertion_flags(t, (flags));		

\

tests/kms_frontbuffer_tracking.c +0 -1
-	bool mandatory_sink_crc = t->feature & FEATURE_PSR;	

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(2, "Paused before assertions.");		

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check the CRC to make sure the drawing operations

work
\

tests/kms_frontbuffer_tracking.c +0 -1
-	 * immediately, independently of the features being

enabled.
*/ \

tests/kms_frontbuffer_tracking.c +0 -1
-	do_crc_assertions(flags_, mandatory_sink_crc);		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Now we can flush things to make the test faster. */	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	do_flush(t);						

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	do_status_assertions(flags_);				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check CRC again to make sure the compressed screen is

ok,

	\
tests/kms_frontbuffer_tracking.c +0 -1
-	 * except if we're not drawing on the primary screen. On

this \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * case, the first check should be enough and a new CRC

check \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * would only delay the test suite while adding no value

to
the \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * test suite. */					

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (t->screen == SCREEN_PRIM)				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		do_crc_assertions(flags_, mandatory_sink_crc);	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (fbc.supports_last_action &&
opt.fbc_check_last_action) {
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		if (flags_ & ASSERT_LAST_ACTION_CHANGED)		

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		else if (flags_ & ASSERT_NO_ACTION_CHANGE)	

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(!fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(1, "Paused after assertions.");		

\

tests/kms_frontbuffer_tracking.c +1 -1
-} while (0)
+static void do_crc_assertions(int flags, bool

mandatory_sink_crc)

tests/kms_frontbuffer_tracking.c +13 -0
+{
+	struct both_crcs crc;
+
+	if (!opt.check_crc || (flags & DONT_ASSERT_CRC))
+		return;
+
+	collect_crcs(&crc, mandatory_sink_crc);
+	print_crc("Calculated CRC:", &crc);
+
+	igt_assert(wanted_crc);
+	igt_assert_crc_equal(&crc.pipe, &wanted_crc->pipe);
+	if (mandatory_sink_crc)
+		assert_sink_crc_equal(&crc.sink, &wanted_crc-
Quoted 1 line

sink);

tests/kms_frontbuffer_tracking.c +38 -0
+	else if (sink_crc.reliable &&
+		 !sink_crc_equal(&crc.sink, &wanted_crc->sink))
+		igt_info("Sink CRC differ, but not required\n");
+}
+
+static void do_status_assertions(int flags)
+{
+	if (!opt.check_status) {
+		/* Make sure we settle before continuing. */
+		sleep(1);
+		return;
+	}
+
+	if (flags & ASSERT_FBC_ENABLED) {
+		igt_require(!fbc_not_enough_stolen());
+		igt_require(!fbc_stride_not_supported());
+		if (!fbc_wait_until_enabled()) {
+			fbc_print_status();
+			igt_assert_f(false, "FBC disabled\n");
+		}
+
+		if (opt.fbc_check_compression)
+			igt_assert(fbc_wait_for_compression());
+	} else if (flags & ASSERT_FBC_DISABLED) {
+		igt_assert(!fbc_wait_until_enabled());
+	}
+
+	if (flags & ASSERT_PSR_ENABLED) {
+		if (!psr_wait_until_enabled()) {
+			psr_print_status();
+			igt_assert_f(false, "PSR disabled\n");
+		}
+	} else if (flags & ASSERT_PSR_DISABLED) {
+		igt_assert(!psr_wait_until_enabled());
+	}
+}
+
+static void __do_assertions(const struct test_mode *t, int

flags,

tests/kms_frontbuffer_tracking.c +10 -0
+			    int line)
+{
+	flags = adjust_assertion_flags(t, flags);
+	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+
+	igt_debug("checking asserts in line %i\n", line);
+
+	wait_user(2, "Paused before assertions.");
+
+	/* Check the CRC to make sure the drawing operations

work

tests/kms_frontbuffer_tracking.c +1 -0
+	 * immediately, independently of the features being

enabled.
*/

tests/kms_frontbuffer_tracking.c +8 -0
+	do_crc_assertions(flags, mandatory_sink_crc);
+
+	/* Now we can flush things to make the test faster. */
+	do_flush(t);
+
+	do_status_assertions(flags);
+
+	/* Check CRC again to make sure the compressed screen is

ok,

tests/kms_frontbuffer_tracking.c +1 -0
+	 * except if we're not drawing on the primary screen. On

this

tests/kms_frontbuffer_tracking.c +1 -0
+	 * case, the first check should be enough and a new CRC

check

tests/kms_frontbuffer_tracking.c +1 -0
+	 * would only delay the test suite while adding no value

to
the

tests/kms_frontbuffer_tracking.c +5 -0
+	 * test suite. */
+	if (t->screen == SCREEN_PRIM)
+		do_crc_assertions(flags, mandatory_sink_crc);
+
+	if (fbc.supports_last_action &&

opt.fbc_check_last_action) {

tests/kms_frontbuffer_tracking.c +7 -0
+		if (flags & ASSERT_LAST_ACTION_CHANGED)
+			igt_assert(fbc_last_action_changed());
+		else if (flags & ASSERT_NO_ACTION_CHANGE)
+			igt_assert(!fbc_last_action_changed());
+	}
+
+	wait_user(1, "Paused after assertions.");
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
tests/kms_frontbuffer_tracking.c +3 -0
+}
+
+#define do_assertions(__flags) __do_assertions(t, (__flags),

__LINE__)

 static void enable_prim_screen_and_wait(const struct test_mode *t)
 {

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

#5 lore raw
Quoted 22 lines · Paulo Zanoni

Em Seg, 2017-09-04 às 10:00 +0200, Daniel Vetter escreveu:

Quoted 21 lines · Paulo Zanoni
Quoted 7 lines

Em Seg, 2017-08-14 às 11:25 +0200, Daniel Vetter escreveu:

Quoted 6 lines

Macros that should be C functions but aren't are really hard to read and confusing. Convert them over.

v2: Clean up commit message and keep printing the line numbers (Paulo).

Quoted 7 lines
Quoted 4 lines

v3: Actually git add (silly me).

Thanks for doing that. Works for me this way:

Thanks, pushed.

Quoted 2 lines

But I'm still waiting for the patch that removes those bogus line numbers in every error message we print :).

Quoted 6 lines
Quoted 1 line

Hm, which bogus line numbers where?

Every igt_log message is starts with:
(kms_frontbuffer_tracking:XXXX) where XXXX is a number that means nothing but looks like a line number, except that that line usually has nothing to do with the message.

It's the process id. Not idea how you came up with the idea it's a line number, executable:pid is pretty standard format for logfiles. Note how it's the executable file name, not the source code file name.

And pid matters if you have a testcase that does lots of forking.

Should we improve the documentation about this? Care to type a patch please?

Thanks, Daniel

Quoted 321 lines
Quoted 321 lines

-Daniel

Quoted 317 lines
Quoted 317 lines

---
 tests/kms_frontbuffer_tracking.c | 171 ++++++++++++++++++++-----
----
----------

 1 file changed, 89 insertions(+), 82 deletions(-)
tests/kms_frontbuffer_tracking.c +0 -0
index e03524f1c45b..a068c8afb6d8 100644
@@ -1677,88 +1677,95 @@ static int adjust_assertion_flags(const
 struct test_mode *t, int flags)
  	return flags;
  }


-#define do_crc_assertions(flags, mandatory_sink_crc) do {

\

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags__ = (flags);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	struct both_crcs crc_;					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_crc || (flags__ & DONT_ASSERT_CRC))	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	collect_crcs(&crc_, mandatory_sink_crc);			

\

tests/kms_frontbuffer_tracking.c +0 -1
-	print_crc("Calculated CRC:", &crc_);			

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert(wanted_crc);					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	igt_assert_crc_equal(&crc_.pipe, &wanted_crc->pipe);	

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (mandatory_sink_crc)					
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		assert_sink_crc_equal(&crc_.sink, &wanted_crc-
Quoted 1 line

sink); \

tests/kms_frontbuffer_tracking.c +0 -1
-	else if (sink_crc.reliable &&				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		 !sink_crc_equal(&crc_.sink, &wanted_crc->sink))

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_info("Sink CRC differ, but not

required\n");
\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_status_assertions(flags_) do {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (!opt.check_status) {					

\

tests/kms_frontbuffer_tracking.c +0 -1
-		/* Make sure we settle before continuing. */	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		sleep(1);					

\

tests/kms_frontbuffer_tracking.c +0 -1
-		break;						
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_FBC_ENABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_not_enough_stolen());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		igt_require(!fbc_stride_not_supported());	

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!fbc_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			fbc_print_status();			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "FBC disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}						

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (opt.fbc_check_compression)			
	\
tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_wait_for_compression());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_FBC_DISABLED) {		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!fbc_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (flags_ & ASSERT_PSR_ENABLED) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-		if (!psr_wait_until_enabled()) {			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			psr_print_status();			

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert_f(false, "PSR disabled\n");	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		}						

\

tests/kms_frontbuffer_tracking.c +0 -1
-	} else if (flags_ & ASSERT_PSR_DISABLED) {		

\

tests/kms_frontbuffer_tracking.c +0 -1
-		igt_assert(!psr_wait_until_enabled());		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -3
-} while (0)
-
-#define do_assertions(flags) do {				

\

tests/kms_frontbuffer_tracking.c +0 -1
-	int flags_ = adjust_assertion_flags(t, (flags));		

\

tests/kms_frontbuffer_tracking.c +0 -1
-	bool mandatory_sink_crc = t->feature & FEATURE_PSR;	

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(2, "Paused before assertions.");		

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check the CRC to make sure the drawing operations

work
\

tests/kms_frontbuffer_tracking.c +0 -1
-	 * immediately, independently of the features being

enabled.
*/ \

tests/kms_frontbuffer_tracking.c +0 -1
-	do_crc_assertions(flags_, mandatory_sink_crc);		
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Now we can flush things to make the test faster. */	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	do_flush(t);						

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	do_status_assertions(flags_);				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	/* Check CRC again to make sure the compressed screen is

ok,

	\
tests/kms_frontbuffer_tracking.c +0 -1
-	 * except if we're not drawing on the primary screen. On

this \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * case, the first check should be enough and a new CRC

check \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * would only delay the test suite while adding no value

to
the \

tests/kms_frontbuffer_tracking.c +0 -1
-	 * test suite. */					

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (t->screen == SCREEN_PRIM)				
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		do_crc_assertions(flags_, mandatory_sink_crc);	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	if (fbc.supports_last_action &&
opt.fbc_check_last_action) {
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		if (flags_ & ASSERT_LAST_ACTION_CHANGED)		

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-		else if (flags_ & ASSERT_NO_ACTION_CHANGE)	

\

tests/kms_frontbuffer_tracking.c +0 -1
-			igt_assert(!fbc_last_action_changed());	
	\
tests/kms_frontbuffer_tracking.c +0 -1
-	}							

\

tests/kms_frontbuffer_tracking.c +0 -1
-									

\

tests/kms_frontbuffer_tracking.c +0 -1
-	wait_user(1, "Paused after assertions.");		

\

tests/kms_frontbuffer_tracking.c +1 -1
-} while (0)
+static void do_crc_assertions(int flags, bool

mandatory_sink_crc)

tests/kms_frontbuffer_tracking.c +13 -0
+{
+	struct both_crcs crc;
+
+	if (!opt.check_crc || (flags & DONT_ASSERT_CRC))
+		return;
+
+	collect_crcs(&crc, mandatory_sink_crc);
+	print_crc("Calculated CRC:", &crc);
+
+	igt_assert(wanted_crc);
+	igt_assert_crc_equal(&crc.pipe, &wanted_crc->pipe);
+	if (mandatory_sink_crc)
+		assert_sink_crc_equal(&crc.sink, &wanted_crc-
Quoted 1 line

sink);

tests/kms_frontbuffer_tracking.c +38 -0
+	else if (sink_crc.reliable &&
+		 !sink_crc_equal(&crc.sink, &wanted_crc->sink))
+		igt_info("Sink CRC differ, but not required\n");
+}
+
+static void do_status_assertions(int flags)
+{
+	if (!opt.check_status) {
+		/* Make sure we settle before continuing. */
+		sleep(1);
+		return;
+	}
+
+	if (flags & ASSERT_FBC_ENABLED) {
+		igt_require(!fbc_not_enough_stolen());
+		igt_require(!fbc_stride_not_supported());
+		if (!fbc_wait_until_enabled()) {
+			fbc_print_status();
+			igt_assert_f(false, "FBC disabled\n");
+		}
+
+		if (opt.fbc_check_compression)
+			igt_assert(fbc_wait_for_compression());
+	} else if (flags & ASSERT_FBC_DISABLED) {
+		igt_assert(!fbc_wait_until_enabled());
+	}
+
+	if (flags & ASSERT_PSR_ENABLED) {
+		if (!psr_wait_until_enabled()) {
+			psr_print_status();
+			igt_assert_f(false, "PSR disabled\n");
+		}
+	} else if (flags & ASSERT_PSR_DISABLED) {
+		igt_assert(!psr_wait_until_enabled());
+	}
+}
+
+static void __do_assertions(const struct test_mode *t, int

flags,

tests/kms_frontbuffer_tracking.c +10 -0
+			    int line)
+{
+	flags = adjust_assertion_flags(t, flags);
+	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+
+	igt_debug("checking asserts in line %i\n", line);
+
+	wait_user(2, "Paused before assertions.");
+
+	/* Check the CRC to make sure the drawing operations

work

tests/kms_frontbuffer_tracking.c +1 -0
+	 * immediately, independently of the features being

enabled.
*/

tests/kms_frontbuffer_tracking.c +8 -0
+	do_crc_assertions(flags, mandatory_sink_crc);
+
+	/* Now we can flush things to make the test faster. */
+	do_flush(t);
+
+	do_status_assertions(flags);
+
+	/* Check CRC again to make sure the compressed screen is

ok,

tests/kms_frontbuffer_tracking.c +1 -0
+	 * except if we're not drawing on the primary screen. On

this

tests/kms_frontbuffer_tracking.c +1 -0
+	 * case, the first check should be enough and a new CRC

check

tests/kms_frontbuffer_tracking.c +1 -0
+	 * would only delay the test suite while adding no value

to
the

tests/kms_frontbuffer_tracking.c +5 -0
+	 * test suite. */
+	if (t->screen == SCREEN_PRIM)
+		do_crc_assertions(flags, mandatory_sink_crc);
+
+	if (fbc.supports_last_action &&

opt.fbc_check_last_action) {

tests/kms_frontbuffer_tracking.c +10 -0
+		if (flags & ASSERT_LAST_ACTION_CHANGED)
+			igt_assert(fbc_last_action_changed());
+		else if (flags & ASSERT_NO_ACTION_CHANGE)
+			igt_assert(!fbc_last_action_changed());
+	}
+
+	wait_user(1, "Paused after assertions.");
+}
+
+#define do_assertions(__flags) __do_assertions(t, (__flags),

__LINE__)

 static void enable_prim_screen_and_wait(const struct test_mode *t)
 {

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx