From 732e181b1d360425cf1b4853158e266ad4f07384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 11 Aug 2020 17:22:12 +0200 Subject: [PATCH] shm: don't even try to punch a memfd hole in 32-bit This ensures we don't issue a warning if we fail, something that will just confuse users, as SHM scrolling is disabled in 32-bit anyway. --- shm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shm.c b/shm.c index e4d3378e..587baa55 100644 --- a/shm.c +++ b/shm.c @@ -291,6 +291,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie, if (!can_punch_hole_initialized) { can_punch_hole_initialized = true; +#if defined(__x86_64__) can_punch_hole = fallocate( pool_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1) == 0; @@ -299,6 +300,11 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie, "fallocate(FALLOC_FL_PUNCH_HOLE) not " "supported (%s): expect lower performance", strerror(errno)); } +#else + /* This is mostly to make sure we skip the warning issued + * above */ + can_punch_hole = false; +#endif } if (scrollable && !can_punch_hole) {