aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-07 18:20:47 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-05-12 18:06:15 +0000
commit434c9c3a347e3afc96a6f2e1e8f2dae9379efcc3 (patch)
treebe85587df45bb396c8ff6aaadb2914fac9ddcbfb
parentshm: track busy buffers’ age, and add compile-time option to force double buffering (diff)
shm: add damage tracking to buffer
-rw-r--r--shm.c5
-rw-r--r--shm.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/shm.c b/shm.c
index a39c7c34..8bcff7c5 100644
--- a/shm.c
+++ b/shm.c
@@ -102,6 +102,9 @@ buffer_destroy(struct buffer *buf)
buf->real_mmapped = MAP_FAILED;
buf->pool = NULL;
buf->fd = -1;
+
+ tll_free(buf->scroll_damage);
+ pixman_region32_fini(&buf->dirty);
}
void
@@ -399,6 +402,8 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
if (!instantiate_offset(shm, ret, initial_offset))
goto err;
+ pixman_region32_init(&ret->dirty);
+
#if defined(MEASURE_SHM_ALLOCS) && MEASURE_SHM_ALLOCS
{
size_t currently_alloced = 0;
diff --git a/shm.h b/shm.h
index d0d79435..034b87e1 100644
--- a/shm.h
+++ b/shm.h
@@ -7,6 +7,8 @@
#include <pixman.h>
#include <wayland-client.h>
+#include "terminal.h"
+
struct buffer {
unsigned long cookie;
@@ -34,6 +36,8 @@ struct buffer {
bool purge; /* True if this buffer should be destroyed */
int age;
+ tll (struct damage) scroll_damage;
+ pixman_region32_t dirty;
};
struct buffer *shm_get_buffer(