All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] lib: Add igt_hweight{32,64}
@ 2018-03-12 20:42 Ville Syrjala
  2018-03-12 20:42 ` [igt-dev] [PATCH i-g-t 2/3] lib: Parse plane IN_FORMATS blobifiers into a nicer form Ville Syrjala
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Ville Syrjala @ 2018-03-12 20:42 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add the binary hamming weight helpers to igt_aux.h.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_aux.h                 |  3 +++
 tests/kms_atomic_transition.c | 14 ++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 43dd15fe3b32..244b9317b509 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -385,4 +385,7 @@ static inline bool igt_list_empty(const struct igt_list *list)
 	     &pos->member != (head);					\
 	     pos = tmp, tmp = igt_list_next_entry(pos, member))
 
+#define igt_hweight32 __builtin_popcount
+#define igt_hweight64 __builtin_popcountll
+
 #endif /* IGT_AUX_H */
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index aa9a6f8439ea..fe749bb7a919 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -44,8 +44,6 @@ struct plane_parms {
 	uint32_t width, height;
 };
 
-#define hweight32 __builtin_popcount
-
 /* globals for fence support */
 int *timeline;
 pthread_t *thread;
@@ -498,7 +496,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	}
 
 	for (i = 0; i < iter_max; i++) {
-		int n_enable_planes = hweight32(i);
+		int n_enable_planes = igt_hweight32(i);
 
 		if (type == TRANSITION_MODESET_FAST &&
 		    n_enable_planes > 1 &&
@@ -524,7 +522,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 			/* i -> i+1 will be done when i increases, can be skipped here */
 			for (j = iter_max - 1; j > i + 1; j--) {
-				n_enable_planes = hweight32(j);
+				n_enable_planes = igt_hweight32(j);
 
 				if (type == TRANSITION_MODESET_FAST &&
 				    n_enable_planes > 1 &&
@@ -568,7 +566,7 @@ cleanup:
 static void commit_display(igt_display_t *display, unsigned event_mask, bool nonblocking)
 {
 	unsigned flags;
-	int num_events = hweight32(event_mask);
+	int num_events = igt_hweight32(event_mask);
 	ssize_t ret;
 
 	flags = DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_PAGE_FLIP_EVENT;
@@ -735,7 +733,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 		igt_crc_t crcs[5][IGT_MAX_PIPES];
 		unsigned event_mask;
 
-		if (hweight32(i) > howmany)
+		if (igt_hweight32(i) > howmany)
 			continue;
 
 		event_mask = set_combinations(display, i, &fbs[0]);
@@ -747,10 +745,10 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 		collect_crcs_mask(pipe_crcs, i, crcs[0]);
 
 		for (j = iter_max - 1; j > i + 1; j--) {
-			if (hweight32(j) > howmany)
+			if (igt_hweight32(j) > howmany)
 				continue;
 
-			if (hweight32(i) < howmany && hweight32(j) < howmany)
+			if (igt_hweight32(i) < howmany && igt_hweight32(j) < howmany)
 				continue;
 
 			event_mask = set_combinations(display, j, &fbs[1]);
-- 
2.16.1

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-03-13 21:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12 20:42 [igt-dev] [PATCH i-g-t 1/3] lib: Add igt_hweight{32,64} Ville Syrjala
2018-03-12 20:42 ` [igt-dev] [PATCH i-g-t 2/3] lib: Parse plane IN_FORMATS blobifiers into a nicer form Ville Syrjala
2018-03-13 18:30   ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2018-03-13 20:56     ` Chris Wilson
2018-03-13 21:19       ` Ville Syrjälä
2018-03-12 20:42 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats Ville Syrjala
2018-03-13  0:14 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib: Add igt_hweight{32,64} Patchwork
2018-03-13  0:21 ` [igt-dev] [PATCH i-g-t 1/3] " Chris Wilson
2018-03-13  5:40 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/3] " Patchwork
2018-03-13 18:29 ` [igt-dev] [PATCH i-g-t v2 1/3] lib: Add igt_hweight() Ville Syrjala
2018-03-13 20:49   ` Chris Wilson
2018-03-13 19:16 ` [igt-dev] ✗ Fi.CI.BAT: warning for series starting with [i-g-t,v2,1/3] lib: Add igt_hweight() (rev3) Patchwork

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.