aboutsummaryrefslogtreecommitdiff
path: root/shm.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-22 20:04:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-22 20:05:05 +0000
commit795b0e7ea1cc7098fcbb76858014ffccffbf8624 (patch)
tree547ea29d52f670943b159e2278ee85070e2429a5 /shm.c
parentshm: verify the system supports FALLOC_FL_PUNCH_HOLE (diff)
shm: print performance warning when FALLOC_FL_PUNCH_HOLE isn't supported
Diffstat (limited to 'shm.c')
-rw-r--r--shm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/shm.c b/shm.c
index 2f74fc0b..b9cc325c 100644
--- a/shm.c
+++ b/shm.c
@@ -233,6 +233,12 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie)
can_punch_hole_initialized = true;
can_punch_hole = fallocate(
pool_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1) == 0;
+
+ if (!can_punch_hole) {
+ LOG_WARN(
+ "fallocate(FALLOC_FL_PUNCH_HOLE) not "
+ "supported (%s): expect lower performance", strerror(errno));
+ }
}
/* Push to list of available buffers, but marked as 'busy' */
@@ -324,9 +330,6 @@ shm_scroll(struct wl_shm *shm, struct buffer *buf, int rows)
/* Free unused memory */
if (fallocate(buf->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, new_offset) < 0) {
- LOG_ERRNO(
- "fallocate(FALLOC_FL_PUNCH_HOLE) not "
- "supported: expect lower performance");
abort();
}