[weston,3/8] gl-renderer: only use sync-file on Linux

Submitted by Greg V on Dec. 17, 2017, 7:04 p.m.

Details

Message ID 20171217190442.29265-4-greg@unrelenting.technology
State New
Headers show
Series "Portability patches" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Greg V Dec. 17, 2017, 7:04 p.m.
If no sync_file header was found, only assume this functionality exists
when on Linux.
---
 libweston/gl-renderer.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index abf556f0..62e95c3f 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -44,7 +44,7 @@ 
 
 #ifdef HAVE_LINUX_SYNC_FILE_H
 #include <linux/sync_file.h>
-#else
+#elif __linux__
 #include "weston-sync-file.h"
 #endif
 
@@ -302,6 +302,7 @@  get_renderer(struct weston_compositor *ec)
 	return (struct gl_renderer *)ec->renderer;
 }
 
+#if defined(HAVE_LINUX_SYNC_FILE_H) || defined(__linux__)
 static int
 linux_sync_file_read_timestamp(int fd, uint64_t *ts)
 {
@@ -320,6 +321,13 @@  linux_sync_file_read_timestamp(int fd, uint64_t *ts)
 
 	return 0;
 }
+#else
+static int
+linux_sync_file_read_timestamp(int fd __attribute__((unused)), uint64_t *ts __attribute__((unused)))
+{
+	return -1;
+}
+#endif
 
 static void
 timeline_render_point_destroy(struct timeline_render_point *trp)