diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index 861119e..862f8c4 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -110,7 +110,7 @@ void sw_sync_timeline_inc(int fd, uint32_t count)
 	do_ioctl(fd, SW_SYNC_IOC_INC, &arg);
 }
 
-int sw_sync_merge(int fd1, int fd2)
+int sync_merge(int fd1, int fd2)
 {
 	struct sync_merge_data data = {};
 	int err;
@@ -126,7 +126,7 @@ int sw_sync_merge(int fd1, int fd2)
 	return data.fence;
 }
 
-int sw_sync_wait(int fd, int timeout)
+int sync_wait(int fd, int timeout)
 {
 	struct pollfd fds = {0};
 	int ret;
@@ -151,7 +151,7 @@ int sw_sync_wait(int fd, int timeout)
 	return ret;
 }
 
-int sw_sync_fence_count(int fd)
+int sync_fence_count(int fd)
 {
 	struct sync_file_info info;
 
@@ -162,7 +162,7 @@ int sw_sync_fence_count(int fd)
 	return info.num_fences;
 }
 
-static int __sw_sync_fence_count_status(int fd, int status)
+static int __sync_fence_count_status(int fd, int status)
 {
 	struct sync_file_info info;
 	struct sync_fence_info *fence_info;
@@ -191,9 +191,9 @@ static int __sw_sync_fence_count_status(int fd, int status)
 	return count;
 }
 
-int sw_sync_fence_count_status(int fd, int status)
+int sync_fence_count_status(int fd, int status)
 {
-	int count = __sw_sync_fence_count_status(fd, status);
+	int count = __sync_fence_count_status(fd, status);
 	igt_assert(count >= 0);
 	return count;
 }
diff --git a/lib/sw_sync.h b/lib/sw_sync.h
index fee9249..1f47b29 100644
--- a/lib/sw_sync.h
+++ b/lib/sw_sync.h
@@ -39,10 +39,10 @@ int sw_sync_timeline_create(void);
 int __sw_sync_fence_create(int fd, uint32_t seqno);
 int sw_sync_fence_create(int fd, uint32_t seqno);
 void sw_sync_timeline_inc(int fd, uint32_t count);
-int sw_sync_merge(int fd1, int fd2);
-int sw_sync_wait(int fence, int timeout);
-int sw_sync_fence_count(int fd);
-int sw_sync_fence_count_status(int fd, int status);
+int sync_merge(int fd1, int fd2);
+int sync_wait(int fence, int timeout);
+int sync_fence_count(int fd);
+int sync_fence_count_status(int fd, int status);
 
 #endif
 
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 65e0792..8848094 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -131,6 +131,7 @@ TESTS_progs_M = \
 	prime_mmap_kms \
 	prime_self_import \
 	prime_vgem \
+	sw_sync \
 	template \
 	vgem_basic \
 	vgem_slow \
diff --git a/tests/drm_fence b/tests/drm_fence
new file mode 100755
index 0000000000000000000000000000000000000000..e6dd304879891827c182f517db4c6f972e082554
GIT binary patch
diff --git a/tests/kms_atomic.c.rej b/tests/kms_atomic.c.rej
new file mode 100644
index 0000000..3ab73c8
--- /dev/null
+++ b/tests/kms_atomic.c.rej
@@ -0,0 +1,15 @@
+--- tests/kms_atomic.c
++++ tests/kms_atomic.c
+@@ -1627,10 +1625,10 @@ static void fence_out_commit_n(struct kms_atomic_crtc_state *crtc,
+ 		  memset(&ioc, 0, sizeof(ioc));
+ 		  memset(&out_fences_raw, 0, count_out_fences * sizeof(*out_fences_raw));
+ 
+-		  for (j = 0; j < count_out_fences; j++)
++		  for (i = 0; i < count_out_fences; i++)
+ 		  {
+ 			  out_fences_raw[0].fd = -1;
+-			  out_fences_raw[0].crtc_id = crtc->state->crtcs[j].obj;
++			  out_fences_raw[0].crtc_id = crtc->state->crtcs[i].obj;
+ 		  }
+ 
+ 		  req = drmModeAtomicAlloc();
diff --git a/tests/kms_fence b/tests/kms_fence
new file mode 100755
index 0000000000000000000000000000000000000000..1cd691fb0d7d75bb398db780ede63ab361b01943
GIT binary patch
diff --git a/tests/sw_sync.c b/tests/sw_sync.c
new file mode 100644
index 0000000..7d27234
--- /dev/null
+++ b/tests/sw_sync.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012 Google, Inc
+ * Copyright © 2016 Collabora, Ltd.
+ *
+ * Based on the implementation from the Android Open Source Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Robert Foss <robert.foss@collabora.com>
+ */
+
+#include <stdint.h>
+#include <unistd.h>
+
+#include "igt.h"
+#include "igt_aux.h"
+
+#include "sw_sync.h"
+
+
+IGT_TEST_DESCRIPTION("Test SW Sync Framework");
+
+static void test_alloc_timeline(void)
+{
+	int timeline;
+
+	timeline = sw_sync_timeline_create();
+	close(timeline);
+}
+
+igt_main
+{
+	igt_subtest("alloc_timeline")
+		test_alloc_timeline();
+}
+
