tbm_sync: first try to open mainline sw_sync node
[platform/core/uifw/libtbm.git] / src / tbm_sync.c
index e126a36..49d0266 100644 (file)
@@ -51,8 +51,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define FENCE_IOC_WAIT         _IOW(FENCE_IOC_MAGIC, 0, __s32)
 #define FENCE_IOC_MERGE                _IOWR(FENCE_IOC_MAGIC, 1, struct sync_merge_data)
 
+/* Path to the sync device legacy file. */
+#define SYNC_DEVICE_PATH_LEGACY        "/dev/sw_sync"
+
 /* Path to the sync device file. */
-#define SYNC_DEVICE_PATH       "/dev/sw_sync"
+#define SYNC_DEVICE_PATH       "/sys/kernel/debug/sync/sw_sync"
 
 /* Argument data structure for the timeline.create_fence ioctl. */
 struct create_fence_data {
@@ -111,6 +114,9 @@ tbm_sync_timeline_create(void)
 {
        tbm_fd timeline = open(SYNC_DEVICE_PATH, O_RDWR | O_CLOEXEC);
 
+       if (timeline < 0)
+               timeline = open(SYNC_DEVICE_PATH_LEGACY, O_RDWR | O_CLOEXEC);
+
        if (timeline == -1)
                _log_errno();