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.
This commit is contained in:
Daniel Eklöf 2020-08-11 17:22:12 +02:00
parent 828a57c201
commit 732e181b1d
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

6
shm.c
View file

@ -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) {