summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandros Frantzis <alexandros.frantzis@collabora.com>2017-09-27 15:09:15 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-09-29 10:20:42 +0300
commite39eb8f896f9640cf731715ccba64bad26556f4d (patch)
tree46024e9bcfec92898803a58fec43698426e05181
parent7192b17f3e266bfab501e7c3987aaa71815c6ecf (diff)
libweston: Add check and fallback for linux/sync_file.h
The sync file functionality is required by the upcoming GPU render timeline work, but it's only available in relatively new linux kernel versions (4.7 and above). This commit provides a "sanitized" version of the required sync file definitions. On systems that don't have the sync file header (due to having an older kernel), we will be able to fall back to our own definitions when building. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac1
-rw-r--r--libweston/weston-sync-file.h30
3 files changed, 32 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 58a5c596..9d99c694 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -334,6 +334,7 @@ gl_renderer_la_SOURCES = \
libweston/gl-renderer.c \
libweston/vertex-clipping.c \
libweston/vertex-clipping.h \
+ libweston/weston-sync-file.h \
shared/helpers.h
endif
diff --git a/configure.ac b/configure.ac
index 0ea7b703..c287fac6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,7 @@ if test x$enable_egl = xyes; then
AC_DEFINE([ENABLE_EGL], [1], [Build Weston with EGL support])
PKG_CHECK_MODULES(EGL, [egl glesv2])
PKG_CHECK_MODULES([EGL_TESTS], [egl glesv2 wayland-client wayland-egl])
+ AC_CHECK_HEADERS([linux/sync_file.h])
fi
COMPOSITOR_MODULES="$COMPOSITOR_MODULES xkbcommon >= 0.3.0"
diff --git a/libweston/weston-sync-file.h b/libweston/weston-sync-file.h
new file mode 100644
index 00000000..114e0b6e
--- /dev/null
+++ b/libweston/weston-sync-file.h
@@ -0,0 +1,30 @@
+/* Sync file Linux kernel UAPI */
+
+#ifndef WESTON_SYNC_FILE_H
+#define WESTON_SYNC_FILE_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+struct sync_fence_info {
+ char obj_name[32];
+ char driver_name[32];
+ __s32 status;
+ __u32 flags;
+ __u64 timestamp_ns;
+};
+
+struct sync_file_info {
+ char name[32];
+ __s32 status;
+ __u32 flags;
+ __u32 num_fences;
+ __u32 pad;
+
+ __u64 sync_fence_info;
+};
+
+#define SYNC_IOC_MAGIC '>'
+#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
+
+#endif