@@ -121,6 +121,7 @@ prime_self_import_LDADD = $(LDADD) -lpthread
gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
gem_userptr_blits_LDADD = $(LDADD) -lpthread
perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la
+sw_sync_LDADD = $(LDADD) -latomic
kms_flip_LDADD = $(LDADD) -lpthread
@@ -517,7 +517,7 @@ static void test_sync_multi_consumer(void)
{
sem_wait(&sem);
- __sync_fetch_and_add(&counter, 1);
+ __atomic_fetch_add(&counter, 1, __ATOMIC_SEQ_CST);
sw_sync_timeline_inc(timeline, 1);
}
@@ -554,7 +554,8 @@ static void * test_sync_multi_consumer_producer_thread(void *arg)
if (sync_fence_wait(fence, 1000) < 0)
return (void *) 1;
- if (__sync_fetch_and_add(data->counter, 1) != next_point)
+ if (__atomic_fetch_add(data->counter, 1, __ATOMIC_SEQ_CST) !=
+ next_point)
return (void *) 1;
/* Kick off the next thread. */
@@ -900,4 +901,3 @@ igt_main
igt_subtest("sync_random_merge")
test_sync_random_merge();
}
-
Replace calls to the older __sync_* functions with the new __atomic_* standard ones to be consistent with other tests and improve portability across CPU architectures. Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com> --- tests/Makefile.am | 1 + tests/sw_sync.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)